0
안녕 내가처럼 보이는 XML, 나는이에 대한 XSD를 작성해야XSD
<ABC>
<DEF Value="123">
<XYZ>
<RootEle Text="Now" Date="SomeDate"/>
</XYZ>
</DEF>
<DEF AnotherValue="123">
<XYZ>
<AnotherRootEle AnotherText="NowOrNever" AnotherDate="SomeOtherDate"/>
</XYZ>
</DEF>
</ABC>
있습니다. 그러나 내가 쓴 xsd는 위의 xml에 좋지 않습니다.
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
<xsd:element name="ABC">
<xsd:complexType>
<xsd:sequence minOccurs="1" maxOccurs="1">
<xsd:element name="DEF">
<xsd:complexType>
<xsd:sequence minOccurs="1" maxOccurs="unbounded">
<xsd:element name="XYZ">
<xsd:complexType>
<xsd:sequence minOccurs="1" maxOccurs="1">
<xsd:element name="RootEle">
<xsd:complexType>
<xsd:attribute name="Text" use="optional">
<xsd:annotation>
<xsd:documentation>Text</xsd:documentation>
</xsd:annotation>
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:maxLength value="40" />
</xsd:restriction>
</xsd:simpleType>
</xsd:attribute>
<xsd:attribute name="Date" use="optional">
<xsd:annotation>
<xsd:documentation>Date</xsd:documentation>
</xsd:annotation>
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:maxLength value="40" />
</xsd:restriction>
</xsd:simpleType>
</xsd:attribute>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
<xsd:attribute name="Value" use="optional">
<xsd:annotation>
<xsd:documentation>Name of the flow</xsd:documentation>
</xsd:annotation>
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:maxLength value="40" />
</xsd:restriction>
</xsd:simpleType>
</xsd:attribute>
<xsd:attribute name="AnotherValue" use="optional">
<xsd:annotation>
<xsd:documentation>Name of interface</xsd:documentation>
</xsd:annotation>
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:maxLength value="40" />
</xsd:restriction>
</xsd:simpleType>
</xsd:attribute>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
위의 XSD는 아래의 XML뿐만 아니라 하나가 다른 하위 요소와 반복 요소 작동하지 않는 첫번째 즉 게시를위한 좋은 보유하고 있습니다.
<ABC>
<DEF Value="123">
<XYZ>
<RootEle Text="Now" Date="SomeDate"/>
</XYZ>
</DEF>
</ABC>
??
'DEF' 요소에는 몇 가지 수정 사항이 있어야합니다. 지금 가지고있는 것은'DEF'는 많은'XYZ' 자식을 가질 수 있다는 것입니다. – sergioFC