用DOM解析XML时出现了如下错误:

[Fatal Error] :3:13: Open quote is expected for attribute "{1}" associated with an  element type  "id".
org.xml.sax.SAXParseException: Open quote is expected for attribute "{1}" associated with an  element type  "id".
 at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:246)
 at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:284)
 at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:124)
 at com.xml.DOMDemo.parseDomXML(DOMDemo.java:26)
 at com.xml.DOMDemo.main(DOMDemo.java:14)

检查后发现我的xml文件是这样写的

<?xml version="1.0" encoding="UTF-8"?>
<message>
     <person id=1>
        <name>jerry</name>
        <age>18</age>
        <sex>男</sex>
    </person>
    <person id=2>
       <name>Aimi</name>
      <age>20</age>
      <sex>女</sex>
   </person>
</message>

错误就在于,xml元素的开始标签的属性必须用双引号括起来

改为:

<person id="1">

<person id="2">

[Fatal Error] :3:13: Open quote is expected for attribute "{1}" associated with an element type "id".的更多相关文章

  1. BUG:Open quote is expected for attribute "{1}" associated with an element type "id".

    BUG原因:Mybatis的xml文件中id缺少双引号: 正确的应该是:

  2. Open quote is expected for attribute "property" associated with an element type "result".错误

    java  Mybatis 框架下的项目 报   Open quote is expected for attribute "property" associated with a ...

  3. Open quote is expected for attribute "{1}" associated with an element type "name".

    xml属性必须用引号“”,不能缺少.

  4. Open quote is expected for attribute "{1}" associated with an element type "column".

    这个的错误的意思很简单:就是自己的配置文件是否缺少""号

  5. ERROR Fatal error during KafkaServer startup. Prepare to shutdown (kafka.server.KafkaServer)

    1.之前搭建的kafka,过了好久,去启动kafka,发现报如下下面的错误,有错误就要解决了. 然后参考:https://blog.csdn.net/hello_world_qwp/article/d ...

  6. 【VS开发】fatal error C1853: "Debug\sift.pch"预编译头文件来自编译器的早期版本

    fatal error C1853: "Debug\sift.pch"预编译头文件来自编译器的早期版本 <pre id="best-content-12991040 ...

  7. Ubuntu 13.10 PHP 5.5.x mcrypt missing – Fatal Error: Undefined function mcrypt_encrypt()!

    [原文]http://www.tuicool.com/articles/goto?id=myM7veR I had updgraded my Ubuntu from 13.04 to 13.10 la ...

  8. Fatal error: Allowed memory size of 524288000 bytes exhausted (tried to allocate 64 bytes) in D

    Fatal error: Allowed memory size of 524288000 bytes exhausted (tried to allocate 64 bytes) in D 从数据库 ...

  9. FATAL ERROR: Could not find ./bin/my_print_defaults的解决办法

    对mysql数据库初始化过程中,会有如下报错信息: 1 2 3 4 5 6 7 [root@localhost scripts]# ./mysql_install_db --user=mysql FA ...

随机推荐

  1. Linux主机名域名修改问题

    1.修改 /etc/sysconfig/network  配置文件 vi  /etc/sysconfig/network 修改HOSTNAMEHOSTNAME=new-hostname.domainn ...

  2. python科学计算模块NumPy

    NumPy是Numerical Python的简称,是高性能科学计算和数据分析的基础包.其实NumPy 本身并并没有提供太多的高级的数据分析功能, 但是理解NumPy数组以及面向数组的计算将有利于你更 ...

  3. 安卓hid驱动触摸屏

    在kernel/drivers/hid/ 目录下三个文件中添加usbtouch的pid vid, 文件分别是hid-multitouch.c .hid-ids.h.hid-core.c 具体如何添加可 ...

  4. Page页面生命周期——微信小程序

    onLoad:function (options) {     //页面初始化     console.log('index Load') }, onShow:function () {     // ...

  5. 关于MVC视图传参

    转自:http://q.cnblogs.com/q/48477/

  6. 团队项目之UML图设计---WeEdit

    团队信息: 学号: 姓名: 本次博客链接: 041602209 黄毓明(临时队长)  https://www.cnblogs.com/mingsonic/p/9820702.html 06160023 ...

  7. Windows Phone 8.1不完全体验报告

    在Build 2014中,微软倾心打造的Windows Phone 8.1终于粉墨登场,会场掌声不断.在大会结束后一周,经过漫长的等待,终于等到了开发者预览的推送,迫不及待地体验这一跨时代的移动系统. ...

  8. CSS 基础 例子 Image 高度设置

    body高度100%,三个image高度分别为auto,50%,60%,imge高度为当时body高度的百分比,auto时为原始高度 html代码如下: <!DOCTYPE html> & ...

  9. Python自动化开发 - 内置函数总结

    Python解释器提供了很多内置函数 参考链接:https://docs.python.org/3.6/library/functions.html 一.数学相关 1.绝对值:abs(-1) 2.最大 ...

  10. VARCHAR的最大长度的问题

    大家知道,在SQL Server 2000中,VARCHAR的最大长度是8000,如果字符串的长度超过8000,保存在VARCHAR中时就会被截断.如果你需要传入的参数恰好很长,比如是一个xml,很多 ...