I am using xstream to parse xml to objects. the result from
xstream.fromXML(xmlFile);
is an object.
Since i have mutiple xml-schemas, this object could be cast to multipe definition classes. Is there a way to check if this object is castable to one these classes so I know which format the xml follows?
You can check with instanceof
like in normal Java.
Object obj = xstream.fromXML(xmlFile);
if (obj instanceof MyClass)
MyClass myObj = (MyClass)obj;