Description
I am trying to validate an xml file whose root node is unknown. So I am using the following code to parse and validate but validation fails.
XMLObject xmlObject = XmlObject.Factory.parse(new FileReader(file));
boolean isValid = xmlObject.validate(); //isValid becomes false eventhough file is valid
When I looked at closely, I notice xmlObject is not pointing to the root document object (In my case ReturnDataDocument since ReturnData is the root node of xml) but pointing to XmlAnyTypeImpl.
When I use the specific object , it works.
ReturnDataDocument xmlObject = ReturnDataDocument .Factory.parse(new FileReader(file));
boolean isValid = xmlObject.validate(); //isValid is true