Specify the value for an element that references several att
Posted: Tue Sep 13, 2005 10:30 pm
Hello to everyone. Thanks for reading this.
Im working with XML Schema to specify graphs. In the graph we have nodes, and each node can have several attribute (with a key and value), but I want to force the user to always add one attribute with a specific key and three posible values… ¿Is this possible in XML SCHEMA without defining a new type or element…
This is the XML SCHEMA for the attribute
<!-- Global Attributes -->
<xsd:attributeGroup name="global-atts">
<xsd:attribute name="id" type="string.type" />
<xsd:attribute name="name" type="string.type" />
<xsd:attribute name="label" type="string.type" />
</xsd:attributeGroup>
<!-- Value Attribute -->
<xsd:attributeGroup name="attribute-value">
<xsd:attribute name="value" type="string.type" />
</xsd:attributeGroup>
<!-- Type Attribute -->
<xsd:attributeGroup name="attribute-type">
<xsd:attribute name="type" type="object.type" />
</xsd:attributeGroup>
<!-- Att Element -->
<xsd:element name="att">
<xsd:complexType mixed="true">
<xsd:sequence>
<xsd:element ref="att" minOccurs="0" maxOccurs="unbounded" />
</xsd:sequence>
<xsd:attributeGroup ref="global-atts" />
<xsd:attributeGroup ref="attribute-value" />
<xsd:attributeGroup ref="attribute-type" />
</xsd:complexType>
</xsd:element>
And this for the node…
<!-- Simple Node (Structural Node) -->
<xsd:complexType name="simpleNode">
<xsd:sequence>
<xsd:element ref="att" minOccurs="0" maxOccurs="unbounded" />
</xsd:sequence>
<xsd:attributeGroup ref="global-atts" />
</xsd:complexType>
And i want all node to be like this…
<node ...>
<att name=â€Status†value=â€â€> THIS ALWAYS HAVE TO BE WITH THAT NAME.
<att…
<att…
</node>
Thanxs for all
Im working with XML Schema to specify graphs. In the graph we have nodes, and each node can have several attribute (with a key and value), but I want to force the user to always add one attribute with a specific key and three posible values… ¿Is this possible in XML SCHEMA without defining a new type or element…
This is the XML SCHEMA for the attribute
<!-- Global Attributes -->
<xsd:attributeGroup name="global-atts">
<xsd:attribute name="id" type="string.type" />
<xsd:attribute name="name" type="string.type" />
<xsd:attribute name="label" type="string.type" />
</xsd:attributeGroup>
<!-- Value Attribute -->
<xsd:attributeGroup name="attribute-value">
<xsd:attribute name="value" type="string.type" />
</xsd:attributeGroup>
<!-- Type Attribute -->
<xsd:attributeGroup name="attribute-type">
<xsd:attribute name="type" type="object.type" />
</xsd:attributeGroup>
<!-- Att Element -->
<xsd:element name="att">
<xsd:complexType mixed="true">
<xsd:sequence>
<xsd:element ref="att" minOccurs="0" maxOccurs="unbounded" />
</xsd:sequence>
<xsd:attributeGroup ref="global-atts" />
<xsd:attributeGroup ref="attribute-value" />
<xsd:attributeGroup ref="attribute-type" />
</xsd:complexType>
</xsd:element>
And this for the node…
<!-- Simple Node (Structural Node) -->
<xsd:complexType name="simpleNode">
<xsd:sequence>
<xsd:element ref="att" minOccurs="0" maxOccurs="unbounded" />
</xsd:sequence>
<xsd:attributeGroup ref="global-atts" />
</xsd:complexType>
And i want all node to be like this…
<node ...>
<att name=â€Status†value=â€â€> THIS ALWAYS HAVE TO BE WITH THAT NAME.
<att…
<att…
</node>
Thanxs for all