Hi Vijay Without a stack trace of the exception I can't be absolutely certain but I suspect the problem is either
a) you don't have a recent xerces.jar on your classpath; support for XML Schema is fairly recent, so version 1.4.2 or later should do. Might as well try the latest version available. b) you have a version of crimson.jar in your classpath, in front of xerces.jar. To tell whether its a) or b), the stack trace should help - if the not recognised exception comes from org.apache.crimson package then its b) else its probably a). James ----- Original Message ----- From: "vijay" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Monday, October 15, 2001 6:22 PM Subject: want ur help > Dear Sir, > > > I am getting the exception > > org.xm..sax.SAXNotRecognizedException : Property: > http://apache.org/xml/properties/schema/external-noNamespaceSchemaLoaction' > > during the execution of a java code that vaildates an xml file against a > schema using dom4j. > > Pls help me out from this problem. > Here i am also pasting the source code.. > > > import AbstractDemo; > > import org.dom4j.Document; > import org.dom4j.Element; > import org.dom4j.io.OutputFormat; > import org.dom4j.io.SAXReader; > import org.dom4j.io.XMLWriter; > import org.dom4j.util.XMLErrorHandler; > > import org.xml.sax.ErrorHandler; > import org.xml.sax.SAXParseException; > > /** Validates a document using Xerces and an XML Schema. > */ > > public class XercesDemo extends AbstractDemo { > > public static void main(String[] args) { > run( new XercesDemo(), args ); > } > > public XercesDemo() { > } > > public void run(String[] args) throws Exception { > if ( args.length < 1) { > printUsage( "no XML document URL specified" ); > return; > } > > parse( args[0] ); > } > > protected Document parse(String uri) throws Exception { > SAXReader reader = new SAXReader(); > > reader.setValidation(true); > > // specify the schema to use > reader.setProperty( > > "http://apache.org/xml/properties/schema/external-noNamespaceSchemaLocation" > , "personal.xsd"); > > // add an error handler which turns any errors into XML > XMLErrorHandler errorHandler = new XMLErrorHandler(); > reader.setErrorHandler( errorHandler ); > > // now lets parse the document > Document document = reader.read(uri); > > // now lets output the errors as XML > XMLWriter writer = new XMLWriter( > OutputFormat.createPrettyPrint() ); > writer.write( errorHandler.getErrors() ); > > return document; > } > } > > > Waitnig for response. > > > Vijay Gupta _________________________________________________________ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com _______________________________________________ dom4j-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/dom4j-user
