日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

xsd java引用_web.xml文件的 xsd引用(或dtd引用)学习

發(fā)布時間:2025/3/19 编程问答 19 豆豆
生活随笔 收集整理的這篇文章主要介紹了 xsd java引用_web.xml文件的 xsd引用(或dtd引用)学习 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

1. 為什么web.xml會有不同版本的xsd引用:

JDK依賴變化;

或 servlet(JAVA EE)自身API的改變;

2. 為什么會有dtd和xsd兩個版本的區(qū)別

我是在這篇文章中看到的,作者似乎拷貝了一段API說明:

There are two ways to specify the schema for a the web.xml file (Deployment Descriptor).

DTD - Document Type Definition

XSD - XML Schema Definition

The XSD version is preferred since JSP 2.0 / Servlets 2.4 (eg: Tomcat 5.5). Note that the XML encoding can be specified as ISO-8859-1, UTF-8, or any other valid encoding in either version, and should match the actual encoding of your text file.

XSD example for JSP 2.1 / Servlets 2.5 (Tomcat 6.0):

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_5.xsd"

version="2.5">

XSD example for JSP 2.0 / Servlets 2.4 (Tomcat 5.5):

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"

version="2.4">

DTD example for JSP 1.2 / Servlets 2.3 (Tomcat 5):

/p>

PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"

"http://java.sun.com/dtd/web-app_2_3.dtd">

在這里,也就說了,DTD是早期支持的方式,后期盡量用XSD。為什么XSD成為趨勢,這里有個很好的注解《如何使用XSD》《XML中DTD,XSD的區(qū)別與應用》。

DTD和XSD相比:DTD 是使用非 XML 語法編寫的。

DTD 不可擴展,不支持命名空間,只提供非常有限的數據類型 .

3. web.xml幾個版本的列表

web.xml v2.3

web-app?PUBLIC?"-//Sun?Microsystems,?Inc.//DTD?Web?Application?2.3//EN"?"http://java.sun.com/dtd/web-app_2_3.dtd">

web.xml v2.4

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee?http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">

web.xml v2.5

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_2_5.xsd"

version="2.5">

web.xml v3.0

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

總結

以上是生活随笔為你收集整理的xsd java引用_web.xml文件的 xsd引用(或dtd引用)学习的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。