Hi all,
I have a requirement to perform some validation on an incoming piece of XML using a group of schemas.
All these schemas share the same targetNamespace but are separated into different .xsd files.
My java program is loading each xsd file into an InputSource[] array and passing them into the SAX Parser (SCHEMA_SOURCE property). However, when calling the XMLReader.parse method, I get the following stack trace:
** java.lang.IllegalArgumentException: When using array of Objects as the value of SCHEMA_SOURCE property , no two Schemas should share the same targetNamespace. at org.apache.xerces.impl.xs.XMLSchemaLoader.processJAXPSchemaSource(Unknown Source) at org.apache.xerces.impl.xs.XMLSchemaLoader.loadSchema(Unknown Source) at org.apache.xerces.impl.xs.XMLSchemaValidator.findSchemaGrammar(Unknown Source) at org.apache.xerces.impl.xs.XMLSchemaValidator.handleStartElement(Unknown Source) at org.apache.xerces.impl.xs.XMLSchemaValidator.startElement(Unknown Source) at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source) at org.apache.xerces.impl.XMLNSDocumentScannerImpl$NSContentDispatcher.scanRootElementHook(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source) at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) at org.apache.xerces.parsers.XMLParser.parse(Unknown Source) at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source) **
I need to parse the XML using schemas that share a namespace. Is it possible to do this and avoid the above error?
Any form of help or advice will be appreciated
Thanks