I am validating an XML doc in Java with Xerces, but don't get any errors. However, the XML doc contains errors and when I validate it with for example XMLSply editor, the errors are correctly reported. I can't find what I am doing wrong. I think I do include all XSD schemas that are required to validate correctly.
Please some advice? The code snippet: ----- SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); factory.setErrorHandler(new ErrorHandlerDefault()); Schema schema = factory.newSchema(createSchemaSources()); validator = schema.newValidator().validate("file.xml"; ---- The XSD's that I use to validate: --------- private Source[] createSchemaSources() throws IOException { Source[] sources = new Source[5]; sources[0] = createSource("http://www.nltaxonomie.nl/7.0/domein/bd/tuples/bd-bedr-tuples. xsd"); sources[1] = createSource("http://www.nltaxonomie.nl/7.0/domein/bd/tuples/bd-bedr-tuples. xsd"); sources[2] = createSource("http://www.nltaxonomie.nl/7.0/domein/bd/tuples/bd-burg-tuples. xsd"); sources[3] = createSource("http://www.nltaxonomie.nl/7.0/basis/sbr/types/nl-types.xsd"); sources[4] = createSource("http://www.xbrl.org/2003/xbrl-instance-2003-12-31.xsd"); return sources; } ---------- A small snippet of the xml file being validated (too big to list all): --------- <bd-burgers:CommutingExpensesDaysPerWeekCount unitRef="uu_513" contextRef="cc_711">2</bd-burgers:CommutingExpensesDaysPerWeekCount> ---------- This entry contains an error, namely: Numeric item <bd-burgers:CommutingExpensesDaysPerWeekCount> has neither a 'precision' nor a 'decimals' attribute. This is correctly reported by XMLSpy but not by my Java code :(... So what am I doing wrong here? I though I was forgetting an XSD file, but "CommutingExpensesDaysPerWeekCount" is defined in "http://www.nltaxonomie.nl/7.0/basis/bd/items/bd-burgers.xsd", that is contained int he above xsd's, that corresponds to the type "nonNegativeIntegerItemType" contained in "http://www.nltaxonomie.nl/7.0/basis/sbr/types/nl-types.xsd", also contained in the xsd's above, and that extends "monetaryItemType" and is defined in "http://www.xbrl.org/2003/xbrl-instance-2003-12-31.xsd", which xsd is also contained in the above validation. Any idea why my Java validation not reports any errors? BTW: it does report an error if I change the above XML snippet in: ----- <bd-burgers:CommutingExpensesAccordingToTableTotalAmount>841.0</bd-burgers:C ommutingExpensesAccordingToTableTotalAmount> ---- That is: removing all attributes. I then get a correct Validation error saying that the contextRef is missing. - Ed --------------------------------------------------------------------- To unsubscribe, e-mail: j-users-unsubscr...@xerces.apache.org For additional commands, e-mail: j-users-h...@xerces.apache.org