IC4NOTICE: 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.
2 replies Latest Post - ‏2012-06-26T06:01:00Z by shalomjohn
1 Post

Pinned topic Validating XML in a String

‏2011-11-24T10:00:00Z |
Hi Guys,
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;
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.
Updated on 2012-06-26T06:01:00Z at 2012-06-26T06:01:00Z by shalomjohn