class documentation

class XmlAttrBuilder(object): (source)

Constructor: XmlAttrBuilder()

View In Hierarchy

XML parser for complex Python attributes (dictionaries, lists, blobs).

Parses XML documents into Python data structures using expat. Used internally by ZMS for importing attribute values.

Method __init__ Constructor.
Method OnCharacterData Handle character data from the XML parser.
Method OnComment Handle an XML comment (ignored).
Method OnEndCData Handle end of a CDATA section.
Method OnEndElement Handle the end of an XML element.
Method OnEndNamespaceDecl Handle end of a namespace declaration (ignored).
Method OnProcessingInstruction Handle a processing instruction (ignored).
Method OnStartCData Handle start of a CDATA section.
Method OnStartElement Handle the start of an XML element.
Method OnStartNamespaceDecl Handle start of a namespace declaration (ignored).
Method parse Parse a given XML document into Python data structures.
Class Variable iBufferSize Undocumented
Instance Variable bInCData Undocumented
Instance Variable dTagStack Undocumented
Instance Variable dValueStack Undocumented
def __init__(self): (source)

Constructor.

def OnCharacterData(self, sData): (source)

Handle character data from the XML parser.

Appends character data to the current tag's cdata buffer.

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

Handle an XML comment (ignored).

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

Handle end of a CDATA section.

def OnEndElement(self, sTagName): (source)

Handle the end of an XML element.

Pops the current tag from the stack, processes its content depending on element type (data or item), and updates the value stack accordingly.

Parameters
sTagName:strElement (tag) name
Raises
ParseErrorIf end tag does not match the expected start tag
def OnEndNamespaceDecl(self, prefix): (source)

Handle end of a namespace declaration (ignored).

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

Handle a processing instruction (ignored).

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

Handle start of a CDATA section.

def OnStartElement(self, sTagName, dTagAttrs): (source)

Handle the start of an XML element.

Called by the expat parser on occurrence of an XML start tag. Pushes a new tag onto the tag stack and, for container elements (data, dictionary, list), pushes an initial value onto the value stack.

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

Handle start of a namespace declaration (ignored).

Parameters
prefix:strNamespace prefix
uri:strNamespace URI
def parse(self, input): (source)

Parse a given XML document into Python data structures.

Parameters
input:bytes or file-likeXML document as string or file object
Returns
Parsed value (dict, list, or blob), or None if nothing was parsed
Raises
ParseErrorIf the XML document contains syntax errors
iBufferSize = (source)

Undocumented

bInCData: int = (source)

Undocumented

dTagStack = (source)

Undocumented

dValueStack = (source)

Undocumented