Xml schema, how to make sure one element exists with a specific attribute value

Posted by pexxxy on Stack Overflow See other posts from Stack Overflow or by pexxxy
Published on 2013-10-23T13:59:42Z Indexed on 2013/10/23 15:54 UTC
Read the original article Hit count: 113

Filed under:
|

How do I enforce the existing of an element with a specific attribute value in the XML?

For example:

<events>
  <event type="system" desc="this is a system event"/>
  <event type="bla1" desc="this is bla1 event"/>
  <event type="bla2" desc="this is bla2 event"/>
</events>

I need a rule to make sure the event element with type attribute = 'system' exists (once). All other event elements are optional;

© Stack Overflow or respective owner

Related posts about Xml

Related posts about xsd