Are you using the correct flags with the dom.Counter program? Here's what my
XercVal.bat file looks like:
java dom.Counter -s -f -v %1
Code in Counter.java includes the following:
System.err.println(" -v | -V Turn on/off validation.");
System.err.println(" -s | -S Turn on/off Schema validation
support.");
System.err.println(" NOTE: Not supported by all
parsers.");
System.err.println(" -f | -F Turn on/off Schema full
checking.");
Mark Feblowitz
XML Architect
[t] 617.715.7231
[f] 617.495.0188
Frictionless Commerce Incorporated
[e] [EMAIL PROTECTED]
[w] http://www.frictionless.com
[m] 400 Technology Square, 9th Floor
Cambridge, MA 02139
Open Applications Group Incorporated
[e] [EMAIL PROTECTED]
[w] http://www.openapplications.org
-----Original Message-----
From: Naomi Dushay [mailto:[EMAIL PROTECTED]
Sent: Wednesday, June 19, 2002 2:47 PM
To: [EMAIL PROTECTED]
Subject: feature / enhancement request for schema validation
In the course of trying to test my schemas with Xerces 2.0.1 and JDK1.4 from
the command line, I had "some fun."
It may be that using Xerces from within a java program is not so difficult,
but it doesn't seem outrageous to desire schema validation or otherwise use
Xerces from the command line.
Here's my tale of woe:
(note: I reported the following to "bugzilla" and was told this was not a
bug, and to report it here. So I am doing that. However, I am getting off
this list, so please send any replies to me personally. This is basically a
"lack of features/documentation" report.)
I have a suite of XML schemas and I wanted to test if
a) my schemas were valid
b) my instance documents validated to these schemas
with Xerces 2.0.1.
I couldn't find documentation on how to do either a or b with Xerces 2.0.1
from the command line.
For b., a colleague advised me to use the sample program sax.Counter.
I thought it would be a simple matter to run sax.Counter from the command
line
to accomplish this. I set my path to include (in this order):
Xerces-2_0_1\xercesImpl.jar
Xerces-2_0_1\xmlParserAPIs.jar
j2sdk1.4.0\bin
I set my classpath to include:
Xerces-2_0_1\xercesSamples.jar
I used the command:
java sax.Counter -v -s -f (instance doc fname)
I got this output:
"error: Unable to instantiate parser (org.apache.xerces.parsers.SAXParser)"
This made no sense to me, as I could see that I had included the correct
files
in my path.
As a shot in the dark, I tried to run sax.Counter within JBuilder. I was
able
to set up a code library for Xerces-2_0_1\XercesImpl.jar I discovered that
I
needed a separate code library for Xerces-2_0_1\xmlParserAPIs.jar, and that
if
I included both of these and told JBuilder to use JDK 1.4 as the VM, and
then ran the command above, I got error messages :
[Error] oai-identifier.xsd:22:71: e-props-correct.2: Invalid value
constraint
value 'oai' in element 'scheme'.
[Error] oai-identifier.xsd:25:72: e-props-correct.2: Invalid value
constraint
value ':' in element 'delimiter'.
[Warning] testDBInsertColl.xml:24:16: schema_reference.4: Failed to read
schema
document 'null', because 1) could not find the document; 2) the document
could
not be read; 3) the root element of the document is not <xsd:schema>.
[Warning] testDBInsertColl.xml:39:46: schema_reference.4: Failed to read
schema
document 'null', because 1) could not find the document; 2) the document
could
not be read; 3) the root element of the document is not <xsd:schema>.
[Warning] testDBInsertColl.xml:58:16: schema_reference.4: Failed to read
schema
document 'null', because 1) could not find the document; 2) the document
could
not be read; 3) the root element of the document is not <xsd:schema>.
E:\NSDL\schemas\testDBInsertColl.xml: 2062 ms (70 elems, 18 attrs, 0 spaces,
3414 chars)
Okay, so now I'm running sax.Counter and plausibly doing some sort of schema
validation, because it's giving me errors on the oai-identifier.xsd schema.
Problems:
1. My instance document validates fine with my schema suite in XSV and in
topologi. (XMLSpy has a bug, duly reported). But Xerces is reporting a
problem with the oai-identifier schema. Which schema validator is correct?
How can I get more information on this error?
2. The error messages and warnings don't tell me very much at all. Which
schemas loaded?
Which schemas is it seeking? How can I better tell what's going on so I
can
debug my schemas and instance doc?
3. Why didn't I get this far from the command line?
I managed to answer this one. By some stroke of luck, I had a lead to look
at the
JAXP FAQ at http://java.sun.com/xml/jaxp/faq.html. And there's a question
in
that FAQ "How do I override the JAXP implementation in the JDK 1.4 and
above?"
which tells me I need to use the "-D" option with the java command. So if I
leave my path and classpath as indicated above, I can use the following
command:
java -Djava.endorsed.dirs=(Xerces-2_0_1_DIR) sax.Counter -v -s -f %1
to do schema validation on an instance document.
This seems like a very convoluted, obscure indication of how to use Xerces
2.0.1 with JDK1.4 for
schema validation from the command line.
These seem like pretty straightforward, desirable features.
Have I missed the appropriate documentation?
- how to check if schemas are valid (still have no known way to do this)
- how to check instance documents against schemas
- how to get good error reporting on schema validation.
Thanks for any helpful insights, steers to documentation, or acknowledgement
that these are desirable, yet missing features (and might be addressed in
the next Xerces release).
(Note: I have already sent my instance doc and schemas to the folks at
bugzilla to address my problem number 1 above.)
- Naomi Dushay
Cornell University Computer Science
---------------------------------------------------------------------
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]