2012-09-18 2 views
0

XML 파일을 생성하기 위해 정보를 삽입 할 수있는 Excel과 함께 XSD 매핑을 사용하고 있습니다. 문제는 내가 사용하고있는 XSD 매핑이 요소의 여러 인스턴스를 만들지 못한다는 것입니다. 여기 내 XSD 코드입니다 :XML 요소의 다중 인스턴스를 생성하는 Excel의 XSD 매핑

<?xml version="1.0" encoding="ISO-8859-1"?> 

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> 

<xs:element name="application"> 
    <xs:complexType> 
     <xs:all> 
      <xs:element name="name" type="xs:string" /> 
      <xs:element name="pagina"> 
       <xs:complexType> 
        <xs:all> 
         <xs:element name="page_name" type="xs:string" /> 
         <xs:element name="formulario" minOccurs="0"> 
          <xs:complexType> 
           <xs:all> 
            <xs:element name="textField" type="xs:string" minOccurs="0" /> 
            <xs:element name="checkBox"> 
             <xs:complexType> 
              <xs:all> 
               <xs:element name="opcao" type="xs:boolean" minOccurs="0" /> 
              </xs:all> 
             </xs:complexType> 
            </xs:element> 
           </xs:all> 
          </xs:complexType> 
         </xs:element> 

         <xs:element name="listagem" minOccurs="0"> 
          <xs:complexType> 
           <xs:all> 
            <xs:element name="entrada" minOccurs="1" type="xs:string" /> 
           </xs:all> 
          </xs:complexType> 
         </xs:element> 
        </xs:all> 
       </xs:complexType> 
      </xs:element> 

      <xs:element name="escolha" minOccurs="0"> 
       <xs:complexType> 
        <xs:all> 
         <xs:element name="origem" type="xs:string" /> 
         <xs:element name="onSuccess" type="xs:string" /> 
         <xs:element name="onFailure" type="xs:string" /> 
        </xs:all> 
       </xs:complexType> 
      </xs:element> 

     </xs:all> 
    </xs:complexType> 
</xs:element> 
예를 들어

, 나는 단지 내가 할 수있을 싶습니다 현실 "ENTRADA"정보의 단일 항목을 만들 수 있습니다 Excel에서지도를 만들 때 단일 "listagem"요소에 대해 "entrada"정보의 여러 항목을 추가하십시오.

어떻게 정보를 매핑하여 얻을 수 있습니까?

답변

1

기본적으로 maxOccursminOccurs은 기본값이 1이며 단일 요소 만 허용됩니다. maxOccursunbounded 또는 명시 적 값으로 설정해야합니다.

<xs:element name="entrada" minOccurs="1" maxOccurs="unbounded" type="xs:string" /> 
+0

"pagina"요소에 maxOccurs = "unbounded"를 추가하면 "지정된 XML 스키마를로드 할 수 없습니다"라는 메시지가 나타납니다. 어떤 이유로 Excel은 maxOccurs = "unbounded"를 요소에 추가 할 때 좋아하지 않습니다. –

+1

예, 죄송합니다. 그것은 xsd만의 해결책 일 것입니다. 그러나 이것은 맵이 탁월하게 작동하는 방식은 아닙니다. 다중성을 허용하는 Excel 스키마를 찾은 다음 해당 작업을 훔치거나 필요한 예제가있는 예제 XML 파일을 만들고 Excel 매핑 생성 도구를 사용합니다. –

+0

나는 그 예를 찾으려고 노력하고 있지만 운이 좋지는 않습니다. –

관련 문제