XSD for the following XML

Posted on 2011-10-18
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

    Question edited for clarity
    LVL 60

    Accepted Solution

    > 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 (
    - 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 (

    Featured Post

    Better Security Awareness With Threat Intelligence

    See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

    Join & Write a Comment

    Suggested Solutions

    How to remove superseded packages in windows w60 or w61 installation media (.wim) or online system to prevent unnecessary space. w60 means Windows Vista or Windows Server 2008. w61 means Windows 7 or Windows Server 2008 R2. There are various …
    Many times as a report developer I've been asked to display normalized data such as three rows with values Jack, Joe, and Bob as a single comma-separated string such as 'Jack, Joe, Bob', and vice versa.  Here's how to do it. 
    The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
    The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

    728 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

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now