W3C home > Mailing lists > Public > xmlschema-dev@w3.org > January 2003

RE: infinite loop

From: Allan Jones <allan.jones@hyfinity.com>
Date: Fri, 10 Jan 2003 16:13:08 -0000
To: "xml schema" <xmlschema-dev@w3.org>
Message-ID: <LAENININNOKBCAKCLEFIGENMCBAA.allan.jones@hyfinity.com>

Hi Jeni,

thanks for your suggestion, but the problem with that technique is that you
can declare sub-elements with the same name, which would effectively mean
that you'd declare something like:


as an infinite loop when the schema would merely specify it as a nested
element.  Using the complex type definitions (as they're usually the reason
that an infinite loop occurs) leads to similar problems, because it's
possible that the same complex type could be used in different parts of the
document so the fact that you've 'hit' it twice doesn't mean that it's an
infinite loop.

hmm.  I guess that this problem is trickier than I originally thought, then!

thanks for your help,


|-----Original Message-----
|From: Jeni Tennison [mailto:jeni@jenitennison.com]
|Sent: 10 January 2003 12:28
|To: Allan Jones
|Cc: xmlschema-dev@w3.org
|Subject: Re: infinite loop
|Hi Allan,
|> While we're on the subject of infinite loops, does anyone have any
|> idea how to detect an infinite loop in a schema programatically?
|> Particularly, i'd like to use xslt to detect and infinite loop in an
|> xsd schema. I've been wondering about this for a while, but haven't
|> been able to find anything out by hunting on the web or reading up
|> on the subject. So far, the only idea i've had was to recurse
|> element by element as if creating an instance document from the
|> schema (similar to your chapter in the professional xml schemas
|> book, Jeni) and waiting to see if it crashes the processor or not.
|> Obviously, I'd prefer not to have to resort to that!
|Perhaps you could keep track of which element declarations you've gone
|through as you recurse (using generate-id() I guess) and then whenever
|you come to an element declaration check to see if it's in that list.
|If it is, and the element is required (something that is again a
|little fiddly to work out -- you'll have to pass that as a parameter
|as well) then the schema involves an infinite loop.
|Make sense?
|Jeni Tennison
Received on Friday, 10 January 2003 11:14:43 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 14:55:59 UTC