1
期待されている皆さんは、私はこのエラーを理解するのに役立ちます:cvc-complex-type.2.4.a:要素 'ab:games'で始まる無効なコンテンツが見つかりました。一つ「{ 『http://teste2.org』:プレイヤーは}」
cvc-complex-type.2.4.a: Invalid content was found starting with element 'ab:games'.
One of '{" http://teste2.org ":player}' is expected.
はなぜプレイヤーは、ゲーム内で期待されていますか?選手は、自分のスキーマに合わせて最大限の目標で期待されます。私は
XSDValidator.java
を使用してい
マイXML:
<?xml version="1.0" encoding="UTF-8" ?>
<ab:nationalTeam xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ab="http://teste2.org"
xsi:schemaLocation="http://teste2.org PT.xsd">
<ab:player id="1">
<ab:number>1</ab:number>
<ab:name>Eduardo</ab:name>
</ab:player>
<ab:player id="11">
<ab:number>11</ab:number>
<ab:name>Eder</ab:name>
</ab:player>
<ab:player id="2">
<ab:number>10</ab:number>
<ab:name>Vieirinha</ab:name>
</ab:player>
<ab:games>
<ab:game>
<ab:adversary>
France
</ab:adversary>
<ab:goals >
<ab:player id="11" minute="109"/>
</ab:goals>
</ab:game>
</ab:games>
</ab:nationalTeam>
マイスキーマ:
XSDは明らかにnationalTeam
が続く、22〜25のプレイヤーを持っていなければならないことを言う
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:ab="http://teste2.org"
targetNamespace="http://teste2.org"
elementFormDefault="qualified"
attributeFormDefault="unqualified">
<xs:complexType name="gameType">
<xs:sequence>
<xs:element name="adversary" type="xs:string"/>
<xs:element name="goals" type="ab:goalsType"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="goalsType">
<xs:sequence>
<xs:element ref="ab:player"/>
</xs:sequence>
</xs:complexType>
<xs:element name="games">
<xs:complexType>
<xs:sequence>
<xs:element name="game" type="ab:gameType"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="player">
<xs:complexType>
<xs:sequence>
<xs:element name="number" type="xs:integer" minOccurs="0" maxOccurs="1"/>
<xs:element name="name" type="xs:string" minOccurs="0" maxOccurs="1"/>
</xs:sequence>
<xs:attribute name="id">
<xs:simpleType>
<xs:restriction base="xs:integer">
<xs:minInclusive value="1"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="minute" type="xs:string" use="optional"/>
</xs:complexType>
</xs:element>
<xs:element name="nationalTeam">
<xs:complexType>
<xs:sequence>
<xs:element ref="ab:player" minOccurs="22" maxOccurs="25"/>
<xs:element ref="ab:games"/>
</xs:sequence>
</xs:complexType>
<xs:key name="pk_id">
<xs:selector xpath="ab:nationalTeam/ab:player"/>
<xs:field xpath="@id"/>
</xs:key>
<xs:keyref name="fk_id" refer="ab:pk_id">
<xs:selector xpath="ab:nationalTeam/ab:games/ab:game/ab:goals/ab:player"/>
<xs:field xpath="@id"/>
</xs:keyref>
</xs:element>
</xs:schema>
まあ、それは反気候でした。今私はこれを求めて愚かな気分になります。ありがとう、私はこのミスのために申し訳ありません。 – Greggz