XML/XML Schema/minOccurs — различия между версиями

Материал из Web эксперт
Перейти к: навигация, поиск
 
м (1 версия)
 
(нет различий)

Текущая версия на 11:26, 26 мая 2010

minOccurs and maxOccurs

   <source lang="xml">

<?xml version="1.0"?> <name xmlns="http://www.wbex.ru/name"

 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xsi:schemaLocation="http://www.wbex.ru/name Schema.xsd"
 title="Mr.">
 <first>first</first>
 <middle>middle</middle>
 <last>last</last>

</name>

File: Schema.xsd <?xml version="1.0"?> <schema xmlns="http://www.w3.org/2001/XMLSchema"

 xmlns:target="http://www.wbex.ru/name"
 targetNamespace="http://www.wbex.ru/name"
 elementFormDefault="qualified">
 <group name="NameGroup">
   <sequence>
     <element name="first" type="string" minOccurs="1"
       maxOccurs="unbounded" />
     <element name="middle" type="string" minOccurs="0"
       maxOccurs="1" />
     <element name="last" type="string" />
   </sequence>
 </group>
 <complexType name="NameType">
   <group ref="target:NameGroup" />
   <attribute name="title" type="string" />
 </complexType>
 <element name="name" type="target:NameType" />

</schema>

</source>