0
Apache Xerces를 사용하여 다음 XSD 파일을 구문 분석하고 있습니다.Apache Xerces가 xsd의 모든 요소에 대한 선언을 얻습니다.
<xs:element name="Root" type="RootType">
...
</xs:element>
<xs:complexType name="RootType">
<xs:complexContent>
<xs:extension base="BaseElement">
<xs:choice maxOccurs="unbounded">
<xs:element name="ElementA" type="ElementAType" />
<xs:element name="ElementB" type="ElementBType" />
<xs:element name="ElementC" type="ElementCType" />
</xs:choice>
<xs:attribute ... >...</xs:attribute>
<xs:attribute ... >...</xs:attribute>
<xs:attribute ... >...</xs:attribute>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="BaseElement">
...
</xs:complexType>
<xs:complexType name="ElementAType">
...
</xs:complexType>
<xs:complexType name="ElementBType">
...
</xs:complexType>
<xs:complexType name="ElementCType">
...
</xs:complexType>
내가 파일에 모든 요소의 선언을 좀하고 싶습니다
, 즉 : 루트, ElementA, ElementB 및 ElementC. 메서드 :
XSElementDeclaration decl = model.getElementDeclaration("ElementA");
은 ElementA, ElementB 및 ElementC에 대해 null을 반환합니다. 루트 요소의 선언 만 찾습니다.
XSNamedMap comp = model.getComponents(XSConstants.ELEMENT_DECLARATION);
도 작동하지 않으므로 루트 선언 만 반환합니다. 이러한 선언을 RootType에 중첩시키는 방법은 무엇입니까?
덕분에, 지금은 얻을 그것! 그러나 다른 문제가 발생했습니다 (제 질문을 수정했습니다). –
답변을 얻은 후에 질문을 변경하지 마십시오. 따라하기가 매우 어렵습니다. 다른 질문이있는 경우 새 스레드에서이를 제기하십시오. –
좋아, 변경 사항을 취소했습니다. –