pyre.xml

Package Contents

pyre.xml.newReader(**kwds)

Create a new reader

pyre.xml.newLocator(saxlocator)

Convert a locator from the SAX parser to a pyre.tracking.FileLocator

class pyre.xml.node

The base class for parsing event handlers

tag
elements = []
namespace =
newLocator
_pyre_nodeIndex
_pyre_nodeQIndex
content(self, text, locator)

The handler for textual data within my body that is not associated with any of my children

newNode(self, *, name, attributes, locator)

The handler invoked when the opening tag for one of my children is encountered.

The default implementation looks up the tag in my local dtd, retrieves the associated node factory, and invokes it to set up the context for handlingits content

In typical use, there is no need to override this; but if you do, you should make sure to return a Node descendant that is properly set up to handle the contents of the named tag

newQNode(self, *, name, namespace, attributes, locator)

The handler invoked when the opening tag for one of my namespace qualified children is encountered.

See Node.newNode for details

class pyre.xml.ignorable(**kwds)

Bases: pyre.xml.Node.Node

Handler that ignores the subtree anchored at its tag

newNode(self, **kwds)

Invoked when a new opening tag is encountered in my subtree

newQNode(self, **kwds)

Invoked when a new namespace qualified opening tag is encountered in my subtree

notify(self, **kwds)

Invoked when a closing tag in encountered in my subtree

class pyre.xml.document

Bases: pyre.xml.Node.Node

Base class for the custom processing of XML parsing events. You must derive from this class and declare the element descriptors that correspond to the tags in your document. Instances of your derived class will form the interface between the XML parser and the application specific data structure being decorated with the contents of the XML stream.

This object is the anchor for the handler of the top element handler that is reposinsible for the root of the XML document.

The DTD metaclass scans through the class record, identifies the element declarations and builds the DTF for the document

tag = document
root
elements = []
dtd
dom
_pyre_nodeIndex
initialize(self, locator)

Handler for the event generated when parsing the XML document has just begun

finalize(self, locator)

Handler for the event generated when parsing of the XML document is finished

class pyre.xml.element(*, tag, handler, root=False)

Bases: pyre.xml.Descriptor.Descriptor

Descriptor class that gathers all the metadata about a document tag that was provided by the user during the DTD declaration. It is used by DTD derived classes to decorate the Document instance and the tag handlers with the information needed by the Reader so it can process XML documents

handler
attributes = []
pyre.xml.CDATA = CDATA
pyre.xml.ID = ID
pyre.xml.IDREFS = IDREFS
pyre.xml.NMTOKEN = NMTOKEN
pyre.xml.NMTOKENS = NMTOKENS
pyre.xml.ENTITY = ENTITY
pyre.xml.ENTITIES = ENTITIES
pyre.xml.NOTATION = NOTATION
pyre.xml.XML = xml:
pyre.xml.REQUIRED = #REQUIRED
pyre.xml.IMPLIED = #IMPLIED
pyre.xml.FIXED = #FIXED