0

xml ファイルを対応する Java ファイルに変換しようとすると、次のエラーが表示されます。

09.09.2013 13:58:26 ERROR [manager.getContentsUnmarshalled():154] There was an error parsing the file: "props.xml". JAXB unmarshalling exception; nested exception is javax.xml.bind.UnmarshalException: unexpected element (uri:"", local:"newImageOverlay"). Expected elements are <{}GenericData>,<{}VirtualComponent>,<{}application_constants>,<{}channel>

このエラーは、xml ファイルに予期しない要素があることを示していると思いますか?

例外メッセージで、jaxb は「期待される要素」をどのように識別していますか? 識別子はどこに<{}GenericData>,<{}VirtualComponent>,<{}application_constants>,<{}channel>指定されていますか?

4

1 に答える 1

0

このエントリをアプリケーション コンテキスト ファイルに追加する必要がありました。

<oxm:jaxb2-marshaller>
<oxm:jaxb2-marshaller id="marshaller">
    <oxm:class-to-be-bound name="com.MyGeneratedClass"/>
</oxm:jaxb2-marshaller>
于 2013-09-10T09:58:35.607 に答える