web.xml提示the processing instruction target matching "[xX][mM][lL]" is not allowed
2018-01-12 16:39
543 查看
新建maven工程时,默认引用的java版本比较老,导致web.xml中dtd版本为2.3,即properties->Project Facts->Dynamic Web Module版本为2.3,因为实际使用tomcat为8.0,所以需要将Dynamic Web Module版本改为3.0.
改正过程:
首先修改web.xml,将以下内容
替换为
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.0"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
<display-name>Archetype Created Web Application</display-name>
</web-app>
由于本人有注释的习惯,只是将代码图中代码注释掉,然后拷贝上正确的代码,
导致报错The processing instruction target matching "[xX][mM][lL]" is not allowed。出现这个问题是因为xml格式不正确导致的,<?xml version="1.0" encoding="UTF-8"?>前面不要有任何其他字符,这个错误纯粹是画蛇添足导致的。
后来删除掉前面注释的内容就好了
改正过程:
首先修改web.xml,将以下内容
替换为
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.0"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
<display-name>Archetype Created Web Application</display-name>
</web-app>
由于本人有注释的习惯,只是将代码图中代码注释掉,然后拷贝上正确的代码,
导致报错The processing instruction target matching "[xX][mM][lL]" is not allowed。出现这个问题是因为xml格式不正确导致的,<?xml version="1.0" encoding="UTF-8"?>前面不要有任何其他字符,这个错误纯粹是画蛇添足导致的。
后来删除掉前面注释的内容就好了
相关文章推荐
- web.xml文件报错:The processing instruction target matching "[xX][mM][lL]" is not allowed.
- 由于空格引起的xml错误之The processing instruction target matching "[xX][mM][lL]" is not allowed以及the markup in the document prec
- 成功解决问题[Fatal Error] test.xml:1:7: The processing instruction target matching "[xX][mM][lL]" is not allowed.
- XML问题: The processing instruction target matching "[xX][mM][lL]" is not allowed
- XML解析异常之 The processing instruction target matching "[xX][mM][lL]" is not allowed.
- org.xml.sax.SAXParseException: The processing instruction target matching "[xX][mM][lL]" is not allowed(转)
- xml The processing instruction target matching "[xX][mM][lL]" is not allowed
- xml中出现The processing instruction target matching "[xX][mM][lL]" is not allowed.
- XML解析异常之 The processing instruction target matching "[xX][mM][lL]" is not allowed.
- The processing instruction target matching "[xX][mM][lL]" is not allowed.
- The processing instruction target matching "[xX][mM][lL]" is not allowed.
- The processing instruction target matching "[xX][mM][lL]" is not allowed.
- The processing instruction target matching "[xX][mM][lL]" is not allowed.
- The processing instruction target matching "[xX][mM][lL]" is not allowed.
- The processing instruction target matching "[xX][mM][lL]" is not allowed
- The processing instruction target matching "[xX][mM][lL]" is not allowed怎么办?
- The processing instruction target matching "[xX][mM][lL]" is not allowed.
- The processing instruction target matching "[xX][mM][lL]" is not allowed.
- The processing instruction target matching "[xX][mM][lL]" is not allowed
- The processing instruction target matching "[xX][mM][lL]" is not allowed