목표 : 요소 "건너 뛰기"가 임의의 순서로 요소를 포함 할 수 있고 오류없이 내 xml의 유효성을 검사 할 수있는 complexType을 만듭니다.과 일치하는 와일드 카드 오류
스키마 :
<skip>
<anyelement1></anyelement1>
<anyelement2></anyelement2>
<anyelementN></anyelementN>
</skip>
:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema
xmlns="http://www.example.com/main"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.example.com/main"
attributeFormDefault="unqualified"
elementFormDefault="qualified"
>
<xs:complexType name="skip">
<xs:sequence>
<xs:any minOccurs="1"
maxOccurs="unbounded" />
</xs:sequence>
</xs:complexType>
</xs:schema>
내가
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema
xmlns:esc="http://www.escmatrix.com/main"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.example.com/main"
attributeFormDefault="unqualified"
elementFormDefault="qualified"
>
<xs:include
schemaLocation="http://www.example/skip" />
<xs:element name="tasks">
<xs:complexType>
<xs:choice minOccurs="0"
maxOccurs="unbounded" >
<xs:element name="skip"
type="esc:skip" />
</xs:choice>
</xs:complexType>
</xs:element>
<xs:schema>
내가 형태를 가질 수있다 XML의 유효성을 검사 할 필요가 내 main.xsd에 skip.xsd를 가져 skip.xsd
문제점 : 유효성을 검사 할 때 오류가 발생했습니다. "cvc-complex-type.2.4.c : 일치하는 와일드 카드는 엄격하지만 아무런 선언도 찾을 수 없습니다. 요소 'anyelement1'"
이 문제에 대한 정답입니다. 나중에 스키마를 수정하려고 할 때 동일한 오류가 발생했습니다. 내 솔루션을 게시하려고하는데 토론은 여기에서 찾을 수 있습니다. http://stackoverflow.com/questions/17173766/allowing-any-elements-from-a-particular-namespace-with-two-schemas 감사합니다. – Jefftopia