前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >xml文件错误之指令不允许匹配 原

xml文件错误之指令不允许匹配 原

作者头像
云飞扬
发布2019-03-13 10:17:55
8520
发布2019-03-13 10:17:55
举报
文章被收录于专栏:星汉技术星汉技术

问题描述

Eclipse中xml文件报出如下错误:

代码语言:javascript
复制
The processing instruction target matching "[xX][mM][lL]" is not allowed.

报错的文件是hadoop2.7.1源码中hadoop-common项目中的empty-configuration.xml,此文件存在项目中的目录如下:

文件内容如下:

代码语言:javascript
复制
<!--
   Licensed to the Apache Software Foundation (ASF) under one or more
   contributor license agreements.  See the NOTICE file distributed with
   this work for additional information regarding copyright ownership.
   The ASF licenses this file to You under the Apache License, Version 2.0
   (the "License"); you may not use this file except in compliance with
   the License.  You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
-->
<?xml version="1.0"?>
<configuration>
</configuration>

问题解析

在网上搜了一下这个错误信息,还真有,内容如下:

xml文件不能被解析,一般出现这样的问题在于xml格式上,并且问题多出现在xml文件的头部。 原因: (1)一般多是因为xml文件头部有了空格或回车导致的。 (2)字母大小写问题。 例如:<?xml version="1.0" encoding="UTF-8"?>不能写成<?XML version="1.0" encoding="UTF-8"?> 结论: <?xml version="1.0" encoding="UTF-8"?>前面不要有任何其他字符,如空格、回车、换行这些否则就会出现上面的异常。

解决方法

本人就将<?xml version="1.0"?>挪到了第一行的位置,错误解决,当本人在去查看hadoop刚解压的文件时,发现确实有这个文件,不是Maven下载导致的,所以本人就很纳闷,Apache不至于出这么大的问题吧?

修改过的内容如下:

代码语言:javascript
复制
<?xml version="1.0"?>
<!--
   Licensed to the Apache Software Foundation (ASF) under one or more
   contributor license agreements.  See the NOTICE file distributed with
   this work for additional information regarding copyright ownership.
   The ASF licenses this file to You under the Apache License, Version 2.0
   (the "License"); you may not use this file except in compliance with
   the License.  You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
-->
<configuration>
</configuration>

至今仍是疑惑,有知道的朋友可以留言告知,谢谢!

(adsbygoogle = window.adsbygoogle || []).push({});

本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2018/08/31 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 问题描述
  • 问题解析
  • 解决方法
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档