[Home] [By Thread] [By Date] [Recent Entries]

  • From: "Costello, Roger L." <costello@m...>
  • To: "xml-dev@l..." <xml-dev@l...>
  • Date: Mon, 10 Oct 2011 12:03:52 +0000

Hi Folks,

Chris Burdess wrote:

> This is a representation of a cyclic graph in some vocabulary 
> not defined within the scope of XML, but the XML document 
> itself is not a cyclic graph, is it. My XML parser can parse the 
> XML just fine without having to worry about falling into an 
> infinite loop.

Below is an XML document. It conforms to the XML specification. It is well formed and valid. It's ID/IDREF values form a loop (cycle). The loop is formed using only stuff specified in the XML specification. 

So, why can't XML documents have loops (cycles)?  Why doesn't an XML parser have to worry about falling into an infinite loop? 

 <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Graph [
<!ELEMENT Graph (Node)+>
<!ELEMENT Node EMPTY>
<!ATTLIST Node
             id ID #REQUIRED
             idref IDREF #REQUIRED>
]>
<Graph>
    <Node id="_1" idref="_2" />
    <Node id="_2" idref="_1" />
</Graph>

/Roger


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member