Xml_parserSourceXml Light Parser
While basic parsing functions can be used in the Xml module, this module is providing a way to create, configure and run an Xml parser.
An Xml node is either Element (tag-name, attributes, children) or PCData text
Abstract type for an Xml parser.
Several exceptions can be raised when parsing an Xml document :
Xml.Error is raised when an xml parsing error occurs. the Xml.error_msg tells you which error occurred during parsing and the Xml.error_pos can be used to retrieve the document location where the error occurred at.Xml.File_not_found is raised when an error occurred while opening a file with the Xml.parse_file function.Get the relative character range (in current line) the error occurred at.
Several kind of resources can contain Xml documents.
When a Xml document is parsed, the parser may check that the end of the document is reached, so for example parsing "<A/><B/>" will fail instead of returning only the A element. You can turn on this check by setting check_eof to true (by default, check_eof is false, unlike in the original Xmllight).
Once the parser is configured, you can run the parser on a any kind of xml document source to parse its contents into an Xml data structure.
When do_not_canonicalize is set, the XML document is given as is, without trying to remove blank PCDATA elements.