当我尝试阅读XML解析时,我遇到了问题,我输入XML包含一些特殊字符,例如&,<,>和""。 使用SAXParse api解析XML时,在Excpetions下面进行解析。
org.xml.sax.SAXParseException: The value of attribute "id" associated with an element type "Employee" must not contain the '<' character. at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
请在XML解析发生之前告诉我如何替换特殊字符。 如果有任何机构有一段代码,请分享。
非常有帮助! -Vishwanath
答案 0 :(得分:0)
您需要转义以下字符:
" "
' '
< <
> >
& &