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.