Что-то в корне не так с этой XML-схемой?

У меня есть только элементарное понимание схемы XML. По сути, это мое первое серьезное общение с ними, и у меня возникли некоторые проблемы. Я читал о XSD в Google, и все работает с этим файлом.

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">

  <xs:element name="credits">
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="property" maxOccurs="16" minOccurs="13" />
      </xs:sequence>
    </xs:complexType>
  </xs:element>

  <xs:element name="property" type="xs:string">    
    <xs:complexType>        
        <xs:sequence>            
            <xs:element ref="item" minOccurs="1" maxOccurs="unbounded" />
        </xs:sequence>
        <xs:attribute ref="name" use="required"/>
    </xs:complexType>

  </xs:element>

  <xs:element name="item" type="xs:string"/>

  <xs:attribute name="name" type="xs:string">
      <xs:simpleType>
        <xs:restriction base="xs:string">
          <xs:enumeration value="example1"/>
          <xs:enumeration value="example2"/>
          <xs:enumeration value="example3"/>
          <xs:enumeration value="example4"/>
          <xs:enumeration value="example5"/>
          <xs:enumeration value="example6"/>
          <xs:enumeration value="example7"/>
          <xs:enumeration value="example8"/>
          <xs:enumeration value="example9"/>
          <xs:enumeration value="example10"/>
          <xs:enumeration value="example11"/>
          <xs:enumeration value="example12"/>
          <xs:enumeration value="example13"/>
          <xs:enumeration value="example14"/>
          <xs:enumeration value="example15"/>
          <xs:enumeration value="example16"/>
        </xs:restriction>
      </xs:simpleType>
  </xs:attribute>

</xs:schema>

Вот как я его загружаю:

SchemaFactory schemaFactory = SchemaFactory.newInstance( XMLConstants.W3C_XML_SCHEMA_NS_URI );
Schema schemaXSD = schemaFactory.newSchema( new File ( "test.xsd" ) );

Я ' src-element.3: Элемент "свойство" имеет как атрибут типа, так и ребенок «анонимного типа». Только один из это разрешено для элемента.

Спасибо за помощь, ТАК! Также приветствуются любые общие советы по чтению / использованию схем, созданных другими! : D

6
задан blueberryfields 3 March 2011 в 02:56
поделиться