Note that I can't remember the schema definition of Java Servlet 4.0. I didn't know where the official definition was.
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd"
version="4.0">
</web-app>
xmlns="http://xmlns.jcp.org/xml/ns/javaee"
Define a "namespace name".
This defines which namespace the tag elements
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd"
(Skip one declaration)
Here, the reference destination of the schema definition file (.xsd) of the namespace http://xmlns.jcp.org/xml/ns/javaee
defined earlier is specified.
In other words, elements such as http://xmlns.jcp.org/xml/ns/javaee
, and their definition is http: // xmlns. Please refer to the definition file of jcp.org/xml/ns/javaee/web-app_4_0.xsd
. "
By the way, web-app_4_0.xsd seems to point to Java Servlet 4.0.
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
So, this declaration that I skipped defines the namespace to which the element schemaLocation
that specifies the location of the schema definition file belongs as xsi: schemaLocation
, and declares it with the alias xsi
. There is.
Two namespaces are defined in web.xml, and the usage of each is as follows.
http://xmlns.jcp.org/xml/ns/javaee
.http://www.w3.org/2001/XMLSchema-instance
is defined only to use schemaLocation
which indicates the location of the definition file of the namespace of 1.How to declare DTD / XSD by version of web.xml Namespace in XML
Recommended Posts