XSD for the following XML

Posted on 2011-10-18
Medium Priority
Last Modified: 2012-05-12
       <Data_tag  Name="Actors" Value="Van"  />
       <Data_tag Name="Category" Value="Drama"  />
       <Data_tag  Name="Actors" Value="Adkins"  />
       <Data_tag  Name="Actors" Value="Higgs"  />          
       <Data_tag Name="Category" Value="Action"  />

Name could be Actors or Category.When "Name=Category", Value could be Drama or Action or Comedy.

There is no set order in which these Data_tags appear. Also, there we need to guarantee there is at least one  data_tag with Name=Actors is present. Also we need guarantee at the most two data_tags wtih Name=Category are present.  

Could we generate a XSD schema ?
Question by:deluxernd

Author Comment

ID: 36990693
Question edited for clarity
LVL 60

Accepted Solution

Geert Bormans earned 2000 total points
ID: 36990803
> east one  data_tag with Name=Actors is present. Also we need guarantee at the most two data_tags wtih Name=Category are present.

This can NOT be modelled in W3C schema 1.0

This is a co-occurence constraint.

You can do this by
- using a schematrone schema (http://www.schematron.com/)
- adding schematron rules (embedded) in your W3C schema. But you need to figure out whether your parser understands schematron embedded rules (a lot of them do)
- use W3C schem 1.1 assertions. But you need a schema parser that accepts 1.1 constructs, very few do yet as 1.1 is not yet a recommendation. Saxon does (www.saxonica.com)

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

So you have coded your own WordPress plugin and now you want to allow users to upload images to a folder in the plugin folder rather than the default media location? Follow along and this article will show you how to do just that!
Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
This video teaches viewers about errors in exception handling.
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
Suggested Courses

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question