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を返します。 Root要素の宣言だけが見つかります。
も動作しません。ルート宣言のみが返されます。 これらの宣言をRootTypeにネストする方法は?
おかげで、今私が取得しますそれ!しかし、別の問題が発生しました(私は質問を編集しました)。 –
答えを得た後に質問を変更しないでください。それはスレッドを非常に難しくします。別の質問がある場合は、新しいスレッドでそれを上げてください。 –
私は変更を元に戻しました。 –