Hi all, I have to write a module that parses very big XML files (>10MB) having always the same structure. I have written a schema and would like to validate these XML files with it... But of course, the XML files do not declare any schema (the root element is <order> instead of <order xmlns="mySchemaName" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="mySchemaName mySchemeURI">). I tried the validation API of JAXP (see the following piece of code), but it only works if I declare at least the schema name in the XML file (that is to say <tag xmlns="mySchemaName">) SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); Schema schema = schemaFactory.newSchema(new StreamSource(new File("myschema.xsd"))); schema.newValidator().validate(new StreamSource(new File("big.xml")));
I also tried ValidatorHandler, but I don't know how to add the xmlns attribute when I am parsing the root element. So, is there a way to : - force the validation against my schema without modifying the XML files (no declaration of scheme name and location) - validate and parse at the same time (I don't want to read the XML files twice) - use only SAX way (because of the XML file size) Thanks ! --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]