class documentation

class Builder(object): (source)

Constructor: Builder()

View In Hierarchy

Generic XML builder for constructing ZMS object trees.

The builder wires expat parser callbacks to object-creation and object-update hooks implemented by ZMS node classes.

Method __init__ Initialize builder state.
Method OnCharacterData Handle character data parsed by expat.
Method OnComment Handle an XML comment.
Method OnEndCData Handle the end of a CDATA section.
Method OnEndElement Handle the end of an XML element.
Method OnEndNamespaceDecl Handle the end of a namespace declaration.
Method OnProcessingInstruction Handle a processing instruction.
Method OnStartCData Handle the start of a CDATA section.
Method OnStartElement Handle the start of an XML element.
Method OnStartNamespaceDecl Handle the start of a namespace declaration.
Method parse Parse an XML document and build a recursive object tree.
Class Variable iBufferSize Undocumented
Instance Variable bInCData Undocumented
Instance Variable oCurrNode Undocumented
Instance Variable oLastNode Undocumented
Instance Variable oRootTag Undocumented
def __init__(self): (source)

Initialize builder state.

def OnCharacterData(self, data): (source)

Handle character data parsed by expat.

Parameters
data:strCharacter data
def OnComment(self, data): (source)

Handle an XML comment.

Comments are ignored by this builder.

Parameters
data:strComment content
def OnEndCData(self): (source)

Handle the end of a CDATA section.

def OnEndElement(self, name): (source)

Handle the end of an XML element.

Finalizes the current node or delegates unknown end tags to the current node.

Parameters
name:strElement name
Raises
ParseErrorIf an unknown end tag cannot be handled
def OnEndNamespaceDecl(self, prefix): (source)

Handle the end of a namespace declaration.

Namespace declarations are ignored by this builder.

Parameters
prefix:strNamespace prefix
def OnProcessingInstruction(self, target, data): (source)

Handle a processing instruction.

Processing instructions are ignored by this builder.

Parameters
target:strProcessing instruction target
data:strProcessing instruction data
def OnStartCData(self): (source)

Handle the start of a CDATA section.

def OnStartElement(self, name, attrs): (source)

Handle the start of an XML element.

Creates a new node for known meta objects or forwards unknown tags to the current node.

Parameters
name:strElement name
attrs:dictDictionary of element attributes
def OnStartNamespaceDecl(self, prefix, uri): (source)

Handle the start of a namespace declaration.

Namespace declarations are ignored by this builder.

Parameters
prefix:strNamespace prefix
uri:strNamespace URI
def parse(self, input, root=None, bInRootTag=0): (source)

Parse an XML document and build a recursive object tree.

Parameters
input:bytes or file-likeXML document as bytes or file-like object
root:objectOptional pre-existing root node
bInRootTag:intFlag indicating parsing starts inside an existing root tag
Returns
Last parsed node or root object
Raises
ParseErrorIf the XML document contains syntax errors
iBufferSize = (source)

Undocumented

bInCData: int = (source)

Undocumented

oCurrNode = (source)

Undocumented

oLastNode = (source)

Undocumented

oRootTag = (source)

Undocumented