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

Re: XSD question


element is not declared
Hi Bob,

> Let's say I declare element alpha to have a sequence of one or more
> xs:any children with processContents="lax". Then I declare element
> beta to have a specific content model. I can put beta elements and
> anything else as children of alpha, and if any of those beta
> elements violate the declared content model, a schema-validating
> parser will flag it as an error.

Right: if you validate an element against an element declaration then
the element must be valid against that element declaration or you'll
get an error. Part of the validation process is checking that the
content of the element complies with the content defined for the type
of the element.

> However, if a beta element that violates the declared content model
> is a *grandchild* of alpha instead of being a direct child, the
> schema-validating parser isn't supposed to flag it.

It depends entirely on whether or not there's a declaration for the
parent of the <beta> element, and on the type of that element if there
is such a declaration.

If the parent of the <beta> element is declared in the schema, then
it will be validated against that declaration. Whether the <beta>
element is validated, and what declaration it's validated against,
then depends on the type associated with the parent of the <beta>
element. The <beta> element might be validated against a global
element declaration or a local element declaration, or not validated
at all, depending on the content model of the type of the parent of
the <beta> element.

If the parent of the <beta> element is not declared in the schema,
then the schema validator will validate it against xs:anyType. The
content model of xs:anyType contains a repeating wildcard, specifying
lax validation. So the children of the parent of the <beta> element
will be validated in 'lax' mode, and you will get an error if there's
a top-level element declaration for the <beta> element but the <beta>
element isn't valid against it.

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/


  • References:
    • XSD question
      • From: "DuCharme, Bob (LNG-CHO)" <bob.ducharme@l...>

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.