xml.dom.expatbuilder
index
/usr/local/lib/python2.5/xml/dom/expatbuilder.py
Module Docs

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.

 
Modules
       
xml.parsers.expat
xml.dom.minidom
xml.dom.xmlbuilder

 
Classes
       
__builtin__.object
ElementInfo
FilterCrutch
Rejecter
Skipper
FilterVisibilityController
exceptions.Exception(exceptions.BaseException)
ParseEscape
ExpatBuilder
FragmentBuilder
InternalSubsetExtractor
Namespaces
ExpatBuilderNS(Namespaces, ExpatBuilder)
FragmentBuilderNS(Namespaces, FragmentBuilder)

 
class ElementInfo(__builtin__.object)
     Methods defined here:
__getstate__(self)
__init__(self, tagName, model=None)
__setstate__(self, state)
getAttributeType(self, aname)
getAttributeTypeNS(self, namespaceURI, localName)
isElementContent(self)
isEmpty(self)
isId(self, aname)
isIdNS(self, euri, ename, auri, aname)

Data descriptors defined here:
tagName

 
class ExpatBuilder
    Document builder that uses Expat to build a ParsedXML.DOM document
instance.
 
  Methods defined here:
__init__(self, options=None)
attlist_decl_handler(self, elem, name, type, default, required)
character_data_handler(self, data)
character_data_handler_cdata(self, data)
comment_handler(self, data)
createParser(self)
Create a new parser object.
element_decl_handler(self, name, model)
end_cdata_section_handler(self)
end_doctype_decl_handler(self)
end_element_handler(self, name)
# If this ever changes, Namespaces.end_element_handler() needs to
# be changed to match.
entity_decl_handler(self, entityName, is_parameter_entity, value, base, systemId, publicId, notationName)
external_entity_ref_handler(self, context, base, systemId, publicId)
first_element_handler(self, name, attributes)
getParser(self)
Return the parser object, creating a new one if needed.
install(self, parser)
Install the callbacks needed to build the DOM into the parser.
notation_decl_handler(self, notationName, base, systemId, publicId)
parseFile(self, file)
Parse a document from a file object, returning the document
node.
parseString(self, string)
Parse a document from a string, returning the document node.
pi_handler(self, target, data)
reset(self)
Free all data structures used during DOM construction.
start_cdata_section_handler(self)
start_doctype_decl_handler(self, doctypeName, systemId, publicId, has_internal_subset)
start_element_handler(self, name, attributes)
xml_decl_handler(self, version, encoding, standalone)

 
class ExpatBuilderNS(Namespaces, ExpatBuilder)
    Document builder that supports namespaces.
 
 
Method resolution order:
ExpatBuilderNS
Namespaces
ExpatBuilder

Methods defined here:
reset(self)

Methods inherited from Namespaces:
createParser(self)
Create a new namespace-handling parser.
end_element_handler(self, name)
# This only adds some asserts to the original
end_element_handler(), so we only define this when -O is not
# used.  If changing one, be sure to check the other to see if
# it needs to be changed as well.
install(self, parser)
Insert the namespace-handlers onto the parser.
start_element_handler(self, name, attributes)
start_namespace_decl_handler(self, prefix, uri)
Push this namespace declaration on our storage.

Methods inherited from ExpatBuilder:
__init__(self, options=None)
attlist_decl_handler(self, elem, name, type, default, required)
character_data_handler(self, data)
character_data_handler_cdata(self, data)
comment_handler(self, data)
element_decl_handler(self, name, model)
end_cdata_section_handler(self)
end_doctype_decl_handler(self)
entity_decl_handler(self, entityName, is_parameter_entity, value, base, systemId, publicId, notationName)
external_entity_ref_handler(self, context, base, systemId, publicId)
first_element_handler(self, name, attributes)
getParser(self)
Return the parser object, creating a new one if needed.
notation_decl_handler(self, notationName, base, systemId, publicId)
parseFile(self, file)
Parse a document from a file object, returning the document
node.
parseString(self, string)
Parse a document from a string, returning the document node.
pi_handler(self, target, data)
start_cdata_section_handler(self)
start_doctype_decl_handler(self, doctypeName, systemId, publicId, has_internal_subset)
xml_decl_handler(self, version, encoding, standalone)

 
class FilterCrutch(__builtin__.object)
     Methods defined here:
