How to get jaxb to Ignore certain data during unmarshalling

后端 未结 3 1542
面向向阳花
面向向阳花 2020-12-11 22:39

I have a xml structure \"Filter\" that get unmarshalled into in a java class called \"Filter\".

The XML state looks roughly like:


  &         


        
3条回答
  •  旧时难觅i
    2020-12-11 23:39

    AFAIK the JAXB work on xml schema for unmarshalling XML into Java object. So if schema defines element as simple element, it can only contain text. If you need to store XML as simple text. You might need to escape it using CDATA construct. Try enclosing the same as shown below, after unmarshling you will get the XML as it is.

    
      
        prop1
        val1
      
      
        prop2
        valB]]>
      
    
    

提交回复
热议问题