1. 程式人生 > >maven web項目的web.xml報錯The markup in the document following the root element must be well-formed.

maven web項目的web.xml報錯The markup in the document following the root element must be well-formed.

utf-8 style sta 元素 nbsp 地形 很好 ati instance

maven項目裏面的web.xml開頭約束是這樣的

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns="http://java.sun.com/xml/ns/javaee"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
    id="WebApp_ID" version="2.5"
/>

當在後面加了東西就會報錯:

The markup in the document following the root element must be well-formed.

翻譯下錯誤:根元素後面的文檔中的標記必須很好地形成。

解決方法:

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns="http://java.sun.com/xml/ns/javaee"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
id="WebApp_ID" version="2.5" ><!--這裏的“/”代表當前標簽結束啊啊啊啊--> </web-app>

maven web項目的web.xml報錯The markup in the document following the root element must be well-formed.