Python:sax解析xml的时候碰到特殊字符怎么办?
怪我咯
怪我咯 2017-04-17 13:29:08
0
1
952

XML

<?xml version="1.0" encoding="UTF-8"?>
<root>
    <system value="s1">
        <title>a&b&c</title>
    </system>
    <system value="s2">
        <title>test</title>
    </system>
</root>

使用sax解析以上xml的时候,由于xml中包含有特殊字符&,所以第二个system标签没法解析到。
求解决办法

怪我咯
怪我咯

走同样的路,发现不同的人生

reply all(1)
Peter_Zhu

This is illegal XML, and normal parsing should not be able to do anything with it.

If you are sure that no XML entity can appear in this XML document, you can replace the & characters with &amp; before parsing.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template