A Friday afternoon XML koan

Roger L Costello <[email protected]>
Newsgroups gmane.text.xml.devel
Message-ID <SA9PR09MB59525B7941C776A31120BEE0C8C59@SA9PR09MB5952.namprd09.prod.outlook.com>
There are many aspects of XML that require knowledge of its context. For example, earlier in the week my "XML quiz" noted that &amp; does not always mean & (in the context of a CDATA section or a comment it means &amp; but otherwise it means &)

So things are context-dependent.

Another way of saying it is: Things are context-sensitive. XML is context-sensitive.

Koan: If XML isn't context-free, why are we always writing context-free grammars for it?  (And don't say, "Because it's useful to do so;" that begs the question:  Why is it useful?)

Scroll down to see the answer ..............




















Even though XML isn't context-free as such, it is locally context-free, in the sense that the set of permissible expressions within a small region in a particular XML document can be described by a context-free grammar.

Adapted from the article "The Concept of Grammar Adaptability" by John N. Shutt (https://web.cs.wpi.edu/~jshutt/adapt/concept.html)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.