I would like to validate an XML using XSD. It works fine if I have an XML and an XSD file. I use the validator of SAX like this example:
// creating a Validator instance
Validator validator = schema.newValidator();
// preparing the XML file as a SAX source
SAXSource source = new SAXSource(
new InputSource(new java.io.FileInputStream(xmlName)));
There is no problem with it. But now I have to create a program gets the XML not from a file but from a string. My customer uses ActiveMQ and sends the XML via it and I have to validate this XML using an XSD file. The input parameter of the validator is a filename.
Does somebody have an idea how to validate an XML in a string?
Thanks in advance.
NOTICE: developerWorks Community will be offline May 29-30, 2015 while we upgrade to the latest version of IBM Connections. For more information, read our upgrade FAQ.
This topic has been locked.
2 replies Latest Post - 2012-06-26T06:01:00Z by shalomjohn
Pinned topic Validating XML in a String
Answered question This question has been answered.
Unanswered question This question has not been answered yet.
Updated on 2012-06-26T06:01:00Z at 2012-06-26T06:01:00Z by shalomjohn
SystemAdmin 110000D4XK1830 Posts