[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Representing interdependence of elements within a schema or dtd


define interdependence
Hi Everyone,
I am new to this list so if I am in the wrong place please point me
elsewhere.

I have a question relating to dependencies between parts of an xml document.
So far in the XML books that I have read there is no reference to this
problem that I can find.

I am constructing and transmitting an XML document that gradually gathers
more elements as it travels about. The elements that it gathers are
contributions to the document from different predefined sources - i.e. there
is a pre-established structure to the document, but initially the structure
is just a framework that gets filled in as the document moves from person to
person. My problem is that the elements are interdependent - some elements
cannot be present if others are absent, and vice versa. For example, suppose
the basic structure was:
<doc>
	<part1>
		<body>....</body>
		<part1_annex>....</part1_annex>
	</part1>
	<part2>
		<body>....</body>
		<part2_annex1>....</part2_annex1>
		<part2_annex2>....</part2_annex2>
	</part2>
	<binder>....</binder>
<doc>
Initially both <part1> and <part2> are optional. The <_annex>es of <part1>
and <part2> cannot be present without the corresponding <body>s. And the
<binder> element can only be present if both <part1> or <part2> are present
and complete.

The only way I can find of representing this arrangement in a schema or dtd
is to have a different schema or dtd at each state of the document. In the
first "Incomplete" state, <part1/part2> are both optional, and within each
the <body> is mandatory and the <_annex>es are optional. The <binder> part
is absent altogether.

Once I have <part1> and <part2> completed, i.e. all bodies and annexes
present, the document moves to the "ready to bind" state, in which all the
<part1/part2> <body>s and <_annex>es become mandatory and the <binder> part
appears as an optional element.

Finally, when the <binder> element is added the whole document is complete
and moves to the "Bound" state in which all elements are mandatory.

Using a separate schema for each of the three states turns out to be a very
clumsy way of handling things. In the example above it is just about
manageable but where there are many levels and elements/sub elements it is
almost impossible to represent. How can I easily define the interdependence
between all these parts within a single schema or dtd, so that the document
can move through different states, each state having different rules about
the presence or absence of the different parts?

John



PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.