Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » XSD » Branching Schema(Restricting Elements based on the state of other Elements/Attributes)
Branching Schema [message #783493] Wed, 25 January 2012 20:32
Jesse F is currently offline Jesse FFriend
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.
Previous Topic:choice between groups in xsd
Next Topic:xml.ecore
Goto Forum:
  


Current Time: Fri Apr 19 12:27:44 GMT 2024

Powered by FUDForum. Page generated in 0.08157 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top