Unable to check CDATA in XML using XMLEventReader in Stax

前端 未结 2 1709
天命终不由人
天命终不由人 2021-01-16 18:02

I am unable to check for CDATA in XML and read it using XMLEventReader.

The following is the sample:

 HEADERS
                       


        
2条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-01-16 18:41

    Set the property, otherwise reader ignores the event type of CDATA.

    XMLInputFactory factory = XMLInputFactory.newInstance();
    factory.setProperty(Constants.ZEPHYR_PROPERTY_PREFIX + Constants.STAX_REPORT_CDATA_EVENT,Boolean.TRUE);
    

    See com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl, line: 3027

提交回复
热议问题