2014-09-13 7 views
0

.xsd 스키마로 유효성을 검사하는 다음 XML이 있습니다.XML .xsd 스키마 - 관계 적용

xProfile의 각 제품 이름이 존재하고 ref 및 key ref를 사용하여 xml의 전반부에 정의되도록 할 수 있습니다.

각 'xProduct'에는 xml의 위쪽 절반에 정의 된 각 제품에 대한 항목이 포함되어 있지만이를 수행 할 수 있는지 또는 가능하지 않은지를 확인하고 싶습니다.

<?xml version="1.0" encoding="UTF-8"?> 
    <profiles xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"   xsi:noNamespaceSchemaLocation="\\schema.xsd"> 
     <products> 
      <product name="product01" bool_setting="true"> 
       <code name="AAA"/> 
       <code name="BBB"/> 
      </product> 
      <product name="product02" bool_setting="true"> 
       <code name="CCC"/> 
       <code name="DDD"/> 
      </product> 
      <product name="product03" bool_setting="true"> 
       <code name="EEE"/> 
      </product> 
      <product name="product04" bool_setting="false"> 
       <code name="FFF"/> 
       <code name="GGG"/> 
      </product> 
      <product name="product05" bool_setting="false"> 
       <code name="HHH"/> 
      </product> 
      <product name="product06" bool_setting="false"> 
       <code name="III"/> 
      </product> 
     </products> 
     <xProfile name="name_one"> 
      <products> 
       <product name="product01" aNumber="1"/> 
       <product name="product02" aNumber="1"/> 
       <product name="product03" aNumber="1"/> 
       <product name="product04" aNumber="1"/> 
       <product name="product05" aNumber="1"/> 
       <product name="product06" aNumber="1"/> 
      </products> 
     </xProfile> 
      <xProfile name="name_one"> 
      <products> 
       <product name="product01" aNumber="1"/> 
       <product name="product02" aNumber="1"/> 
       <product name="product03" aNumber="1"/> 
       <product name="product04" aNumber="1"/> 
       <product name="product05" aNumber="1"/> 
       <product name="product06" aNumber="1"/> 
      </products> 
     </xProfile> 
    </profiles> 

답변

0

찾을 수없는 범위에 스키마를 붙여주십시오. http://www.datypic.com/books/defxmlschema/chapter13.html

+0

이 예를 들어 내 스키마가 포함되지 않은 순간 : 그렇지 않으면이를 제한 할 수있는 두 가지 방법이 있습니다 : 아래로 XML에 사용 유도가, 하나의 확장에 의해 파생이며, 두 번째 제한에 의해 유도입니다 아무것도. 내가 원하는 제약 조건을 적용하는 방법에 영향을 미칠 이유가 확실하지 않습니다. – Behoove21

관련 문제