How to encode characters from Oracle to XML?

前端 未结 3 1625
甜味超标
甜味超标 2021-01-12 05:28

In my environment here I use Java to serialize the result set to XML. It happens basically like this:

//foreach column of each row
xmlHandler.startElement(ur         


        
3条回答
  •  深忆病人
    2021-01-12 05:29

    Extensible Markup Language (XML) 1.0 says:

    The ampersand character (&) and the left angle bracket (<) must not appear in their literal form, except when used as markup delimiters, or within a comment, a processing instruction, or a CDATA section. If they are needed elsewhere, they must be escaped using either numeric character references or the strings "&" and "<" respectively. The right angle bracket (>) may be represented using the string ">", and must, for compatibility, be escaped using either ">" or a character reference when it appears in the string "]]>" in content, when that string is not marking the end of a CDATA section.

    You can skip the encoding if you use CDATA:

    
    
    

提交回复
热议问题