用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. excel2007VBA绘图2

    '--------------------------------------------------------Module1------------------------------------ ...

  2. MongoDB-增删改

    MongoDB的shell使用了Js引擎,因此能运行任意的Js程序. MongoDB中常用基本数据类型: null:空值或者不存在的字段Boolean:true,false数值型:{"x&q ...

  3. ubuntu 开机自启(2B的经历)

    上午写了很细致的开机自启说明文档(需打开terminal进行输出认证).睡了一下午,回来楼主说,联想PM要用Ubuntu Server 当服务器,必须用命令行实现.. 连续各种百度谷歌,看了N多文档, ...

  4. 【python-ini】python读写ini文件

    [python-ini]python读写ini文件 本文实例讲述了Python读写ini文件的方法.分享给大家供大家参考.具体如下: 比如有一个文件update.ini,里面有这些内容:   1 2 ...

  5. noip第18课作业

    1. 银行取款 [题目描述] 在现代文明社会中,大家在诸如银行办理业务.车站买票等活动时都很文明没有插队的现象,本着“先来先服务”的规矩. 新年马上到了,明明的爸爸打算上银行去取点钱,带着一向表现很好 ...

  6. Hadoop读写流程

    写流程 读流程 HDFS写数据流程 HDFS读数据流程 网络拓扑-节点距离计算 节点距离:两个节点到达最近的共同祖先的距离总和

  7. HDU3506环形石子合并问题

    HDU3506环形石子合并问题 线性的石子合并问题比较好理解,环形的转成线性的方法就是扩展数组 1 2 3 . . . n 1 2 3 ... n 依据是我们最优的取值可以是 1 --- n也能是 2 ...

  8. shell 中的 && 和 ||

    shell 中的 && 和 || 简言之,shell 中 && --左边的命令执行成功才会执行右边的命令. || -- 左边的命令执行失败才会执行右边的命令.

  9. 编写高质量iOS与OS X代码的52个有效方法

    第一章重点: 第一条:OC的起源 OC由smalltalk语言演化而来的语言为消息结构(messaging structure)语言,其运行时所因执行的的代码由运行环境来决定:函数调用(functio ...

  10. STF环境搭建(ubuntu)

    一,环境搭建 1. linux 一些基础的工具要有: sudo apt-get update sudo apt-get install git sudo apt-get install lib32st ...