Hi Thomas, The sample registers an ErrorHandler which prints every error reported to it to System.err; each line prefixed with "[Fatal Error]", "[Error]" or "[Warning]". If you grep for those you should catch every error / warning emitted by the parser. The regular output from the sample is written to System.out. You cannot suppress it unless you wrap your own program around it which redirects the output elsewhere. There's no command line switch for that.
Thanks. Michael Glavassevich XML Parser Development IBM Toronto Lab E-mail: [EMAIL PROTECTED] E-mail: [EMAIL PROTECTED] Thomas Porschberg <[EMAIL PROTECTED]> wrote on 11/02/2007 01:05:28 AM: > Hello Xercianer, > > I have to validate a XML file against a XSD and tried the java version > of xerces for this task. > I simply installed Xerces (2.8) and the sample-jar and called > > java sax.Writer -v -f -s foo.xml 1>/dev/null | grep Error > > I'm not interested in the output. Because I'm on Unix I redirect > the output to /dev/null and I grep stderr for "Error" to detect > all kind of errors. If the return code of grep is 0 then the XML file > is not valid. > > My questions: > 1. Is there a better java-xerces "tool" for doing that task > (something like xmllint in java) ? > (I missed the possibility to suppress the output via a command line > switch.) > 2. Is it reliable to grep for Error in stderr ? Are there situations there no > Error-line is printed but the XML is still corrupt ? > (The C++ version of Xerces comes with samples too and when I call > SAX2Print ... I'm able to detect validation/parse errors via > the return code > of the program. This seems not the case with the java version.) > > Best regards, > Thomas > > -- > http://www.randspringer.de > > --------------------------------------------------------------------- > 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]