N G wrote:
Hi,

I found some strange behavior while using Tomcat 5.5.7. In my web.xml
Schema declaration, I have this:

<web-app xmlns="http://java.sun.com/xml/ns/j2ee";
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
         xsi:schemaLocation=
           "http://java.sun.com/xml/ns/j2ee web-app_2_4.xsd"
         version="2.4">

(I enabled xmlValidation="true" for Host element in server.xml)

I found it odd that under schemaLocation, a relative URL is given to
the XSD file. Yet, there is no "web-app_2_4.xsd" file in WEB-INF
directory. How does it validate web.xml then?

So, I substituted "web-app_2_4.xsd" with the word "whatever". To my
surprise it worked again without any problems.

What is going on? How does Tomcat validate web.xml of an application?

Tomcat uses it's own local version. This way you can use Tomcat without being connected to the internet, or pay the price of connection over http everytime a war is deployed.


And what's WAY more important: what does the servlet spec say about
how a server should validate web.xml?

See the Servlet Spec.

SRV.13.2 Rules for Processing the Deployment Descriptor This section lists some general rules that Web containers and developers must note concerning the processing of the deployment descriptor for a Web application. · Web containers must remove all leading and trailing whitespace, which is de- fined as "S(white space)" in XML 1.0 (http://www.w3.org/TR/2000/WD-xml- 2e-20000814), for the element content of the text nodes of a deployment de- scriptor. · The deployment descriptor must be valid against the schema. Web containers and tools that manipulate Web applications have a wide range of options for checking the validity of a WAR. This includes checking the validity of the de- ployment descriptor document held within. The containers and tools that are part of J2EE technology-compliant implementation are required to validate deployment descriptor against the XML schema for structural correctness. The validation is recommended, but not required for the web containers and tools that are not part of J2EE technology-compliant implementation.


-- Jeanfrancois


I didn't see anything there at
all about this, so I assumed that regular XML rules apply.

Could someone straighten me out on this issue?




Thanks, NG.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to