0

这就是我现在所拥有的

<main>
<col name="name1">test1</col>
<col name="name2">test2</col>
<col name="name3">test3</col>
<col name="name4">test4</col>
<col name="num1">true</col>
</main>

我想要上面的xsd,我试过了

<xs:element name="main" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="col" minOccurs="0" maxOccurs="unbounded" >
            <xs:attribute name="name1" type="xs:string" />
            <xs:attribute name="name2" type="xs:string" />
            <xs:attribute name="name2" type="xs:string" />
            <xs:attribute name="num1" type="xs:boolean" />
        </xs:element>
    </xs:sequence>
</xs:complexType>
</xs:element>

这向我显示了一个错误。如何纠正?

4

1 回答 1

0
<?xml version="1.0" encoding="utf-8"?>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:element name="main">
    <xs:complexType>
      <xs:sequence>
        <xs:element maxOccurs="unbounded" name="col">
          <xs:complexType>
            <xs:simpleContent>
              <xs:extension base="xs:string">
                <xs:attribute name="name" type="xs:string" use="required" />
              </xs:extension>
            </xs:simpleContent>
          </xs:complexType>
        </xs:element>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>
于 2013-01-09T05:07:37.010 回答