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
Post a Comment