2010-11-23 3 views

答えて

5

次のように動作するはずです。私はまた、スキーマに関するW3 Schoolsセクションを提案します。

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> 
    <xs:element name="rootElement" type="RootElementType"/> 

    <xs:complexType name="RootElementType"> 
    <xs:sequence> 
     <xs:element name="child1" type="xs:string" minOccurs="1" maxOccurs="unbounded"/> 
     <xs:element name="child2" type="xs:string" minOccurs="0" maxOccurs="1"/> 
    </xs:sequence> 
    <xs:attribute name="user" type="xs:string" use="required"/> 
    </xs:complexType> 
</xs:schema> 

これは、このようなXML構造のスキーマのようになります。

<rootElement user="Bob"> 
    <child1>Hello</child1> 
    <child1>World</child1> 
    <child2>Optional</child2> 
</rootElement> 
関連する問題