用记事本写xml文档时要注意文件的编码格式:
一般记事本默认编码:ANSI
假如 用记事编写后缀名为xml的文档
文件内容如下:
<?xml version="1.0" encoding="utf-8"?>
<bookstore>
<book ISBN="2-3631-4">
<title>Oberon's Legacy</title>
<author>Corets,Eva</author>
<price>5.95</price>
</book>
<book genre="ls" ISBN="2-3631-4">
<title>cs从入门到精通</title>
<author>亚胜</author>
<price>65</price>
</book>
<book>
</book>
</bookstore>
然后保存结束
再次打开时会提示错误:
因为出现了中文
所以我们只要用记事本再次打开那个xml文件 另存为的时候 修改它的编码格式ANSI---------->UTF-8 问题就解决了