[Fatal Error] :3:13: Open quote is expected for attribute "{1}" associated with an element type "id".

用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">

时间: 2024-12-17 03:59:22

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

Open quote is expected for attribute &quot;property&quot; associated with an element type &quot;result&quot;.错误

java  Mybatis 框架下的项目 报   Open quote is expected for attribute "property" associated with an element type "result".    这个错 眼快使瞎了,终于找到了 错误写法: <result column="DELETE_STATUS" property=delete_status  jdbcType="VARCHAR"

Open quote is expected for attribute &quot;{1}&quot; associated with an element type &quot;

这个错误在启动tomcat产生的严重错误,我的配置文件缺少一个引号; 经过仔细检查,发现是我把我项目直接部署到tomcat的配置文件(server.xml)中时,发生的错误 错误代码为: <Context path="" docBase=C:\Users\Administrator\Workspaces\MyEclipse 10\SLSaleSystem\WebRoot"    reloadable="true"/> 正确代码为: <Co

Open quote is expected for attribute "name" associ

org.dom4j.DocumentException: Error on line 15 of document  : Open quote is expected for attribute "name" associated with an  element type  "property". Nested exception: Open quote is expected for attribute "name" associated w

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 last week and everything went quite good. The only problems that I faced as developer are: Apache 2.4 was not working with default previous installation

[Linker Fatal Error]:Expected a file name:

转发: https://blog.csdn.net/u011301123/article/details/9296673 C++ Builde先new application,然后直接开始画界面.可以直接运行,可是当保存完工程之后,再次运行,就出现[Linker Fatal Error]:Expected a file name:的错误,没办法真是服了.我保存的时候,为了省事期间,采用的都是默认的文件名:Unit1.cpp Project1.bpr.这个是它默认的,难道还是有问题. 首先,自己将

编译Busybox时,出现错误fatal error: curses.h: No such file or directory

1 scripts/kconfig/mconf.c: In function ‘exec_conf’: 2 scripts/kconfig/mconf.c:481:2: warning: ignoring return value of ‘pipe’, declared with attribute warn_unused_result [-Wunused-result] 3 pipe(pipefd); 4 ^ 5 SHIPPED scripts/kconfig/zconf.tab.c 6 SH

CentOS yum Fatal Error 处理一例

环境说明 [[email protected] ~]# cat /etc/redhat-release CentOS Linux release 7.1.1503 (Core) [[email protected] ~]# uname -r 3.10.0-229.7.2.el7.x86_64 [[email protected] ~]# 报错信息 [[email protected] ~]# yum -y install docker error: rpmdb: BDB0113 Thread/p

FATAL ERROR: Could not find ./bin/my_print_defaults

我勒个去,上午刚搞好MySQL的编译安装,玛德一重启计算机然后重启服务又报错: [[email protected] mysql-5.5.13]# /usr/local/mysql/scripts/mysql_install_db --user=mysql If you compiled from source, you need to run 'make install' to copy the software into the correct location ready for oper

“fatal error C1010”错误解决的三种方法

尝试写了一个简单的类文件,但在编译的时候提示错误,具体错误信息如下: fatal error C1010: unexpected end of file while looking for precompiled header directive 从网上搜到了一些解决办法,具体办法如下 : 1.在类的实现cpp文件的头部第一行加上“#include "stdafx.h"”. 2.关闭预编译头文件选项.具体步骤如下: Project Settings(Alt+F7) -> C/C+