W3C home > Mailing lists > Public > xmlschema-dev@w3.org > April 2002

Re: reference to root element

From: Jeni Tennison <jeni@jenitennison.com>
Date: Mon, 15 Apr 2002 11:31:08 +0100
Message-ID: <1111133846064.20020415113108@jenitennison.com>
To: "Rosa Macias" <rmacias@ll.iac.es>
CC: xmlschema-dev@w3.org
Hi Rosa,

> I have this schema where the "Chapter" element inside "Book" refers
> back to "Book". The schema seems to be correct but, how can I have
> an instance where the "Book" element of "Chapter" always refers back
> to its root element itself?

I'm a bit confused about what you're after. The schema that you posted
with your message isn't valid (the element declaration for Chapter
contains a element declaration directly -- it should be nested within
a model group within a complex type). Also, as defined it looked as
though you had a Book element that must contain a Chapter element that
must contain a Book element that must contain a Chapter element and so
on, which means that it would be impossible to create an instance.

What do you mean by "refers back to"? Do you mean that the Book
element has an ID and the Chapter element must have an attribute or
element that has the same value as that ID? If so, then you can do
this with a key/keyref pair -- if you confirm that that's what you
want to do, we can show you how to do that.



Jeni Tennison
Received on Monday, 15 April 2002 06:40:01 UTC

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