Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: Defining recursive elements?

From: noah_mendelsohn@--.---.---
To: "Andrew Welch" <andrew.j.welch@-----.--->
Date: 5/17/2007 12:12:00 PM
Andrew Welch writes:

> With global definitions some documents will be valid that you might
> not want, for example an XML document of just <header/> would validate
> using that schema.

That's a bit of an oversimplification.  The schema recommendation says the =

following about the ways in which a schema may be used to validate an 
instance document [1]:

-------------
With a schema which satisfies the conditions expressed in Errors in Schema =

Construction and Structure (=A75.1) above, the schema-validity of an elemen=
t 
information item can be assessed. Three primary approaches to this are 
possible: 
1 The user or application identifies a complex type definition from among 
the {type definitions} of the schema, and appeals to Schema-Validity 
Assessment (Element) (=A73.3.4) (clause 1.2);
2 The user or application identifies a element declaration from among the 
{element declarations} of the schema, checks that its {name} and {target 
namespace} match the [local name] and [namespace name] of the item, and 
appeals to Schema-Validity Assessment (Element) (=A73.3.4) (clause 1.1);
3 The processor starts from Schema-Validity Assessment (Element) (=A73.3.4)=
 
with no stipulated declaration or definition, and either =B7strict=B7 or =
=B7lax=B7 
assessment ensues, depending on whether or not the element information and =

the schema determine either an element declaration (by name) or a type 
definition (via xsi:type) or not.
-------------

If you choose to use a processor that implements the third option, then 
your statement is correct.  If you want to ensure that the root element is =

"component", then you should get a processor that implements option #2, 
and designate the declaration for element "component" as the one from 
which validation is to start.

By the way, among the reasons that option 3 is provided, is to facilitate 
the creation of incremental validators.  Let's say you have an editor 
that's helping you enter these documents.  Even though you want the 
document as a whole to be rooted at <part>, it's possible that you are 
editing a "header".  Rule 3 allows such an editor to revalidated just the 
<header> element as it is changed, even though it is not the root of the 
document.

Noah

[1] http://www.w3.org/TR/2004/PER-xmlschema-1-20040318/#validation=5Foutcome

--------------------------------------
Noah Mendelsohn 
IBM Corporation
One Rogers Street
Cambridge, MA 02142
1-617-693-4036
--------------------------------------





From noah_mendelsohn@u... Thu May 17 21:04:02 2007
Received: from aji.w3.org ([133.27.228.225])
	by frink.w3.o


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent