SAXParser '&' concatenation problem

前端 未结 2 1593
有刺的猬
有刺的猬 2021-01-13 04:14

I am presently using SAXParser with SAXParserFactory, and I have run into a problem with strings being cuttoff at \'&\' symbols. For example: \"Nation Created Our World

2条回答
  •  孤城傲影
    2021-01-13 04:56

    Thanks skaffman

    Implementation,

    public void startElement(String s, String s1, String elementName, Attributes attributes) throws SAXException {
        // clear tmpValue on start of element
        tmpValue = "";
    }
    
    public void characters(char[] ac, int i, int j) throws SAXException {
        tmpValue += new String(ac, i, j);
    }
    

提交回复
热议问题