Skip to content

Custom deserialization logic not reporting CDATA events #746

Open
@mmkathurima

Description

@mmkathurima

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);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions