Home > Back-end >  libxml2解析xml异常-
libxml2解析xml异常-

Time:06-07

The XML file contents are as follows:

<? The XML version="1.0" encoding="GBK"?> <body>李]]>

Data is read in buf, print buf also same as the file

Read the XML file to buf

XmlParseMemory (buf, xmlLen)//an error here

No other code processing, error content:

Encoding error: input conversion failed due to the input error, bytes 0 xfe x3c x9f 0 0 0 x2f
Encoding error: input conversion failed due to the input error, bytes 0 xfe x3c x9f 0 0 0 x2f
The I/O error: encoder error
The Entity: line 1: the parser error: the CData section not finished
Here is the code

The Entity:, line1: parser error: Premature end of data in the tag tiripPackage line 1
Ns: xsi="http://www.w3.org/2001/XMLSchema-instance" & gt; <body> Here is the code


Description:
1. The original code, XML file can't get the machine, so the XML file contents may be there is typing error, the file itself is no problem, if there are any abnormalities can be adaptively adjusted
2. 将李改为其它名字,不报错,正常

CodePudding user response:

Li mou didn't know that a certain system,
How is a rectangle?

CodePudding user response:

<? The XML version="1.0" encoding="GBK"?>
Try to utf-8

CodePudding user response:

<? The XML version="1.0" encoding="GBK"?>
===& gt;
<? The XML version="1.0" encoding="GB18030"?>

Seemingly libxml2 GBK support is not complete

CodePudding user response:

I hope it can help you: https://blog.csdn.net/it_xiangqiang/category_10581430.html
I hope it can help you: https://blog.csdn.net/it_xiangqiang/category_10768339.html
  • Related