XML 파일이 있습니다. xsd 스키마 파일을 생성하려고합니다. 내 xml 파일 :XML 스키마 자식이없는 요소로 문자열을 작성하는 방법
<?xml version="1.0" encoding="UTF-8"?>
<recipe xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="sample.xsd" id="62378">
<title>Beans On Toast</title>
<ingredients>
<item quantity="1" unit="slice">bread</item>
<item quantity="1" unit="can">bakedbeans</item>
</ingredients>
</recipe>
내 스키마 파일은 다음과 같습니다 확인하는 동안
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="recipe" type="recipeType"/>
<xs:complexType name="recipeType">
<xs:sequence>
<xs:element name="title" type="xs:string"/>
<xs:element name="ingredients" type="ingredientsType"/>
</xs:sequence>
<xs:attribute name="id" type="xs:integer"/>
</xs:complexType>
<xs:complexType name="ingredientsType">
<xs:sequence>
<xs:element name="item" type="itemType"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="itemType">
<xs:attribute name="quantity" type="xs:integer"/>
<xs:attribute name="unit" type="xs:string"/>
</xs:complexType>
</xs:schema>
나는 오류를 얻고있다. 나는 그 이유를 안다. 왜냐하면 속성에 complexType ("itemType")을 써야하기 때문에 element item type = xs : string을 정의하지 못했습니다. 누구든지이 문제를 해결할 수 있습니까?
감사합니다. 또한 여기에 설명되어 있습니다 : http://www.w3schools.com/schema/schema_complex_text.asp – Nusrat
다른 설명을 해 주실 수 있습니까? 시퀀스 (제목, 재료)가 필요하지만 왜 다음 블록에 시퀀스를 써야합니까? 그렇지 않으면 오류가 발생합니다. – Nusrat