I am currently testing Xerces with the XML Schema test collection
(to be found here: http://www.w3.org/2001/05/xmlschema-test-collection.html)
I am using the Microsoft test suite.
I am also getting the error:
cvc-elt.1: Cannot find the declaration of element 'doc'.
or similar messages in 12 cases out of 254 error messages of failed
test cases when processing 2543
test cases (all within the Microsoft test suite that have an instance
and a schema). So overall xerces is not validating about 9.9% of the
test groups according to their expected outcome.
I am using the code below to run the test. All my input parameters
(schemaUri and instanceUri are simple Strings)
So now the big question:
Is it incorrect to use strings as input for the parser? (example
string content: "C:/test/msxdtest/attributes/attA001.xsd")
If so, Why does Xerces validate approx. 2250 test cases (each
consisting of a schema and an instance) correctly and only fails those
twelve test cases with the above mentioned error?
So far I am simply treating them as parser errors (BTW: using
java.net.URL schemaURL = new java.net.URL("file:/" + fileName); and
then converting it back to String did not make any difference in my
results)
The results have to be submitted soon and any comment is really welcome.
Anybody interested will be given the full results/error messages.
Thank you for your answers,
Gregor
Code fragment:
SAXParserFactory factory = SAXParserFactory.newInstance();
XMLReader reader = XMLReaderFactory.createXMLReader(
"org.apache.xerces.parsers.SAXParser"
);
reader.setFeature("http://xml.org/sax/features/namespaces", true);
reader.setFeature("http://xml.org/sax/features/namespace-prefixes", true);
reader.setFeature("http://xml.org/sax/features/validation", true);
reader.setFeature("http://apache.org/xml/features/validation/schema", true);
reader.setFeature("http://apache.org/xml/features/validation/schema-full-checking",
true);
Validator handler=new Validator();
reader.setErrorHandler(handler);
reader.setProperty("http://apache.org/xml/properties/schema/external-noNamespaceSchemaLocation"
,this.schemaUri);
reader.parse(this.instanceUri);
2005/5/3, Phil Weighill Smith <[EMAIL PROTECTED]>:
> Note that File#toURL() is "fragile" and you should go through the hoops
> described in the javadoc for this method instead...
>
> Phil :n.
>
> On Tue, 2005-05-03 at 10:04 -0400, Keith Suderman wrote:
> > At 03:06 PM 5/1/2005 +0200, Joern Muehlencord wrote:
> >
> > >Whats wrong? Any suggestions? Thanks alot!
> >
> > Change:
> > java.net.URL schemaURL = new java.net.URL("file://"+fileName);
> >
> >
> > To:
> > java.net.URL schemaURL = new java.net.URL("file:/" + fileName);
> >
> > and all should be fine.
> >
> > Also, a sure-fire way to create a URL for a file is to use:
> >
> > File file = new File(fileName);
> > URL schemaURL = file.toURL();
> >
> > Hope this helps,
> > Keith
> >
> >
> > --------------------------------------------------
> > Research Associate
> > American National Corpus
> > [EMAIL PROTECTED]
> > http://americannationalcorpus.org
> >
> >
> > ---------------------------------------------------------------------
> > 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]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]