Package gnue :: Package common :: Package definitions :: Module GParser :: Class xmlHandler
[show private | hide private]

Class xmlHandler

ContentHandler --+
                 |
                xmlHandler

Known Subclasses:
xmlSchemaHandler

This class is used by the XML parser to process the XML file.
Method Summary
  __init__(self)
  _object_created_(self, obj)
  characters(self, content)
Called by the internal SAX parser whenever text (not part of a tag) is encountered.
  comment(self, text)
  endCDATA(self)
  endDTD(self)
  endElementNS(self, name, qname)
Called by the internal SAX parser whenever an ending XML tag/element is encountered.
  endEntity(self, name)
  finalValidation(self)
Perform a final validation of the tags.
  getRoot(self)
Return the root node of the object tree
  getRootComments(self)
Return sequence of comment tags given before the root node
  initValidation(self)
Update some statistics about the elements in use.
  startCDATA(self)
  startDTD(self, name, public_id, system_id)
  startElementNS(self, name, qname, attrs)
Signals the start of an element in namespace mode.
  startEntity(self, name)

Class Variable Summary
NoneType default_namespace: The default namespace (which would be dropped), i.e.
bool ignore_unknown_namespaces: If set to True, any elements that have an unknown namespace will be dropped.
dict xmlElements = {}
NoneType xmlMasqueradeNamespaceElements = None                                                                  
bool xmlNamespaceAttributesAsPrefixes = False

Method Details

__init__(self)
(Constructor)

Overrides:
_xmlplus.sax.handler.ContentHandler.__init__

_object_created_(self, obj)

characters(self, content)

Called by the internal SAX parser whenever text (not part of a tag) is encountered.
Overrides:
_xmlplus.sax.handler.ContentHandler.characters

comment(self, text)

endCDATA(self)

endDTD(self)

endElementNS(self, name, qname)

Called by the internal SAX parser whenever an ending XML tag/element is encountered.
Overrides:
_xmlplus.sax.handler.ContentHandler.endElementNS

endEntity(self, name)

finalValidation(self)

Perform a final validation of the tags. Checks if all required tags are really defined (via tag-counter dictionary).

getRoot(self)

Returns:
the root node of the object tree

getRootComments(self)

Returns:
sequence of comment tags given before the root node

initValidation(self)

Update some statistics about the elements in use. All 'required' elements will be added to the sequence _requiredTags and all elements having a True value set for 'SingleInstance' will be added to the sequence _singleInstanceTags. Additionally the tag-counter dictionary will be reset.

startCDATA(self)

startDTD(self, name, public_id, system_id)

startElementNS(self, name, qname, attrs)

Signals the start of an element in namespace mode.

The name parameter contains the name of the element type as a (uri, localname) tuple, the qname parameter the raw XML 1.0 name used in the source document, and the attrs parameter holds an instance of the Attributes class containing the attributes of the element.

The uri part of the name tuple is None for elements which have no namespace.
Overrides:
_xmlplus.sax.handler.ContentHandler.startElementNS

startEntity(self, name)


Class Variable Details

default_namespace

The default namespace (which would be dropped), i.e. if the default namespace is 'Foo', then <Foo:test> would just be processed as <test>.
Type:
NoneType
Value:
None                                                                  

ignore_unknown_namespaces

If set to True, any elements that have an unknown namespace will be dropped.
Type:
bool
Value:
False                                                                  

xmlElements

Type:
dict
Value:
{}                                                                     

xmlMasqueradeNamespaceElements

Type:
NoneType
Value:
None                                                                  

xmlNamespaceAttributesAsPrefixes

Type:
bool
Value:
False                                                                  


GNUe Home

Public API

Developer's Corner