簡體   English   中英

org.xml.sax.SAXParseException:與元素類型“ Employee”相關聯的屬性“ id”的值不得包含“ <”字符。 在

[英]org.xml.sax.SAXParseException: The value of attribute “id” associated with an element type “Employee” must not contain the '<' character. at

當我嘗試讀取XML解析並且輸入的XML包含一些特殊字符(例如&,<,>和“”)時,出現問題。 使用SAXParse api解析XML時,出現以下異常。

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解析發生之前替換特殊字符。 如果任何人有一段代碼,請分享。

它的巨大幫助! -威斯瓦納特

您需要轉義以下字符

"   &quot;
'   &apos;
<   &lt;
>   &gt;
&   &amp;

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM