Package xml :: Package dom :: Module expatbuilder
[hide private]
[frames] | no frames]

Module expatbuilder

Facility to use the Expat parser to load a minidom instance from a string or file.

This avoids all the overhead of SAX and pulldom to gain performance.

Classes [hide private]
ElementInfo
ExpatBuilder
Document builder that uses Expat to build a ParsedXML.DOM document instance.
FilterVisibilityController
Wrapper around a DOMBuilderFilter which implements the checks to make the whatToShow filter attribute work.
FilterCrutch
Rejecter
Skipper
FragmentBuilder
Builder which constructs document fragments given XML source text and a context node.
Namespaces
Mix-in class for builders; adds support for namespaces.
ExpatBuilderNS
Document builder that supports namespaces.
FragmentBuilderNS
Fragment builder that supports namespaces.
ParseEscape
Exception raised to short-circuit parsing in InternalSubsetExtractor.
InternalSubsetExtractor
XML processor which can rip out the internal document type subset.
Functions [hide private]
 
_intern(builder, s)
 
_parse_ns_name(builder, name)
 
parse(file, namespaces=True)
Parse a document, returning the resulting Document node.
 
parseString(string, namespaces=True)
Parse a document from a string, returning the resulting Document node.
 
parseFragment(file, context, namespaces=True)
Parse a fragment of a document, given the context from which it was originally extracted.
 
parseFragmentString(string, context, namespaces=True)
Parse a fragment of a document from a string, given the context from which it was originally extracted.
 
makeBuilder(options)
Create a builder based on an Options object.
Variables [hide private]
  TEXT_NODE = 3
  CDATA_SECTION_NODE = 4
  DOCUMENT_NODE = 9
  FILTER_ACCEPT = 1
  FILTER_REJECT = 2
  FILTER_SKIP = 3
  FILTER_INTERRUPT = 4
  theDOMImplementation = DOMImplementation()
  _typeinfo_map = {'CDATA': <TypeInfo 'cdata'>, 'ENTITIES': <Typ...
  _ALLOWED_FILTER_RETURNS = (1, 2, 3)
  _FRAGMENT_BUILDER_INTERNAL_SYSTEM_ID = 'http://xml.python.org/...
  _FRAGMENT_BUILDER_TEMPLATE = '<!DOCTYPE wrapper\n %s [\n <!E...

Imports: xmlbuilder, minidom, Node, EMPTY_NAMESPACE, EMPTY_PREFIX, XMLNS_NAMESPACE, expat, _append_child, _set_attribute_node, NodeFilter, NodeList, EmptyNodeList, defproperty, StringTypes


Function Details [hide private]

parse(file, namespaces=True)

 

Parse a document, returning the resulting Document node.

'file' may be either a file name or an open file object.

parseFragment(file, context, namespaces=True)

 

Parse a fragment of a document, given the context from which it was originally extracted. context should be the parent of the node(s) which are in the fragment.

'file' may be either a file name or an open file object.

parseFragmentString(string, context, namespaces=True)

 

Parse a fragment of a document from a string, given the context from which it was originally extracted. context should be the parent of the node(s) which are in the fragment.


Variables Details [hide private]

_typeinfo_map

Value:
{'CDATA': <TypeInfo 'cdata'>,
 'ENTITIES': <TypeInfo 'entities'>,
 'ENTITY': <TypeInfo 'entity'>,
 'ENUM': <TypeInfo 'enumeration'>,
 'ID': <TypeInfo 'id'>,
 'IDREF': <TypeInfo 'idref'>,
 'IDREFS': <TypeInfo 'idrefs'>,
 'NMTOKEN': <TypeInfo 'nmtoken'>,
...

_FRAGMENT_BUILDER_INTERNAL_SYSTEM_ID

Value:
'http://xml.python.org/entities/fragment-builder/internal'

_FRAGMENT_BUILDER_TEMPLATE

Value:
'''<!DOCTYPE wrapper
  %s [
  <!ENTITY fragment-builder-internal
    SYSTEM "http://xml.python.org/entities/fragment-builder/internal">
%s
]>
<wrapper %s
>&fragment-builder-internal;</wrapper>'''