simpleparse.xml.xml_parser | index /home/mcfletch/pylive/simpleparse/xml/xml_parser.py |
XML Parser based (loosely) on the XML Spec's EBNF
This is a hand-coded parser based on the W3C's XML specification,
there was a lot of busy-work rewriting to make the syntax agree,
but also a number of signficant structural changes required by
the limitations of the SimpleParse engine, and the completely
procedural definition of References in the XML spec (the References
don't occur in most places they can occur, and they are seen as
altering the buffer directly as soon as they are encountered, this
isn't something that fits readily into the mx.TextTools engine.
http://www.w3.org/TR/REC-xml#sec-references
Major Deviations from Spec:
No support for the unicode-style character classes
No support for UTF-16 (or Unicode at all, for that matter)
No support for References that alter the production
being parsed, so you can't have a Reference to an
item "</this>and<this>" or similar non-structure-
respecting References. References have
particular locations they can occur, and they are
just ignored elsewhere
No support for parsing the contents of References within
the primary parsing pass
No support for excluded start/end tags
Comments allowed in both tags and declarations (but not
inside content-specifiers).
Allows end tags of the form </>
Modules | ||||||
|
Data | ||
declaration = "\n\n# Simple (changable) literals\n# These should b...>'\n\n\ndocument := prolog, element, Misc*\n" |