2014-02-18 2 views
1

내 XML 스키마에서 조건부 필수 필드를 소개하려고하지만 xs : assert가 유효하지 않음을 알리는 오류가 발생했습니다 ... 어떤 도움을 주겠습니까?XML xs :: assert 복잡한 유형

추가 정보 : 내가

<?xml version="1.0" encoding="iso-8859-1" ?> 
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> 

    <xs:element name="configuration" type="configurationType"/> 

    <xs:complexType name="configurationType"> 
    <xs:sequence> 
     <xs:element name="application" minOccurs="1" maxOccurs="unbounded" type="appType" /> 
     <xs:element name="command" minOccurs="1" maxOccurs="unbounded" type="commandType"/> 
    </xs:sequence> 
    </xs:complexType> 


    <xs:complexType name="appType"> 
    <xs:attribute name="name" type="xs:string" use="required" /> 
    <xs:attribute name="hostname" type="xs:string" use="required" /> 
    <xs:attribute name="port" type="xs:positiveInteger" use="required" /> 
    <xs:attribute name="group" type="xs:string" use="required" /> 
    <xs:assert test="@hostname or @port != 4"/> 
    </xs:complexType> 

    <xs:complexType name="commandType"> 
    <xs:attribute name="name" type="xs:string" use="required" /> 
    <xs:attribute name="target" type="xs:string" use="required" /> 
    <xs:attribute name="parameter" type="xs:string" use="optional" /> 
    </xs:complexType> 

</xs:schema> 

답변

2

의 Xerces 3.1.1 C++는 XSD 1.1을 지원하지 않습니다) XML을 구문 분석 Xerces에 3.11 (C++를) 사용하고 있습니다. 이것이 근본 원인입니다.

XSDL 1.1 실험용 프로세서는 버전 2.10.0부터 Xerces-J (Java에만 해당)에서 introduced입니다.

+0

감사합니다. 많은 의미가 있습니다. –