3

いくつかのxsdからいくつかのBeanを生成しようとしています。残念ながら、それらはすべて同じルート要素を持っています。サブ要素の名前を変更するためのxjcバインディングファイルを正常に作成しましたが、ルートノードを選択してそれを変更する方法が見つかりません。

次のことを試しましたが、エラーが発生しました。[ERROR] "/"のXPath評価では、要素を生成する必要があります。

<jxb:bindings version="1.0" xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc" xmlns:jxb="http://java.sun.com/xml/ns/jaxb" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:com.fnf="http://www.fnf.com/xes">
  <jxb:bindings schemaLocation="transcode-submit.xsd" node="/xs:schema">

    <jxb:bindings node="/">
        <jxb:property name="Newname"/>                                     
    </jxb:bindings>

  </jxb:bindings>                                                           

4

1 に答える 1

8

私はそれを考え出した。

<jxb:bindings version="1.0" xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc" xmlns:jxb="http://java.sun.com/xml/ns/jaxb" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:com.fnf="http://www.fnf.com/xes">
  <jxb:bindings schemaLocation="transcode-submit.xsd" node="/xs:schema">

  <jxb:bindings node="//xs:element[@name='OLDROOTNAME']">
      <jxb:class name="NEWNAME"/>                                     
   </jxb:bindings>

于 2011-03-01T17:00:25.657 に答える