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

Re: infinite loop

From: Jeni Tennison <jeni@jenitennison.com>
Date: Fri, 10 Jan 2003 12:27:50 +0000
Message-ID: <19211380223.20030110122750@jenitennison.com>
To: "Allan Jones" <allan.jones@hyfinity.com>
CC: xmlschema-dev@w3.org

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

---
Jeni Tennison
http://www.jenitennison.com/
Received on Friday, 10 January 2003 07:28:01 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:14:35 GMT