Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [wtp-dev] Question on XML Validation and oracle xsds

Hi Keith and Rob
(You probably know all this already, but I’ll just add what I know)

I touched some of the validator code a few years back: The number of URI resolver interfaces is horrible - one from Platform, one from Xerces and one from WTP as I recall), each introducing a slight impedance mismatch.

Really, the XML Schema spec is at fault, by being so vague on the semantics of namespaces and schema locations, so Xerces can get away with their import policies (first import per namespace wins). So, the order of imports matter, and this affects the effective scope of each import:

Imagine this scenario where you have to “end-user” schemas A.xsd and B.xsd. A relies on namespace C and D, B only on C.
A.xsd imports A_C.xsd, which in turn also imports A_D.xsd (say, they were meant to be used together), and all is great, you can validate A.xsd by itself — no errors.
B.xsd import a different file B_C.xsd, which doesn’t contain an import for namespace D, but and doesn’t need to. B.xsd also validates by itself.
Now we make E.xsd which import A.xsd and B.xsd and uses namespaces A,B,C, and D. This should be just fine, and E.xsd can validate on its own. The import of B_C.xsd from B.xsd is ignored.
Now flip the imports of A.xsd and B.xsd. This will cause the namespace for C to be imported from B_C.xsd, and E.xsd will no longer validate, since it never sees the import of A_D.xsd from A_C.xsd. Wonderful, isn’t it?
Now, some short-sighted people even practice splitting namespace contents up into separate files, for greater “composability”, but the major stacks don’t support that.

In Eclipse, the XML Catalog support was supposed to be able to alleviate this, by allowing the end users manage the schemas themselves (I’d rather not have my IDE be dependent on some external server, even if we cache the result). Also, there is an extension point available for providing schemas (based on namespace OR schema location IIRC) along with plug-ins.

We might be able to improve the error handling and logging side of things, but only by tying deeper into the Xerces code.

-Jesper

On 25. feb. 2016, at 19.01, Keith Chong <kchong@xxxxxxxxxx> wrote:

Hi Rob

The XML Schema validator is based on the Xerces validator (parser), so I had a discussion with one of the developers. I'll try to answer your questions:

1) The validator resolves components via imports so if the import is missing, the schema is invalid. See: https://www.w3.org/TR/xmlschema-1/#src-resolve

2) This is a good question. I suspect that this client schema on its own is 'invalid' and is never intended to be used that way. (There are no global elements too so you can't create an instance document from it). The EE 5 schema includes this schema, so it is valid as part of 'the whole'. eg. If you remove the include directive from the EE5 schema, then the EE5 schema is invalid.

3,4,5) are somewhat related. I'm looking into this.

Regards,
Keith Chong
WTP Web Services


<graycol.gif>Rob Stryker ---02/16/2016 12:58:33 PM---Hi All: So after running into validation issues for our users' xml files using

From: Rob Stryker <rob.stryker@xxxxxxxxxx>
To: "General discussion of project-wide or architectural issues." <wtp-dev@xxxxxxxxxxx>
Date: 02/16/2016 12:58 PM
Subject: [wtp-dev] Question on XML Validation and oracle xsds
Sent by: wtp-dev-bounces@xxxxxxxxxxx





Hi All:

So after running into validation issues for our users' xml files using
our schema for week after week, I finally decided to dig in a little and
see how the JEE distribution handles validation of schema without so
many upstream dependencies. It's clear that if a parent or referenced
schema is invalid, the user will experience obscure validation errors
when developing their own webapps etc.

With that in mind I opened
https://bugs.eclipse.org/bugs/show_bug.cgi?id=487851

The usecase is that I simply took oracle's
javaee_web_services_client_1_2.xsd from
http://www.oracle.com/webfolder/technetwork/jsc/xml/ns/javaee/javaee_web_services_client_1_2.xsd 
and tried to put it in a dynamic web project and let the validator work
its magic.

I wouldn't be posting here if it succeeded ;)

The questions are basically:

   1) Why are oracle's xsd's failing to validate? Are they really all
invalid?

   2) Why has nobody in the world asked Oracle to fix them?

   3) How do we/you, as consumers / extenders of wtp, prevent errors in
oracle's (or other upstream) xsd's from cascading down to our respective
jee / appserver-specific schema when our schema import, extend, or
reference upstream failing xsds?

   4) Is this an error in source-editing plugins for not mapping
directly to the most commonly used jee namespaces? Would that even fix
the issue? (It didn't when I tried it but maybe I was doing it wrong).

   5) If oracle won't fix their incomplete xsd's, is it reasonable for
source-editing to do it, to make sure each and every one validate
correctly, and that, by extension, all other schema that reference,
import, or otherwise make use of oracles' schema won't be hit by a
series of cascading validation errors?

I suppose it's possible our product is simply "doing it wrong", but the
fact that simply placing an official javaee oracle xsd into a clean JEE
Mars eclipse environment fails validation is indicative to me that
something bigger is going on here.

- Rob Stryker
JBoss Tools And Other Cool Stuff
_______________________________________________
wtp-dev mailing list
wtp-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/wtp-dev



_______________________________________________
wtp-dev mailing list
wtp-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/wtp-dev


Back to the top