java - JAXB Moxy mixed whitespace lost -


i have problem while unmarshalling xml mixed content. space gets lost. xml looks this:

<text>rooms in <g>the</g> <g>eldorado hotel</g> on broadway have jacuzzi</text> 

this unmarshalled to:

  • "rooms in " (with final space)
  • a object value 'the'
  • a object value 'eldorado hotel'
  • " on broadway have jacuzzi" (with initial space)

everything fine i'm missing space between 2 tags. need preserve space!

the simplified mapping like:

@xmltransient public abstract class abstracttext {      private list words;      @xmlmixed     @xmlelementrefs({         @xmlelementref(type = wordgroup.class, required = false), // <g> tag         @xmlelementref(type = word.class, required = false)     })     public list getwords() {         if (words == null) words = new arraylist();         return words;     }      public void setwords(list words) {         this.words = words;     }  }  @xmlroot public class text extends abstracttext{  } 

the mapping not done this, in xml file (each class inherinting abstracttext can have different children.

the real mapping is:

<java-type name="dp.dc.exercise.model.text">     <java-attributes>         <xml-element-refs java-attribute="words" xml-mixed="true">             <xml-element-ref type="dp.dc.exercise.model.text.word" required="false"/>             <xml-element-ref type="dp.dc.exercise.model.text.wordgroup" required="false"/>         </xml-element-refs>     </java-attributes> </java-type> 

and works great in everycase when there 2 tags, 1 after other.

any highly appreciated :)

this appears bug, have entered following issue can track:


Comments

Popular posts from this blog

ruby on rails - RuntimeError: Circular dependency detected while autoloading constant - ActiveAdmin.register Role -

c++ - OpenMP unpredictable overhead -

javascript - Wordpress slider, not displayed 100% width -