Hi Filip, I've found the solution at http://www.edankert.com/validate.html#Validate_using_external_Schema_s.
Here the code: SAXParserFactory factory = SAXParserFactory.newInstance(); SchemaFactory schemaFactory = SchemaFactory.newInstance("http://www.w3.org/2001/XMLSchema"); factory.setSchema(schemaFactory.newSchema(new Source[] { new StreamSource(args[1]) })); SAXParser parser = factory.newSAXParser(); SAXReader reader = new SAXReader(parser.getXMLReader()); reader.setValidation(false); // add error handler which turns any errors into XML XMLErrorHandler errorHandler = new XMLErrorHandler(); reader.setErrorHandler(errorHandler); reader.read(args[0]); // output the errors XML XMLWriter writer = new XMLWriter(OutputFormat.createPrettyPrint()); if (errorHandler.getErrors().elements().size() != 0) { writer.write(errorHandler.getErrors()); System.exit(FAILURE); } System.exit(OK); Regards Patrizio -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Filip Jirsák Sent: lunedì, 7. luglio 2008 16:02 To: Ferlito Patrizio (B-Source - Lugano) Subject: Re: [dom4j-dev] error validating my document Look at http://xerces.apache.org/xerces2-j/ for Xerces configuration than - this is problem of SAX parser, not dom4j. There should be more information and samples ind Xerces documentation. It doesn't mean I do not want to help you, but I don't know how schema validation in Xerces works and how it may be configured. I believe you find more information in the Xerces documentation. Regards Filip 2008/7/7 <[EMAIL PROTECTED]>: > > Thanks Filip, but I get the same error: > > SAXReader reader = new SAXReader(true); > > reader.setProperty("http://apache.org/xml/properties/schema/external-schemaLocation", > args[1]); > ... > > <errors> > <error column="19" line="1" systemID="file:///C:/tmp/myxml.xml">Document is > invalid: no grammar found.</error> > <error column="19" line="1" systemID="file:///C:/tmp/myxml.xml">Document > root element "event-bus:runtime", must match DOCTYPE root "null".</error> > </errors> > > Regards > Patrizio > > > -----Original Message----- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Filip Jirsák > Sent: lunedì, 7. luglio 2008 15:36 > To: Ferlito Patrizio (B-Source - Lugano) > Subject: Re: [dom4j-dev] error validating my document > > > Hello, > probably you must use > "http://apache.org/xml/properties/schema/external-schemaLocation" > property (without "noNamespace") - you use > "http://www.bsource.ch/EventBus" namespace in your document. > > Regards > > Filip > > IMPORTANT: > This e-mail transmission is intended for the named > addressee(s)only. > Its contents are private, confidential and protected > from disclosure and should not be read, copied or > disclosed by any other person. > If you are not the intended recipient, we kindly ask > you to notify the sender immediately by telephone > (+41 (0)58 806 50 00), to redirect the message to the > account "[EMAIL PROTECTED]" and to delete this e-mail. > E-mail transmissions may be intercepted, altered or > read by unauthorized persons and may contain viruses. > Therefore, it is recommended that you use regular mail > or courier services for any information intended to be > confidential. However, by sending us messages through > e-mail, you authorize and instruct us to correspond by > e-mail in the relevant matter. > Thank you. > > -- Filip Jirsák [EMAIL PROTECTED] IMPORTANT: This e-mail transmission is intended for the named addressee(s)only. Its contents are private, confidential and protected from disclosure and should not be read, copied or disclosed by any other person. If you are not the intended recipient, we kindly ask you to notify the sender immediately by telephone (+41 (0)58 806 50 00), to redirect the message to the account "[EMAIL PROTECTED]" and to delete this e-mail. E-mail transmissions may be intercepted, altered or read by unauthorized persons and may contain viruses. Therefore, it is recommended that you use regular mail or courier services for any information intended to be confidential. However, by sending us messages through e-mail, you authorize and instruct us to correspond by e-mail in the relevant matter. Thank you. ------------------------------------------------------------------------- Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! Studies have shown that voting for your favorite open source project, along with a healthy diet, reduces your potential for chronic lameness and boredom. Vote Now at http://www.sourceforge.net/community/cca08 _______________________________________________ dom4j-dev mailing list dom4j-dev@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/dom4j-dev