javajacksonfasterxmljackson-dataformat-xmlxmlmapper

How to fix new line error when parse xml


I have XML file with data. I am use FasterXML to parse it:

xmlMapper.readValue

And when my file has a format :

<w>
    <t name="test"/>
</w>

When i parse this file all work. If i use void tag t, ex. when my file has a format:

<w></w>

All work. But if i have format:

<w>
</w>

I get an error. I want both options to work. How to fix it?


Solution

  • I am ovveride deserialize(...). Added matches("^[\r\n\t ]+$")) to it.