LxmlSaxHandler¶
-
class
xsdata.formats.dataclass.parsers.handlers.
LxmlSaxHandler
(parser, clazz, queue=<factory>, objects=<factory>)[source]¶ Sax content handler based on
lxml.etree.XMLParser
api.- Parameters
parser (
PushParser
) – The parser instance to feed with eventsclazz (
Optional
[Type
]) – The target binding model. If None the parser will auto locate it from the active xml context instancequeue (
List
) – The XmlNode queueobjects (
List
) – The list of intermediate parsed objects, eg [(qname, object)]
-
parse
(source)[source]¶ Parse an XML document from a system identifier or an InputSource.
The xml parser will ignore comments, recover from errors and clean duplicate namespace prefixes.
-
close
()¶ Close document notification receiver.
The receiver will flush any previous active element and return the first item in the objects stack.
- Return type
-
data
(data)¶ Data notification receiver.
The receiver will append the given data content in the current data frame either in the text position 0 or in the tail position 1 whether the element has ended or not.
- Parameters
data (
str
) – Text or tail content
-
end
(qname)¶ End element notification receiver.
The receiver will flush any previous active element and set the next element to be flushed.
- Parameters
qname (
str
) – Qualified name
-
flush
()¶ Flush element notification receiver.
The receiver will check if there is an active element present, collect and join the data frames for text/tail content and notify the main parser to finish the binding process for the element.
-
start
(qname, attrs, ns_map)¶ Start element notification receiver.
The receiver will flush any previous active element, append a new data frame to collect data content for the next active element and notify the main parser to prepare for next binding instruction.