차이점 과 스키마 정의에서?
xsd:all
복잡한 유형으로 사용 하고 있습니다. 유효성을 검사하는 동안 필수 요소를 놓친 경우 모든 요소가 표시됩니다. 누락 된 정확한 요소는 표시되지 않습니다.
그러나 내가 사용한다면 xsd:sequence
정확히 놓친 요소를 얻을 수 있습니다.
이 둘 사이에 차이점이 있습니까?
xsd:sequence
: XML 요소는 동일한 순서 여야합니다.
그러나 xsd:all
: XML 요소는 임의의 순서 일 수 있습니다.
<xsd:all>
하위 요소가 임의의 순서로 나타날 수 있음을 지정합니다.
<xsd:sequence>
하위 요소가 언급 된 순서로만 나타날 수 있음을 지정합니다.
시퀀스 예 :
<xs:element name="compElement">
<xs:complexType>
<xs:sequence>
<xs:element name="ele1" type="xs:string"/>
<xs:element name="ele2" type="xs:string"/>
<xs:element name="ele3" type="xs:string"/>
<xs:element name="ele4" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
이 xsd에서 XML을 생성하면 다음과 같이 보일 것입니다.
<compElement>
<ele1>First</ele1>
<ele2>Second</ele2>
<ele3>Third</ele3>
<ele4>Fourth</ele4>
</compElement>
모두를위한 예 :
<xs:element name="compElement">
<xs:complexType>
<xs:all>
<xs:element name="ele1" type="xs:string"/>
<xs:element name="ele2" type="xs:string"/>
<xs:element name="ele3" type="xs:string"/>
<xs:element name="ele4" type="xs:string"/>
</xs:all>
</xs:complexType>
</xs:element>
이 xsd에서 XML 파일을 생성하면 다음과 같이 보일 수 있습니다.
<compElement>
<ele2>Second</ele2>
<ele1>First</ele1>
<ele4>Fourth</ele4>
<ele3>Third</ele3>
</compElement>
더 많은 정보를 원하시면 모든 : XSD에 대한
추가 정보 XSD에 : 순서
Hope I answered your question.
Difference:
- xsd:all - "child elements can appear in any order and each child element can occur zero or one time" (ie, maxOccurs can be 0 or 1)
- xsd:sequence - "child elements must appear in a sequence. Each child element can occur from 0 to any number of times" (ie, maxOccurs can be 0 or any number or 'unbounded')
From the W3Schools tutorials here and here.
All Indicator
The
<all>
indicator specifies that the child elements can appear in any order, and that each child element must occur only once:
Sequence Indicator
The
<sequence>
indicator specifies that the child elements must appear in a specific order:
The schema merely defines what constitutes a compliant document.
How non-compliance is reported is entirely up to the validator. There is nothing stopping a validator from reporting exactly which fields are missing, but apparently the one you use does not in this case.
Whether that is a bug or by design you would have to discuss with the provider of the validator.
when we use under tag, it indicates all the elements that are declared in that complexType MUST appear in same order in XML document. otherwise, you will get an error. for there is no need to specify elements in proper order.
'UFO ET IT' 카테고리의 다른 글
열이 목록 인 data.frame 만들기 (0) | 2020.11.10 |
---|---|
SVG에 멋진 글꼴 아이콘을 어떻게 포함합니까? (0) | 2020.11.10 |
2 ^ 32 이상의 열거 형 플래그 (0) | 2020.11.10 |
Moment.js 날짜를 사용자 현지 시간대로 변환하는 방법은 무엇입니까? (0) | 2020.11.10 |
goal maven release : prepare를 실행하지 못했습니다. (0) | 2020.11.10 |