Branching Schema [message #783493] |
Wed, 25 January 2012 20:32 |
Jesse F Messages: 1 Registered: January 2012 |
Junior Member |
|
|
I am writing my first XSD, and I am hoping for a little help.
I am adding items to a database that requires a particular XML format. Generally, it looks like this:
<Item>
<Action></Action><!--Add, Update, or Delete-->
<ItemCode></ItemCode>
<ItemID></ItemID>
<Color></Color>
<Size></Size>
<About50OtherElements/>
</Item>
When the text in the Element "Action" is "Add," Nearly all elements are required, but ItemID is not required (as it is assigned by the DB).
If the "Action" is "Update" the "ItemID" is required, and all others are optional.
If the "Action" is "Delete" the "ItemID" is required and no other elements can be used.
Is it possible to write an XSD that validates differently based on a value in the target XML document? Am I better off writing a couple of XSDs and managing the difference with whatever I am going to implement this XSD with?
Can I have two Elements with the same name in the same XSD and indicate how they should be applied somehow?
Please help.
|
|
|
Powered by
FUDForum. Page generated in 0.08157 seconds