Ciao a tutti,
dopo essere passata da Java 5 a Java 6 ho un problema nella validazione dei file XML.
Un file non valido che genera una SAXException con Java 5, in Java 6 non genera alcun tipo di eccezione.
Qualche suggerimento?codice:SchemaFactory schemaFactory = SchemaFactory.newInstance(schemaLang); try { java.io.File xmlSchema = new java.io.File(pathXSD); Schema schema; schema = schemaFactory.newSchema(new StreamSource(xmlSchema)); SAXParserFactory factory = SAXParserFactory.newInstance(); factory.setNamespaceAware(true); factory.setValidating(false); factory.setXIncludeAware(true); factory.setSchema(schema); SAXParser parser = factory.newSAXParser(); XMLReader reader = parser.getXMLReader(); reader.parse(new InputSource(new FileReader(pathXML))); } catch (ParserConfigurationException pce) { ... } catch (IOException io) { ... } catch (SAXException se) { se.printStackTrace(); }

Rispondi quotando

