Reputation: 21
I have validation sequence that will validate incoming XML message using defined XSD. I have
used local registry to specify file location of the main XSD file (TP.xsd). TP.xsd definition is
importing another XSD (CORE.xsd) located on the same physical location. So when I try to test the
code, the first message failed to validate because data element definition was not found which is
located in CORE.xsd even the defintion exists. But on the succeeding incoming message, the message
get validated against the schema with no 'data element defintion not found' error. Can have someone
provide me how XSD has been loaded in ws02 esb? Is this being cached?
This is the error thrown in ws02 server logs:
2013-01-15 18:53:39,922 [-] [HttpServerWorker-6] ERROR ValidateMediator Error creating a new schema objects for schemas : [TPXSD-KEY]
org.xml.sax.SAXParseException: src-resolve: Cannot resolve the name 'DateTimeType' to a(n) 'type definition' component.
at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
at org.apache.xerces.util.ErrorHandlerWrapper.error(Unknown Source)
at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
at org.apache.xerces.impl.xs.traversers.XSDHandler.reportSchemaError(Unknown Source)
at org.apache.xerces.impl.xs.traversers.XSDHandler.getGlobalDecl(Unknown Source)
at org.apache.xerces.impl.xs.traversers.XSDElementTraverser.traverseNamedElement(Unknown Source)
at org.apache.xerces.impl.xs.traversers.XSDElementTraverser.traverseGlobal(Unknown Source)
at org.apache.xerces.impl.xs.traversers.XSDHandler.traverseSchemas(Unknown Source)
at org.apache.xerces.impl.xs.traversers.XSDHandler.parseSchema(Unknown Source)
at org.apache.xerces.impl.xs.XMLSchemaLoader.loadSchema(Unknown Source)
at org.apache.xerces.impl.xs.XMLSchemaLoader.loadGrammar(Unknown Source)
at org.apache.xerces.impl.xs.XMLSchemaLoader.loadGrammar(Unknown Source)
at org.apache.xerces.jaxp.validation.XMLSchemaFactory.newSchema(Unknown Source)
Snippet of Core.xsd file:
<xsd:complexType name="DateTimeType">
<xs:sequence>
<xs:element ref="Year"/>
<xs:element ref="Month"/>
<xs:element ref="Day"/>
<xs:element ref="Hour" minOccurs="0"/>
<xs:element ref="Minute" minOccurs="0"/>
<xs:element ref="Second" minOccurs="0"/>
<xs:element ref="Fraction" minOccurs="0"/>
<xs:element ref="TimeZone" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
Upvotes: 2
Views: 268
Reputation: 9692
You have to edit your main XSD, point your import schema's location. That is, you have to correctly give the registry path of your second schema's to the first main schema. Then only, when message hits the sequence, it can resolve the schema.
Upvotes: 1