Wednesday 15 April 2015

How to check if XML Data is valid for java XMLDecoder -



How to check if XML Data is valid for java XMLDecoder -

we serializing , deserializing info java xmlencoder , xmldecoder. can read object in illustration provided in javadoc of xmldecoder:

xmldecoder d = new xmldecoder(new bufferedinputstream(new fileinputstream("test.xml"))); object result = d.readobject(); d.close();

readobject parses input , returns object, if there one. if not throw arrayindexoutofboundsexception.

i wondering if there way validate contents provided xmldecoder (in illustration above file content of "test.xml") in advance xmldecoder can work it. (i aware set there setexceptionhandler method, handler called during parsing, done when calling readobject). or there "xmlencoder" dtd or xsd of sort?

java xml xml-serialization

No comments:

Post a Comment