1
이 컨텐츠 모델에서 사용할 수 없습니다.요소
나 자신이 만든 스키마로 XML 문서의 유효성을 검사하려고하는데이 오류가 계속 발생합니다. 유효성 검사가 40 줄 12 열에서 중단되었습니다. 'article'은 콘텐츠 모델에 대해 허용되지 않습니다. '(book * | article * | mastersthesis * | inproceedings *) '
내 xsd 파일의 형식이 올바르므로 내 xml 파일도 마찬가지입니다. 40 번째 줄은 내 XML 문서의 끝 부분입니다 (</bibEntry>
).
이 내 XSD 파일의 일부입니다
<xs:element name="bibEntry" type="entryType"/>
<xs:complexType name="entryType">
<xs:choice>
<xs:element ref="book" minOccurs="0" maxOccurs="unbounded"/>
<xs:element ref="article" minOccurs="0" maxOccurs="unbounded"/>
<xs:element ref="mastersthesis" minOccurs="0" maxOccurs="unbounded"/>
<xs:element ref="inproceedings" minOccurs="0" maxOccurs="unbounded"/>
</xs:choice>
</xs:complexType>
<xs:element name="author" type="xs:string"/>
<xs:element name="title" type="xs:string"/>
<xs:element name="publisher" type="xs:string"/>
<xs:element name="year" type="xs:string"/>
<xs:element name="edition" type="xs:string"/>
<xs:element name="ISBN" type="xs:string"/>
<xs:element name="journal" type="xs:string"/>
<xs:element name="volume" type="xs:positiveInteger"/>
<xs:element name="number" type="xs:positiveInteger"/>
<xs:element name="pages" type="xs:string"/>
<xs:element name="school" type="xs:string"/>
<xs:element name="booktitle" type="xs:string"/>
<xs:element name="book" type="bookType"/>
<xs:complexType name="bookType">
<xs:sequence>
<xs:element ref="author"/>
<xs:element ref="title"/>
<xs:element ref="publisher"/>
<xs:element ref="year"/>
<xs:element ref="edition"/>
<xs:element ref="ISBN"/>
</xs:sequence>
<xs:attribute name="id" type="xs:NMTOKEN"/>
</xs:complexType>
<xs:element name="article" type="articleType"/>
<xs:complexType name="articleType" mixed="true">
<xs:sequence>
<xs:element ref="author"/>
<xs:element ref="title"/>
<xs:element ref="year"/>
<xs:element ref="journal"/>
<xs:element ref="volume"/>
<xs:element ref="number"/>
<xs:element ref="pages"/>
</xs:sequence>
<xs:attribute name="id" type="xs:NMTOKEN"/>
</xs:complexType>
그리고 이것은 내 XML입니다 :
<bibEntry xmlns="http://www.w3schools.com"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.w3schools.com bibEntry.xsd">
<book>
<author>José Saramago</author>
<title>Ensaio Sobre a Cegueira</title>
<publisher>Caminho</publisher>
<year>1995</year>
<edition>1ª</edition>
<ISBN>9722110217</ISBN>
</book>
<article>
<author>Regev, Oded</author>
<title>On Lattices, learning with errors, random linear codes and cryptography</title>
<year>2009</year>
<journal>Journal of the ACM</journal>
<volume>56</volume>
<number>13</number>
<pages>34</pages>
</article>
<mastersthesis>
<author>Menno den Hollander</author>
<title>Automatic Unit Test Generation</title>
<school>Delft University of Technology</school>
<year>2010</year>
</mastersthesis>
<inproceedings>
<author>Thomas Tilley</author>
<title>Tool Support for FCA</title>
<booktitle>ICFCA</booktitle>
<year>2004</year>
<pages>104-111</pages>
</inproceedings>
</bibEntry>
당신은 볼 수 내가 무슨 일을하고 있어요? 당신이 너무 빨리 당신의 요소 태그를 닫처럼
을 시도, 그래서 우리가 XML을 볼 필요가 있다고 생각합니다. – David
스키마가 형식이 올바르지 만 여전히 유효하지 않습니다. 당신은 'mastersthesis'와 'inproceedings'에 대한 엘리먼트 선언을 놓치고 있습니다. – David