Topic
2 replies Latest Post - ‏2012-06-26T06:01:00Z by shalomjohn
Vega_Laci
Vega_Laci
1 Post
ACCEPTED ANSWER

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 java.io.FileInputStream(xmlName)));
validator.validate(source);
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