How to output a CDATA section from a Sax XmlHandler

后端 未结 2 1271
孤城傲影
孤城傲影 2021-01-13 20:14

This is a followup question of How to encode characters from Oracle to Xml?

In my environment here I use Java to serialize the result set to xml. I have no access to

2条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-13 20:37

    You should use startCDATA() and endCData() as delimiters, i.e.

    xmlHandler.startElement(uri, lname, "column", attributes);
    xmlHandler.startCDATA();
    String chars = rs.getString(i);
    xmlHandler.characters(chars.toCharArray(), 0, chars.length());
    xmlHandler.endCDATA();
    xmlHandler.endElement(uri, lname, "column");
    

提交回复
热议问题