XSD restriction of nesting an element within another element with aspecific attribute value?

P

PeteOlcott

<ElementName AttributeName="Specific Value">
<OtherElementName />
</ElementName>

The idea is to somehow force the restriction that the
<OtherElementName> element can only be nested within the <ElementName>
tag if this tag has the attribute value of "Specific Value" for its
attribute named AttributeName.
 
M

Mukul Gandhi

<ElementName AttributeName="Specific Value">
  <OtherElementName />
</ElementName>

 The idea is to somehow force the restriction that the
<OtherElementName> element can only be nested within the <ElementName>
tag if this tag has the attribute value of "Specific Value" for its
attribute named AttributeName.

This could be difficult with XSD 1.0. But you could do some validation
at an application level.

XSD 1.1 has a facility called 'assertions' which will make this
requirement solved easily (ref, http://www.w3.org/TR/xmlschema11-1/#cAssertions).

But XSD 1.1 is currently in draft. I am hoping we would see XSD 1.1
becoming a recommendation soon, and implemented in products.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,773
Messages
2,569,594
Members
45,119
Latest member
IrmaNorcro
Top