W3C home > Mailing lists > Public > xmlschema-dev@w3.org > October 2009

XML schema

From: btakacs <takacs.bence@gmail.com>
Date: Sun, 18 Oct 2009 03:31:44 -0700 (PDT)
Message-ID: <25945562.post@talk.nabble.com>
To: xmlschema-dev@w3.org
Hi

I have an xml schema which restricts the Indexes/Tag/@attribute_id values to
the ones are defined in the parent element's Attributes/Attribute/@id. Is
there a way to extend this and enable one (or more) different static values
for example "id"?
There are more Indexes/Tag and Attributes/Attribute tags and i would like to
use this restriction only for thoose that has the same parent.

Here is my current configuration:

....
<xs:element name="Attributes">
  <xs:complexType>
    <xs:sequence>
      <xs:element name="Attribute" maxOccurs="unbounded">
	<xs:complexType>
	  <xs:complexContent>
	    <xs:extension base="Attribute_Type">
	      <xs:attribute name="typedef_id" type="xs:string" use="required"/>
             </xs:extension>
	  </xs:complexContent>
	</xs:complexType>
      </xs:element>
    </xs:sequence>
  </xs:complexType>
</xs:element>
....
<xs:element name="Indexes" minOccurs="0">
  <xs:complexType>
    <xs:sequence>
      <xs:element name="Tag" maxOccurs="unbounded">
	<xs:complexType>
          <xs:attribute name="attribute_id" use="required">
		<xs:simpleType>
		  <xs:restriction base="xs:string">
		    <xs:pattern value="[a-z0-9]([a-z0-9.]|(_[a-z]))*"/>
		       </xs:restriction>
		    </xs:simpleType>
		  </xs:attribute>
	       </xs:complexType>
	     </xs:element>
	  </xs:sequence>
   </xs:complexType>
</xs:element>
....
....
<xs:key name="ATTRIBUTE">
    <xs:selector xpath="Attributes/Attribute"/>
    <xs:field xpath="@id"/>
</xs:key>
<xs:keyref name="X001" refer="ATTRIBUTE">
   <xs:selector xpath="Indexes/Tag"/>
   <xs:field xpath="@attribute_id"/>
</xs:keyref>
....


Thanks:
   Bence
-- 
View this message in context: http://www.nabble.com/XML-schema-tp25945562p25945562.html
Sent from the w3.org - xmlschema-dev mailing list archive at Nabble.com.
Received on Sunday, 18 October 2009 21:30:47 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:15:15 GMT