次の形式の XSD があります。
<?xml version="1.0" encoding="utf-16"?>
<root>
<xs:schema --->
..
..
</xs:schema>
<xs:schema -->
..
..
</xs:schema -->
<xs:schema -->
..
..
</xs:schema -->
</root>
XJC コンパイラを使用してコンパイルすると、1 行目の「コンテンツはプロローグでは許可されていません」というエラーが発生します。エンコーディングを「ISO-8859-1」に変更すると
次のエラーが発生します。
[ERROR] Unexpected <root> appears at line 2 column 10
line 2 of ****.xsd Failed to parse a schema.
XSD から「ルート」タグを削除すると、次のエラーが発生し始めます。
[ERROR] The markup in the document following the root element must be well-formed.
line 44 of file:****.xsd
スキーマの解析に失敗しました。
私の質問は、XJC を使用して複数のスキーマ タグを持つ XSD をコンパイルできるかどうかです。次のファイル形式でこれを試しました:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="shiporder">
<xs:complexType>
<xs:sequence>
<xs:element name="abc" type="xs:string"/>
<xs:element name="cdf">
/xs:element>
</xs:sequence>
<xs:attribute name="orderid" type="xs:string" use="required"/>
</xs:complexType>
</xs:element>
</xs:schema>
上記の場合は完全に機能し、クラスを適切に作成しました。
名前空間宣言と何か関係がありますか?