Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 312163

Summary: [validation] Investigate XML Schema 1.1 support
Product: [WebTools] WTP Source Editing Reporter: Jesper Moller <jesper>
Component: wst.xsdAssignee: wst.xsd-triaged <wst.xsd-triaged>
Status: NEW --- QA Contact: Keith Chong <keith.chong.ca>
Severity: enhancement    
Priority: P3 CC: adrian.aichner, bugs.eclipse.org, Charlin.joe, david_williams, ivost, john.ruud, keritaf, kingoleg, kurellajunior, mukul.gandhi, rsc, thatnitind, tonny.madsen, tristan.tarrant, victor.noel
Version: unspecifiedFlags: thatnitind: review? (keith.chong.ca)
Target Milestone: Future   
Hardware: All   
OS: All   
See Also: https://bugs.eclipse.org/bugs/show_bug.cgi?id=204125
https://bugs.eclipse.org/bugs/show_bug.cgi?id=288527
Whiteboard:
Attachments:
Description Flags
org-eclipse-wst-validation-xsd11
none
org-eclipse-wst-xml-core-xsd11-2010-05-15T203240+0200.txt
none
org-eclipse-wst-xml-xpath2-processor-xsd11-2010-05-15T203240+0200.txt
none
org-eclipse-wst-xsd-core-xsd11-2010-05-15T203240+0200.txt
none
org-eclipse-wst-xsd-ui-xsd11-2010-05-15T203240+0200.txt
none
org-eclipse-wst-xsl-core-xsd11-2010-05-15T203240+0200.txt none

Description Jesper Moller CLA 2010-05-08 13:45:41 EDT
It would be quite possible to add XSD validation for the XML Schema 1.1 even if the EMF model and editor can't cope just yet.

XML Schema 1.1 is supported by the upcoming Xerces-J 2.10 release, which would have to be added to Orbit.
Actually Xerces-J 2.10 optionally relies on WTP's very own PsychoPath XPath2 engine for XML Schema 1.1 instance validation, so this will be tricky, dependency-wise. I OSGi will help out here.
Comment 1 Valentin Baciu CLA 2010-05-10 13:35:00 EDT
Thanks Jesper, could you please add a link to the Xerces-J 2.10 page? 

We should discuss this enhancement while we plan for the next WTP version. At that point, we'll probably need a bugzilla against Orbit to pull in this new Xerces-J version.
Comment 2 Adrian Aichner CLA 2010-05-13 05:54:12 EDT
I would like to see how I can help here.

How much of the CVS repository do I need to get?

Should I check out HEAD?

I would start contributing patches for review when I get anywhere.

Adrian
Comment 3 Valentin Baciu CLA 2010-05-13 09:55:10 EDT
Hi Adrian, thank you for offering to help. The XML schema validator code is in this plug-in org.eclipse.wst.xsd.core.

One of the first things to do is to figure out the impact of this new Xerces version on the WTP XML tools, beyond just the XML schema validator. The WTP XML tools depend quite heavily on Xerces; for example org.eclipse.wst.xml.core re-exports the org.apache.xerces bundle.

From what I know, the XML validator (part of org.eclipse.wst.xml.core) and likely the WSDL validator (hosted in org.eclipse.wst.wsdl.validation) also depend on Xerces and will need to be assessed. 

There may be more affected bundles, so we'll need to compute a list with all bundles that depend on org.apache.xerces, directly or indirectly by depending on org.eclipse.xml.core. 

We'll need to better understand the dependency between Xerces 2.10 and PsychoPath.

Adopter products may also be impacted so we'll need to thread lightly and communicate well.

If all tests look good, as Jesper said, Xerces 2.10 will have to be adopted by Orbit http://www.eclipse.org/orbit/ to allow WTP and other interested Eclipse projects to consume it.

