JAXB XJCコード生成 - マーシャラーによって生成されたXMLで行方不明「のschemaLocation」
質問
私のXSDスキーマのためのJavaクラスを生成するためのI使用XJCツール。私は、XMLペイロードにマーシャリングクラスにJAXBマーシャラーを使用する場合、私は、出力XMLで「のschemaLocation」パラメータが欠落していますが、私は、XSDファイルのこのパラメータを宣言します。どのように出力XMLで「のschemaLocation」パラメータを強制する?
以下は、コード生成のために使用私のXSDスキーマファイルのbegginingです:
<?xml version="1.0" encoding="UTF-8"?><xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="xsdns" xmlns:messages="http://www.exampleURI.com/Schema1" xmlns:datatypes="http://www.exampleURI.com/Schema1" xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance" xsi:schemaLocation="http://www.exampleURI.com/Schema1 ./messages.xsd" targetNamespace="http://www.exampleURI.com/Schema1" elementFormDefault="unqualified" version="true">
<xs:include schemaLocation="datatypes.xsd"/>
<xs:complexType name="execute-system-command-struct">
<xs:annotation>
<xs:documentation>The request for system command execution.</xs:documentation>
</xs:annotation>
<xs:sequence/>
<xs:attribute name="action" type="datatypes:system-action-kind-enum" use="required">
<xs:annotation>
<xs:documentation>The action that the Voice System has to proceed.</xs:documentation>
</xs:annotation>
</xs:attribute>
よろしく
解決
これを試してみてください
marshaller.setProperty(Marshaller.JAXB_SCHEMA_LOCATION, "http://my.namespace my.schema.xsd");
所属していません StackOverflow