Q

How can I handle this situation in an XSD schema?

My question is regarding XSD. I have XML where the root can contain a single element from a list of possible elements....

etc. I have had no problem creating XSD schema to handle this (using xsd:choice).My problem is that for the child element <> objectA cenario, I need two attributes for the root element. How can I handle this situation in an XSD schema? XSD does not have XSL capabilities such as xsl:if. Declare an element type objectA and declare its two attributes. When the parser encounters and objectA it will look for the attributes. One way to think of it is that the XSD parser is executing the "if" logic behind the scenes rather than you specifying it in the schema.  

This was last published in April 2003

Dig Deeper on XML and XML schema

PRO+

Content

Find more PRO+ content and other member only offers, here.

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Start the conversation

Send me notifications when other members comment.

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Please create a username to comment.

-ADS BY GOOGLE

SearchSoftwareQuality

SearchCloudApplications

SearchAWS

TheServerSide

SearchWinDevelopment

Close