XML Tutorial/XML Schema/IDREF

Материал из Web эксперт
Версия от 11:26, 26 мая 2010; Admin (обсуждение | вклад) (1 версия)
(разн.) ← Предыдущая | Текущая версия (разн.) | Следующая → (разн.)
Перейти к: навигация, поиск

The IDREF data type is derived from the NCName type.

   <source lang="xml">

IDREF refers to an element or attribute of type ID in the same instance document. The value for IDREF must match a value for ID in the same instance document.


<xsd:element name="bank">

 <xsd:complexType>
  <xsd:complexContent>
   <xsd:extension base="xsd:anyType">
   <xsd:attribute name="branch" type="xsd:ID"/>
   </xsd:extension>
  </xsd:complexContent>
 </xsd:complexType>

</xsd:element> <xsd:element name="city">

 <xsd:complexType>
  <xsd:complexContent>
   <xsd:extension base="xsd:anyType">
   <xsd:attribute name="branch_division"
    type="xsd:IDREF"/>
   </xsd:extension>
  </xsd:complexContent>
 </xsd:complexType>

</xsd:element>

<bank branch="412x">Northern</bank> <city branch_division="412x">Chicago</city></source>