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 Tennison
Received on Friday, 10 January 2003 07:28:01 UTC

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