jackson-dataformat-xml
jackson-dataformat-xml copied to clipboard
Custom deserialization logic not reporting CDATA events
Using the following code:
@Override
public XmlNode deserialize(JsonParser p, DeserializationContext ctxt) {
if (p instanceof FromXmlParser) {
XMLStreamReader reader = ((FromXmlParser) p).getStaxReader();
while (reader.hasNext()) {
switch (reader.next()) {
case XMLStreamConstants.CDATA:
System.out.println("Found CDATA");
break;
}
}
}
}
The CDATA branch is never reached. Even after enabling the P_REPORT_CDATA and disabling the IS_COALESCING flags:
XMLInputFactory xmlInputFactory = new WstxInputFactory();
xmlInputFactory.setProperty(XMLInputFactory2.P_REPORT_CDATA, Boolean.TRUE);
xmlInputFactory.setProperty(XMLInputFactory2.IS_COALESCING, Boolean.FALSE);
XmlMapper xmlMapper = new XmlMapper(xmlInputFactory);