__init__(self, builder)

 
class FilterVisibilityController(__builtin__.object)
    Wrapper around a DOMBuilderFilter which implements the checks
to make the whatToShow filter attribute work.
 
  Methods defined here:
__init__(self, filter)
acceptNode(self, node)
startContainer(self, node)

Data descriptors defined here:
filter

 
class FragmentBuilder(ExpatBuilder)
    Builder which constructs document fragments given XML source
text and a context node.
 
The context node is expected to provide information about the
namespace declarations which are in scope at the start of the
fragment.
 
  Methods defined here:
__init__(self, context, options=None)
external_entity_ref_handler(self, context, base, systemId, publicId)
parseFile(self, file)
Parse a document fragment from a file object, returning the
fragment node.
parseString(self, string)
Parse a document fragment from a string, returning the
fragment node.
reset(self)

Methods inherited from ExpatBuilder:
attlist_decl_handler(self, elem, name, type, default, required)
character_data_handler(self, data)
character_data_handler_cdata(self, data)
comment_handler(self, data)
createParser(self)
Create a new parser object.
element_decl_handler(self, name, model)
end_cdata_section_handler(self)
end_doctype_decl_handler(self)
end_element_handler(self, name)
# If this ever changes, Namespaces.end_element_handler() needs to
# be changed to match.
entity_decl_handler(self, entityName, is_parameter_entity, value, base, systemId, publicId, notationName)
first_element_handler(self, name, attributes)
getParser(self)
Return the parser object, creating a new one if needed.
install(self, parser)
Install the callbacks needed to build the DOM into the parser.
notation_decl_handler(self, notationName, base, systemId, publicId)
pi_handler(self, target, data)
start_cdata_section_handler(self)
start_doctype_decl_handler(self, doctypeName, systemId, publicId, has_internal_subset)
start_element_handler(self, name, attributes)
xml_decl_handler(self, version, encoding, standalone)

 
class FragmentBuilderNS(Namespaces, FragmentBuilder)
    Fragment builder that supports namespaces.
 
 
Method resolution order:
FragmentBuilderNS
Namespaces
FragmentBuilder
ExpatBuilder

Methods defined here:
reset(self)

Methods inherited from Namespaces:
createParser(self)
Create a new namespace-handling parser.
end_element_handler(self, name)
# This only adds some asserts to the original
end_element_handler(), so we only define this when -O is not
# used.  If changing one, be sure to check the other to see if
# it needs to be changed as well.
install(self, parser)
Insert the namespace-handlers onto the parser.
start_element_handler(self, name, attributes)
start_namespace_decl_handler(self, prefix, uri)
Push this namespace declaration on our storage.

Methods inherited from FragmentBuilder:
__init__(self, context, options=None)
external_entity_ref_handler(self, context, base, systemId, publicId)
parseFile(self, file)
Parse a document fragment from a file object, returning the
fragment node.
parseString(self, string)
Parse a document fragment from a string, returning the
fragment node.

Methods inherited from ExpatBuilder:
attlist_decl_handler(self, elem, name, type, default, required)
character_data_handler(self, data)
character_data_handler_cdata(self, data)
comment_handler(self, data)
element_decl_handler(self, name, model)
end_cdata_section_handler(self)
end_doctype_decl_handler(self)
entity_decl_handler(self, entityName, is_parameter_entity, value, base, systemId, publicId, notationName)
first_element_handler(self, name, attributes)
getParser(self)
Return the parser object, creating a new one if needed.
notation_decl_handler(self, notationName, base, systemId, publicId)
pi_handler(self, target, data)
start_cdata_section_handler(self)
start_doctype_decl_handler(self, doctypeName, systemId, publicId, has_internal_subset)
xml_decl_handler(self, version, encoding, standalone)

 
class InternalSubsetExtractor(ExpatBuilder)
    XML processor which can rip out the internal document type subset.
 
  Methods defined here:
end_doctype_decl_handler(self)
getSubset(self)
Return the internal subset as a string.
install(self, parser)
parseFile(self, file)
parseString(self, string)
start_doctype_decl_handler(self, name, publicId, systemId, has_internal_subset)
start_element_handler(self, name, attrs)

