XSD attribute exclusion expression

  • Thread starter Edouard Mercier
  • Start date
E

Edouard Mercier

Hi to all;

I have a very basic question: is is possible in XML Schema to express
that two attributes on an XML element are exclusive, and if yes, what
is the most appropriate idiomatic syntax for that ?

I am grateful for your help. Regards,

Edouard
 
B

Bob Foster

If you mean, can an XML Schema allow one attribute or the other but not
both, the answer is no. There is no way to specify a choice of attributes.

RELAX NG can do this, or a Schematron augmentation of an XML Schema.

Bob Foster
http://www.xmlbuddy.com/
 
E

Edouard Mercier

That's actually what I meant and thank you for the answer: "there is
no way to specify a choice of attributes".

Could you please provide a good URL concerning the main differences
between XSD and Relax NG ?

Regards,

Edouard
 
B

Bob Foster

Edouard Mercier said:
Could you please provide a good URL concerning the main differences
between XSD and Relax NG ?

I can't think of one off the top of my head. The main positive differences
are:

RELAX NG:

Ambiguous content models allowed
Choices may depend on attributes and values, not just elements
General "define" mechanism
Datatype libraries (no special "blessed" types)
(XSD simple types supported by library)
Formal definition
Very easy to learn
Conformant implementations (Jing and MSV)
Both XML and compact syntax
Oasis/ISO draft standard
"The fastest way to write an XSD schema is to write a RELAX NG compact
syntax schema and use Trang to convert it to XSD."

XSD:

unique, key, keyref
Substitution groups
Named type derivation
W3 recommendation
Used in XQuery/XSLT 2.0/XPath 2.0
Used in WSDL

If a plus appears in one list, it is a minus in the other. Both have a
number of free tools available. Trang is an especially interesting tool, as
it converts between various schema formats with good fidelity.

Bob Foster
http://www.xmlbuddy.com/
 
E

Edouard Mercier

Thank you very much, Bob, for your additional information: I think
that I should take a throrough look at Relax NG !

Regards,

Edouard
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top