I’ve integrated the validator with
the wizards, it works nicely.
Few of things though:
-
The
method getFileNameFromNS is a bit capricious (see the logs extract below). Basically it
expects the NormalAnnotation object to contain the canonical class name of the annotation
being validated. That’s actually rarely the case, in general only the
local name is used and the validator should be able to cope with this situation
(should be easy enough to do with the help of the AnnotationSupportProxy). I logged a low priority story for this.
-
The
validator gets a bit upset if it cannot find a schema for a particular annotation
namespace and starts throwing error logs all over the place J… looks like a bad
catch block somewhere…
-
The
schemas need to be expanded a bit; I created a story for this and will try to
get into it tomorrow.
-
We need
to find a way to make the error messages a bit more user friendly. here’s
a sample of what we are getting right now : “cvc-complex-type.2.4.a:
Invalid content was found starting with element 'name'. One of
'{"":partName}' is expected.” I logged a story for that too.
Cheers,
d.
DEBUG --
org.eclipse.stp.sc.jaxws.validator.XMLSchemaValidator --
namespace:RequestWrapper
java.io.FileNotFoundException: /etc/validator/tWrapper.xsd
DEBUG --
org.eclipse.stp.sc.jaxws.validator.XMLSchemaValidator --
namespace:RequestWrapper schema fileName:tWrapper.xsd
DEBUG --
org.eclipse.stp.sc.jaxws.validator.XMLSchemaValidator -- schema file try to
load:etc/validator/tWrapper.xsd
at
org.eclipse.osgi.framework.internal.protocol.bundleentry.Handler.findBundleEntry(Handler.java:42)
at
org.eclipse.osgi.framework.internal.core.BundleResourceHandler.openConnection(BundleResourceHandler.java:158)
at
java.net.URL.openConnection(URL.java:943)
at java.net.URL.openStream(URL.java:1007)
From:
stp-dev-bounces@xxxxxxxxxxx [mailto:stp-dev-bounces@xxxxxxxxxxx] On Behalf Of Johnson Ma
Sent: 15 November 2006 03:27
To: Beaurpere, David
Cc: STP Dev list
Subject: [stp-dev] element based
annotaion validator is ready to use
The element based annotation validator should be ready to
use now.
Check out the test at
org.eclipse.stp.sc.jaxws.validator.AnnotationValidatorTest
The input of the validator is NormalAnnotation.
The return type is boolean value. if it returns false.
you can call validator.getLastErrorMessage to get the error message string.
The schema files for jsr181 are checked in at
/org.eclipse.stp.sc.jaxws/etc/validator/javax_jws.xsd
/org.eclipse.stp.sc.jaxws/etc/validator/javax_jws_soap.xsd
-> build annotaion xml doc from the NormalAnnotation
-> try to find the schema according to namespace defined
in the annotation xml.
-> if the schema doesn't exist, the validator will
return true.
-> otherwise, validate the xml against it's schema
You can put more schema files to the etc/validator/ dir
at anytime, thus we can support user to validate any annotation they want.