Last active
January 10, 2018 16:55
-
-
Save ricston-git/8581121 to your computer and use it in GitHub Desktop.
Mule Schema Validator
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.ricston.xml; | |
import java.io.IOException; | |
import java.io.InputStream; | |
import org.apache.xerces.dom.DOMInputImpl; | |
import org.mule.util.IOUtils; | |
import org.w3c.dom.ls.LSInput; | |
import org.w3c.dom.ls.LSResourceResolver; | |
public class ClasspathResourceResolver implements LSResourceResolver { | |
@Override | |
public LSInput resolveResource(String type, String namespaceURI, String publicId, String systemId, String baseURI) { | |
try { | |
InputStream resource = IOUtils.getResourceAsStream(systemId, getClass()); | |
return new DOMInputImpl(publicId, systemId, baseURI, resource, null); | |
} catch (IOException e) { | |
e.printStackTrace(); | |
return null; | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
log4j.logger.org.mule.module.xml.filters.SchemaValidationFilter=DEBUG |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<spring:bean id="classpathResourceResolver" name="classpathResourceResolver" class="com.ricston.xml.ClasspathResourceResolver"/> | |
<mulexml:schema-validation-filter schemaLocations="${app.home}/classes/MyXsd1_v2.1.0.xsd,${app.home}/classes/xsd/MyXsd2_v1.2.0.xsd" returnResult="true" resourceResolver-ref="classpathResourceResolver"/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<mulexml:schema-validation-filter schemaLocations="${app.home}/classes/MyXsd1_v2.1.0.xsd,${app.home}/classes/xsd/MyXsd2_v1.2.0.xsd" returnResult="true"/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'schemaValidator': Invocation of init method failed; nested exception is org.mule.api.lifecycle.InitialisationException: src-resolve: Cannot resolve the name 'xxxyyy' to a(n) 'type definition' component. | |
... | |
Caused by: org.mule.api.lifecycle.InitialisationException: src-resolve: Cannot resolve the name 'xxxyyy' to a(n) 'type definition' component. | |
... | |
Caused by: org.xml.sax.SAXParseException: src-resolve: Cannot resolve the name 'xxxyyy' to a(n) 'type definition' component. | |
... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Kindly let me know what should i change in that Java Class to meet my requirement like baseURI SystyemID etc