An invalid XML character (Unicode: 0x10) was found in the value of attribute
通過SAX解析document的時候,出現了An invalid XML character (Unicode: 0x10) was found in the value of attribute的異常,找了好久發現是因為文件中有不合法的字元。
這些錯誤的發生是由於一些不可見的特殊字元的存在,而這些字元對於XMl檔案來說又是非法的,所以XML解析器在解析時會發生異常,官方定義了XML的無效字元分為三段:
0x00 - 0x08
0x0b - 0x0c
0x0e - 0x1f
因此我在解析的時候新增上了string.replaceAll(“[\x00-\x08\x0b-\x0c\x0e-\x1f]”, “”); 來處理掉特殊的字元。
參考文章
SAX解析文件
相關文章
- An invalid XML character (Unicode: 0x18) was foundXMLUnicode
- Error parsing XML: An invalid XML character (Unicode:0x1f) was foundErrorXMLUnicode
- An invalid XML character (Unicode: 0x4) was found in the element content of theXMLUnicode
- 微信公眾號 報 An invalid XML character (Unicode: 0x1a) was found in the CDATA sectioXMLUnicode
- All About JAVA An invalid XML character (Unicode: 0xdd65) was found in the comment 錯誤JavaXMLUnicode
- PHP 對字串進行十六進位制替換 invalid character in attribute valuePHP字串
- 對XML 進行 parse 時的Invalid Unicode character (0x0) 分析XMLUnicode
- Java - XML字元支援報錯An invalid XML characterJavaXML字元
- SAXParseException An invalid XML character 問題的解決ExceptionXML
- The value for the useBean class attribute SecurityOrgPages is invalid. in tomcat 5.5BeanTomcat
- Dom4j 讀 xml 時,遇到 xml 無效字元,報錯:An invalid XML characterXML字元
- IllegalArgumentException: Invalid character found in method name. HTTP method names must be tokensExceptionHTTP
- jQuery [attribute*=value]jQuery
- jQuery [attribute~=value]jQuery
- jQuery [attribute|=value]jQuery
- jQuery [attribute$=value]jQuery
- jQuery [attribute^=value]jQuery
- jQuery [attribute!=value]jQuery
- jQuery [attribute=value]jQuery
- SpringBoot升級到3.2.0報錯Invalid value type for attribute ‘factoryBeanObjectType‘: java.lang.StringSpring BootBeanObjectJava
- python: invalid value encountered in divide以及invalid value encountered in double_scalars報錯PythonIDE
- 已解決:Invalid character found in the request target. The valid characters are defined in RFC 7230 and RFC 3986 問題
- mybatis竟然報"Invalid value for getInt()"MyBatis
- ERROR getting 'android:label' attribute: attribute is not a string valueErrorAndroid
- Python 錯誤 SyntaxError: invalid character in identifierPythonErrorIDE
- According to TLD or attribute directive in tag file, attribute value does not accept any expressionExpress
- mybatis3:Invalid bound statement (not found)MyBatisS3
- MyBatis 錯誤:Invalid bound statement (not found)MyBatis
- mybatis 報錯: Invalid bound statement (not found)MyBatis
- MySQL Invalid gbk character string 1300MySql
- Truncating HTML attribute value in SharePoint DataFormWebPartHTMLORMWeb
- Invalid bound statement (not found)錯誤解決
- get_attribute ('textContent') 和 get_attribute ('value') 有什麼區別
- not found service definition in jdonframework.xmlFrameworkXML
- DataPump Export (EXPDP) Fails With Error LPX-216 Invalid CharacterExportAIError
- vector android:fillType gradient android:endX attribute not foundAndroid
- ERROR ITMS-90542: “Invalid CFBundleSupportedPlatforms value.”ErrorPlatform
- mysql:Variable 'character_set_client' can't be set to the value of 'NULL'解決MySqlclientNull