2013-08-01 5 views
1

오류가 있습니다. xsd. 아래 내 xsd입니다. 나는 단지 주요한 요소를 언급하고있다. Jaxb 변환 클래스는 "XML 요소 선언을 네임 스페이스로 해석 할 수 없으며"@XmlRootElement (name = "principal")에서이 컨텍스트의 principal '이라는 이름을 사용할 수 없습니다. 누군가 여기서 도울 수 있니? 모든 스키마의주석이 달린 클래스를 jaxb로 XSD하면 xml 요소 오류를 해결할 수 없습니다.

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified"> 
<xs:element name="authorization"><xs:complexType>   <xs:sequence><xs:element name="group" maxOccurs="unbounded" minOccurs="1"><xs:complexType><xs:sequence><xs:element ref="principal" maxOccurs="unbounded" minOccurs="1" /></xs:sequence> 
<xs:attribute name="name" type="xs:string"></xs:attribute> 
</xs:complexType></xs:element> <xs:element name="principal" ><xs:complexType><xs:simpleContent><xs:extension base="xs:string"><xs:attribute type="xs:string" name="family" use="optional"/><xs:attribute name="type" type="xs:string" use="optional"/> 
</xs:extension></xs:simpleContent></xs:complexType></xs:element> 
</xs:schema> 
+0

내 xsd : – ram

답변

0

첫 번째는 잘못된 것입니다 :

여기 내 XSD입니다. 나는 당신이 다음과 같은 것을 넣으려고 노력한다고 생각합니다 :

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" 
    elementFormDefault="qualified" attributeFormDefault="unqualified"> 
    <xs:element name="authorization"> 
     <xs:complexType> 
      <xs:sequence> 
       <xs:element name="group" maxOccurs="unbounded" minOccurs="1"> 
        <xs:complexType> 
         <xs:sequence> 
          <xs:element ref="principal" maxOccurs="unbounded" 
           minOccurs="1" /> 
         </xs:sequence> 
         <xs:attribute name="name" type="xs:string"></xs:attribute> 
        </xs:complexType> 
       </xs:element> 
       <xs:element name="principal"> 
        <xs:complexType> 
         <xs:simpleContent> 
          <xs:extension base="xs:string"> 
           <xs:attribute type="xs:string" name="family" use="optional" /> 
           <xs:attribute name="type" type="xs:string" use="optional" /> 
          </xs:extension> 
         </xs:simpleContent> 
        </xs:complexType> 
       </xs:element> 
      </xs:sequence> 
     </xs:complexType> 
    </xs:element> 
</xs:schema> 

그리고이 XSD로 나는 당신에게 같은 문제가 있습니다. 당신이 다른 XSD로 변경하면 문제가

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" 
    elementFormDefault="qualified" attributeFormDefault="unqualified"> 
    <xs:element name="authorization"> 
     <xs:complexType> 
      <xs:sequence> 
       <xs:element name="group" maxOccurs="unbounded" minOccurs="1"> 
        <xs:complexType> 
         <xs:sequence> 
          <xs:element ref="principal" maxOccurs="unbounded" 
           minOccurs="1" /> 
         </xs:sequence> 
         <xs:attribute name="name" type="xs:string"></xs:attribute> 
        </xs:complexType> 
       </xs:element> 
      </xs:sequence> 
     </xs:complexType> 
    </xs:element> 
    <xs:element name="principal"> 
     <xs:complexType> 
      <xs:simpleContent> 
       <xs:extension base="xs:string"> 
        <xs:attribute type="xs:string" name="family" use="optional" /> 
        <xs:attribute name="type" type="xs:string" use="optional" /> 
       </xs:extension> 
      </xs:simpleContent> 
     </xs:complexType> 
    </xs:element> 
</xs:schema> 

감사

알렉스 해결 될 것입니다.