xml - XSD restrictions based on open/closed elements -


is there way in schema indicate requirement of attributes determined open or closed nature of element. example have element if open has no requirement attribute 'test', if closed required.

<element name="employee" >     blah! </element> 

ok

<element name="employee" /> 

fail - attribute 'test' required.

i guess using "open" mean element has text node child, , "closed" mean hasn't. you're saying element should either have text node child or attribute not both (?) , not neither.

that's classified co-occurrence constraint, , can't done in xsd 1.0. can done assertions in xsd 1.1

<xs:element name="employee" type="...">   <xs:assert test="string(.) or @name"/> </xs:element> 

xsd 1.1 support available in xerces , saxon.


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 -