用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. s4-5 以太网帧

    以太网所处的层次 IEEE 802.3/以太网MAC子层协议  IEEE802.3协议描述了运行在各种介质上1 Mb/s~10 Mb/s的1- 持续CSMA/CD协议的局域网标准.  很多人对以太 ...

  2. hibernate映射组成关系

    目录结构 类 package com.hibernate.helloworld; public class School { private String name; private String a ...

  3. hibernate增删改

    public class HibernateUtils { private static SessionFactory sessionFactory=null; static{ //获取config ...

  4. noip第1课资料

  5. java基础-day8

    第08天 常用API 今日内容介绍 u API概述 u Scanner类与String类 u StringBuilder类 第1章   API概述 1.1      API概念 API(Applica ...

  6. POJ2289 Jamie's Contact Groups(二分图多重匹配)

    Jamie's Contact Groups Time Limit: 7000MS   Memory Limit: 65536K Total Submissions: 7721   Accepted: ...

  7. hdu1258

    给你两个数t,n 接下来输入n个数字 让你输出所有数字相加等于n的组合 4 6 4 3 2 2 1 1 t n 4 3+1 2+2 2+1+1 Sample Input 4 6 4 3 2 2 1 1 ...

  8. bootstrap4.2 导航搜索框

    <!DOCTYPE html><html> <head> <meta charset="UTF-8"> <title>& ...

  9. Python自动化开发 - 装饰器

    本节内容 一.装饰器导引 1.函数对象特性 2.扩展业务功能需求 3.各种解决方案 二.装饰器解析 1.装饰器基本概念 2.无参装饰器解析 一.装饰器导引 1.函数对象特性 #### 第一波 #### ...

  10. 关于Servlet中GET和POST方法的总结

    JSP.Servlet中get请求和post请求的区别总结   在学习JavaWeb最初的开始阶段,大家都会遇到HttpServlet中的doGet和doPost方法.关于Servlet中get请求和 ...