내가 그 구조를받을 계획입니다 :xsd-validate는 정확한 속성을 가진 요소입니까?
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Document>
<property key="DocumentType" value="INV" />
<property key="InvInternalNumber" value="i-1651-84" />
<property key="OtherDynamicProperty" value="yes" />
</Document>
내가 문서 유형을 식별하고 "INV.xsd"
오와 유효성을 검사하는 것, 사업은 송장 "InvInternalNumber"속성이 있어야합니다 말!
그래서 xsd 검증이 가능합니까? "InvInternalNumber"속성이 있습니까?
업데이트 그 XSD는 JaxbContext에 의해 생성되었습니다.
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<xs:schema version="1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="Document" type="Document"/>
<xs:complexType name="Document">
<xs:sequence>
<xs:element name="property" type="property" nillable="true" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="property">
<xs:sequence/>
<xs:attribute name="key" type="xs:string"/>
<xs:attribute name="value" type="xs:string"/>
</xs:complexType>
</xs:schema>
그건 아주 기본적인 XML 스키마 유효성 검사 규칙입니까? 스키마 파일에서 "xs : attribute"유효성 검사 규칙을 시도한 적이 있습니까? 이 예제를 확인하십시오. http://www.w3schools.com/xml/schema_example.asp – EventHorizon
설정 한 INV.xsd 스키마를 게시 할 수 있습니까? 나는 당신의 우려가 구조 검증보다 쓰기 규칙이라고 생각합니다. 그래서 우리는 다른 접근법을 사용할 수 있습니다. – potame
XML은 키와 값의 정렬되지 않은 목록입니까? 아니면 알려진 키 목록의 특정 순서를 가정 할 수 있습니까? 아마도이 질문에 대한 대답이 당신에게 효과가 있습니까? http://stackoverflow.com/questions/19543806/xml-schema-how-to-make-sure-one-element-exists-with-a-specific-attribute-value – EventHorizon