XML.orgXML.org
FOCUS AREAS |XML-DEV |XML.org DAILY NEWSLINK |REGISTRY |RESOURCES |ABOUT
OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]
Can XML documents have loops (cycles)?

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]


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 1993-2007 XML.org. This site is hosted by OASIS