Subject:XMLSchema - optional attributeGroup definition Author:lucrecia chiartano Date:20 Jan 2005 06:53 AM
Hello,
Can anyone help me to find a way to reference a group of attributes as optional?
Here I describe my problem,
thanks a lot,
Lucrecia Chiartano
-----------------------
I must define within a schema a rule that allows an xml leaf-node to carry with it two attributes.
Both of them may be present or not, but if only one exists it must be a precise one (attribute1 within next examples).
If 'attribute1' and 'attribute2' where just tags instead of attributes I could bound the rule defining an optional group with a required tag ('attribute1') and an optional one ('attribute2').
But they must be attributes, and I found that they can be grouped only using the xsd:attributeGroup tag that admits not a 'minOccurs' or a 'use' attribute (and then cannot be referenced as optional).
I have to define a attribute group for 2 mutually inclusive data elements. In the below example if TO_DT is present FROM_DT has to be present and TO_DT is not present then FROM_DT is not present.
I thought of creating these as mandatory attributes and define attributegroup as optional but its not working: