conditional enumeration in XSD

Discussion in 'XML' started by kanpeter, Oct 26, 2010.

  1. kanpeter

    kanpeter Guest

    How can i write in XSD such that it can validate the following XML:

    If company element has text value = A, attributes of Price can take
    USD and AUD only
    If company element has text value = B, attributes of Price can take
    USD and RMB only

    <Company>A</Company>
    <Prices>
    <Price Currency="USD">12</Price>
    <Price Currency="AUD">12</Price>
    </Prices>

    <Company>B</Company>
    <Prices>
    <Price Currency="USD">12</Price>
    <Price Currency="RMB">12</Price>
    </Prices>
    kanpeter, Oct 26, 2010
    #1
    1. Advertising

  2. I don't believe XML Schemas can express that constraint. Implement it in
    application code.

    --
    Joe Kesselman,
    http://www.love-song-productions.com/people/keshlam/index.html

    {} ASCII Ribbon Campaign | "may'ron DaroQbe'chugh vaj bIrIQbej" --
    /\ Stamp out HTML mail! | "Put down the squeezebox & nobody gets hurt."
    Joe Kesselman, Oct 27, 2010
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Alec S.
    Replies:
    10
    Views:
    10,113
    Alec S.
    Apr 16, 2005
  2. Fender Mussel
    Replies:
    0
    Views:
    549
    Fender Mussel
    Sep 14, 2004
  3. JamesSmithMz

    XSD enumeration based on elements

    JamesSmithMz, Nov 30, 2005, in forum: XML
    Replies:
    0
    Views:
    409
    JamesSmithMz
    Nov 30, 2005
  4. news.emn.fr

    xsd enumeration and pattern

    news.emn.fr, May 31, 2006, in forum: XML
    Replies:
    0
    Views:
    478
    news.emn.fr
    May 31, 2006
  5. puvit82
    Replies:
    4
    Views:
    757
    puvit82
    Feb 1, 2008
Loading...

Share This Page