Data and other attributes defined here:
subset = None

Methods inherited from ExpatBuilder:
__init__(self, options=None)
attlist_decl_handler(self, elem, name, type, default, required)
character_data_handler(self, data)
character_data_handler_cdata(self, data)
comment_handler(self, data)
createParser(self)
Create a new parser object.
element_decl_handler(self, name, model)
end_cdata_section_handler(self)
end_element_handler(self, name)
# If this ever changes, Namespaces.end_element_handler() needs to
# be changed to match.
entity_decl_handler(self, entityName, is_parameter_entity, value, base, systemId, publicId, notationName)
external_entity_ref_handler(self, context, base, systemId, publicId)
first_element_handler(self, name, attributes)
getParser(self)
Return the parser object, creating a new one if needed.
notation_decl_handler(self, notationName, base, systemId, publicId)
pi_handler(self, target, data)
reset(self)
Free all data structures used during DOM construction.
start_cdata_section_handler(self)
xml_decl_handler(self, version, encoding, standalone)

 
class Namespaces
    Mix-in class for builders; adds support for namespaces.
 
  Methods defined here:
createParser(self)
Create a new namespace-handling parser.
end_element_handler(self, name)
# This only adds some asserts to the original
end_element_handler(), so we only define this when -O is not
# used.  If changing one, be sure to check the other to see if
# it needs to be changed as well.
install(self, parser)
Insert the namespace-handlers onto the parser.
start_element_handler(self, name, attributes)
start_namespace_decl_handler(self, prefix, uri)
Push this namespace declaration on our storage.

 
class ParseEscape(exceptions.Exception)
    Exception raised to short-circuit parsing in InternalSubsetExtractor.
 
 
Method resolution order:
ParseEscape
exceptions.Exception
exceptions.BaseException
__builtin__.object

Data descriptors defined here:
__weakref__
list of weak references to the object (if defined)

Methods inherited from exceptions.Exception:
__init__(...)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Data and other attributes inherited from exceptions.Exception:
__new__ = <built-in method __new__ of type object at 0x8125440>
T.__new__(S, ...) -> a new object with type S, a subtype of T

Methods inherited from exceptions.BaseException:
__delattr__(...)
x.__delattr__('name') <==> del x.name
__getattribute__(...)
x.__getattribute__('name') <==> x.name
__getitem__(...)
x.__getitem__(y) <==> x[y]
__getslice__(...)
x.__getslice__(i, j) <==> x[i:j]
 
Use of negative indices is not supported.
__reduce__(...)
__repr__(...)
x.__repr__() <==> repr(x)
__setattr__(...)
x.__setattr__('name', value) <==> x.name = value
__setstate__(...)
__str__(...)
x.__str__() <==> str(x)

Data descriptors inherited from exceptions.BaseException:
__dict__
args
message
exception message

 
class Rejecter(FilterCrutch)
    
Method resolution order:
Rejecter
FilterCrutch
__builtin__.object

Methods defined here:
__init__(self, builder)
end_element_handler(self, *args)
start_element_handler(self, *args)

 
class Skipper(FilterCrutch)
    
Method resolution order:
Skipper
FilterCrutch
__builtin__.object

Methods defined here:
end_element_handler(self, *args)
start_element_handler(self, *args)

Methods inherited from FilterCrutch:
__init__(self, builder)

 
Functions
       
makeBuilder(options)
Create a builder based on an Options object.
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.
parseString(string, namespaces=True)
Parse a document from a string, returning the resulting
Document node.

 
Data
        CDATA_SECTION_NODE = 4
DOCUMENT_NODE = 9
EMPTY_NAMESPACE = None
EMPTY_PREFIX = None
FILTER_ACCEPT = 1
FILTER_INTERRUPT = 4
FILTER_REJECT = 2
FILTER_SKIP = 3
StringTypes = (<type 'str'>, <type 'unicode'>)
TEXT_NODE = 3
XMLNS_NAMESPACE = 'http://www.w3.org/2000/xmlns/'
theDOMImplementation = <xml.dom.minidom.DOMImplementation instance at 0xb63fafec>