Jesper, Nitin, I wonder if this enhancement is not better tracked in wst.xml instead of wst.xsd given the tight coupling between org.eclipse.wst.xml.core and org.apache.xerces.
Comment 4 Valentin Baciu CLA 2010-05-13 09:56:09 EDT
Alternatively, perhaps we need a to change this bugzilla's goal to be "adopt Xerces 2.10".
Comment 5 Adrian Aichner CLA 2010-05-15 14:27:44 EDT
(In reply to comment #3)
> Hi Adrian, thank you for offering to help. The XML schema validator code is in
> this plug-in org.eclipse.wst.xsd.core.
> 
> One of the first things to do is to figure out the impact of this new Xerces
> version on the WTP XML tools, beyond just the XML schema validator. The WTP XML
> tools depend quite heavily on Xerces; for example org.eclipse.wst.xml.core
> re-exports the org.apache.xerces bundle.

Hello Jesper, I have been able to make some good progress with some bootstrapping from Dave.

I have build
https://svn.apache.org/repos/asf/xerces/java/branches/xml-schema-1.1-dev
inside eclipse and created a
org.apache.xerces plugin 2.10.0 from all its jars.

I had to add
Require-Bundle: org.eclipse.osgi;bundle-version="3.6.0"

to my newly created:

Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Xerces
Bundle-SymbolicName: org.apache.xerces
Bundle-Version: 2.10.0

but then I was able to launch a new eclipse configuration with changes to other plugins I had to modify.

I'm a bit stuck now how to wire up
/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/XMLValidator.java
and
/org.eclipse.wst.xsd.core/src-validation/org/eclipse/wst/xsd/core/internal/validation/XSDValidator.java

to
    public static final String W3C_XML_SCHEMA11_NS_URI = "http://www.w3.org/XML/XMLSchema/v1.1".intern();
in what corresponds to
/xerces-java-xml-schema-1.1-dev/src/org/apache/xerces/impl/Constants.java
in the org.apache.xerces plugin.

Currently I can switch
between 1.0 validation which finds validation failures as before and 1.1 validation which always passes (even on trivial errors) on XSD files.

I will attach patches as a basis for discussion in the cominig few minutes.

Thanks for any help!

Adrian

> 
> From what I know, the XML validator (part of org.eclipse.wst.xml.core) and
> likely the WSDL validator (hosted in org.eclipse.wst.wsdl.validation) also
> depend on Xerces and will need to be assessed. 
> 
> There may be more affected bundles, so we'll need to compute a list with all
> bundles that depend on org.apache.xerces, directly or indirectly by depending
> on org.eclipse.xml.core. 
> 
> We'll need to better understand the dependency between Xerces 2.10 and
> PsychoPath.
> 
> Adopter products may also be impacted so we'll need to thread lightly and
> communicate well.
> 
> If all tests look good, as Jesper said, Xerces 2.10 will have to be adopted by
> Orbit http://www.eclipse.org/orbit/ to allow WTP and other interested Eclipse
> projects to consume it.
> 
> Jesper, Nitin, I wonder if this enhancement is not better tracked in wst.xml
> instead of wst.xsd given the tight coupling between org.eclipse.wst.xml.core
> and org.apache.xerces.
Comment 6 Adrian Aichner CLA 2010-05-15 14:48:22 EDT
Created attachment 168635 [details]
org-eclipse-wst-validation-xsd11

Here come the patches:

 900 May 15 20:34 org-eclipse-wst-validation-xsd11-2010-05-15T203240+0200.txt
7074 May 15 20:35 org-eclipse-wst-xml-core-xsd11-2010-05-15T203240+0200.txt
 895 May 15 20:36 org-eclipse-wst-xml-xpath2-processor-xsd11-2010-05-15T203240+0200.txt
9267 May 15 20:37 org-eclipse-wst-xsd-core-xsd11-2010-05-15T203240+0200.txt
5835 May 15 20:38 org-eclipse-wst-xsd-ui-xsd11-2010-05-15T203240+0200.txt
1485 May 15 20:39 org-eclipse-wst-xsl-core-xsd11-2010-05-15T203240+0200.txt


> I will attach patches as a basis for discussion in the cominig few minutes.
> 
> Thanks for any help!
> 
> Adrian
Comment 7 Adrian Aichner CLA 2010-05-15 14:49:54 EDT
Created attachment 168636 [details]
org-eclipse-wst-xml-core-xsd11-2010-05-15T203240+0200.txt
Comment 8 Adrian Aichner CLA 2010-05-15 14:51:02 EDT
Created attachment 168637 [details]
org-eclipse-wst-xml-xpath2-processor-xsd11-2010-05-15T203240+0200.txt
Comment 9 Adrian Aichner CLA 2010-05-15 14:51:42 EDT
Created attachment 168638 [details]
org-eclipse-wst-xsd-core-xsd11-2010-05-15T203240+0200.txt
Comment 10 Adrian Aichner CLA 2010-05-15 14:52:18 EDT
Created attachment 168639 [details]
org-eclipse-wst-xsd-ui-xsd11-2010-05-15T203240+0200.txt
Comment 11 Adrian Aichner CLA 2010-05-15 14:53:31 EDT
Created attachment 168640 [details]
org-eclipse-wst-xsl-core-xsd11-2010-05-15T203240+0200.txt

This is patch 6 of 6.
Comment 12 Valentin Baciu CLA 2010-05-17 22:57:25 EDT
Tentatively marking as a possible WTP 3.3 plan item.
Comment 13 Keith Chong CLA 2010-10-15 11:32:35 EDT
Moving out of plan.
Comment 14 Tristan Tarrant CLA 2012-08-23 04:33:32 EDT
Now that XMLSchema 1.1 has been ratified as a standard by the W3C, can we expect this issue to be revived ?
Comment 15 Stefan Cordes CLA 2013-10-16 04:59:09 EDT
As 1.0 validation cannot cope with 
<xsd:any> we are forced to disable xsd validation at all.

So we need option to switch to XMLSchema 1.1 support for eclipse.

"Description	Resource	Path	Location	Type
cos-nonambig: ".../oms/businessevents/imm":ArticleMaterial and WC[##any] (or elements from their substitution group) violate "Unique Particle Attribution". During validation against this schema, ambiguity would be created for those two particles.	product-detail.xsd	/oms-imm-xml-bind/resources/xsd	line 254	XML Schema Problem
"

<xsd:complexType name="ArticleType">
        ....
          <xsd:element maxOccurs="unbounded" minOccurs="0" name="ArticleMaterial" type="ArticleMaterialType" />
       	<!-- new attributes here -->
      	<xsd:any minOccurs="0"/>
       </xsd:sequence>
</xsd:complexType>

See https://blogs.oracle.com/rammenon/entry/xml_schema_11_what_you_need_to
Comment 16 Victor Noël CLA 2015-03-04 10:31:47 EST
Hi,

What is the status of this issue?
Comment 17 Ivo Steinmann CLA 2015-05-22 18:32:43 EDT
I'm waiting also for a solution :-)

Why is validator version not selected over?

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
	xmlns:vc="http://www.w3.org/2007/XMLSchema-versioning" vc:minVersion="1.1"
	...>