Prashant wrote:
Steve Loughran wrote:
Ant 1.7's <schemavalidate> extension to <xmlvalidate> sets things up right for all nested <schema> elements.

If you cannot use the beta, look at the source, see how we set up the property
http://apache.org/xml/properties/schema/external-schemaLocation
Thats neat.

I googled <schemavalidate> and came up with this[1] explanation on this little feature.

I have a question on why the namespace is chosen as the key against which the local XSD can be pointed out.

Because XSD was written on the assumption that nobody would be silly enough to use completely different XSDs behind the same XMLNS. You can get away with looser and tighter XSDs, so that I could have an address schema which was nice and vague, but with different sub schemas for US and EU addresses. The other reason for using xmlns is it lets you mix and match schemas, so I can have code that uses wsa and soap12, with the different elements being in their own namespace. try doing that with DTDs.


<schema namespace="http://schemas.xmlsoap.org/ws/2003/03/addressing"; file="${ws-addressing.xsd}" />

aah, ws-a, the joy of my life. WS-A actually has two versions of the spec in the 2005/08 spec, the 2005/08 final and the 2005/08 released.



It turns out that all J2EE 1.4 XSDs belong to same namespace [2].

yeah, that is just silly. Take it up with javaee-spec-feedback at sun.com. The more people who complain about this, the more likely someone will come to their senses.

Further J2EE specifies that the XML instance documents specify the schemaLocation hint using xsi:schemaLocation attribute

A silly hack around a broken design decision.


Something like :
for web.xml : <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 http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"; version="2.4">

For ejb-jar.xml : <ejb-jar version="2.1" 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 http://java.sun.com/xml/ns/j2ee/ejb-jar_2_1.xsd";>

Observe how the xmlns value for both XML instance documents is same.

the whole J[2]EE schema naming thing is silly. What can I do to fix it?

How would one use the <schema namespace=/> thingie in these cases to locate web_2_.4.xsd / ejb-jar_2.1.xsd locally ?

You have to use different <schemavalidates> mapping the xmlns to the relevant doc. You probably always need a local copy because for a long time, the public webapp xsd didn't allow + in a mime type, like application/soap+xml.

-steve




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

Reply via email to