OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help



   Re: [xml-dev] XSD question

[ Lists Home | Date Index | Thread Index ]

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.



Jeni Tennison

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


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS