Xml Syntax Definition

XT -- A Bundle of Program Transformation Tools
xml-tools contains a syntax definition in SDF for XML. This syntax defintion is not competely compatible with XML, but it tries to do the job as good as possible in a pure syntax definition.

The syntax definition should not be used for parsing XML files. This might sound odd, but for standard XML parsers do a much better job in terms of performance and standard compliance. The parse-xml-info tool supports parsing XML files with the standard XML parser of Java. So what is the use of the syntax definition? It can be used to embed XML in programming languages like Stratego and Java.

Besides the obvious constructs, the grammar supports entities, character references and namespaces.

Known problems:

  • SGLR and SDF just support ASCII and therefore the grammar just supports ASCII. This will not change until SGLR and SDF supports Unicode. The grammar will never support different encodings. We need a hand coded XML parser for that.

  • DTD declarations in XML files are not supported. The DTD grammar is work in progress. Maybe DTD constructs in XML documents will be supported when this grammar is stable. External document type declarations (DOCTYPE) are supported.

  • Whitespace between elements and text nodes is ignored. Whitespace between words and entities is preserved. This will not be fixed until it is possible to define constructors for lexical syntax in SDF.

-- MartinBravenboer - 12 Jul 2003