Posted By:
Lasse_Koskela
Posted On:
Tuesday, October 22, 2002 04:01 AM
If the generated document contains a DTD/schema reference ("this document obeys this and this DDT"), you could just parse it with a SAX parser with validation enabled. If the document doesn't conform to the DTD/schema it claims, an exception is thrown.
However, if the document doesn't define a DTD/schema reference and you should validate it against some specific DTD/schema, I'm not sure how it could be done.
But I have a hunch... You could write some kind of InputStream wrapper class and tweak the read() method(s) so that it first reads the contents of a String given upon instantiation (constructor parameter) and only then starts reading from some underlying InputStream pointing to the XML file. If you can get this to work, then you can apply the previous parsing approach.