xsd - XML Schema 1.1 Attribute Grouping Constraints -


in using xml schema 1.1, i'd define attribute group occurs entirely together, i.e. attributes in attributegroup either present or not-present. in following example, i'd <anelement> have both attributes (attr_one , attr_two) present or neither attribute present, never single attribute present.

<attributegroup name="attrgroup">   <attribute name="attr_one" />   <attribute name="attr_one" /> </attributegroup>  <element name="anelement">   <complextype>     <attributegroup ref="attrgroup" />   </complextype> </element> 

as understand it, xml schema 1.0 cannot specify these attribute relationships (correct?). best way specify them in xsd 1.1? figure can use assert specify relationship, following:

<element name="anelement">   <complextype>     <attributegroup ref="attrgroup" />     <assert test="(@attr_one , @attr_two) or not(@attr_one or @attr_two)" />   </complextype> </element> 

but hoping there added 1.1 allow me specify relationship using existing language, e.g. use attribute on attributegroups. best way specify relationship in xml schema 1.1?

assertions way this. simpler formulation is

test="exists(@attr_one) = exists(@attr_two)" 

or do

test="count(@attr_one|@attr_two) != 1" 

Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -