public boolean isValid(String xmlFilePath) throws FileNotFoundException {
FileInputStream in = new FileInputStream(xmlFilePath);
try {
XMLInputFactory factory = XMLInputFactory.newInstance();
XMLStreamReader staxXmlReader = factory.createXMLStreamReader(in);
while(staxXmlReader.next() != XMLStreamConstants.END_DOCUMENT) {}
return true;
} catch (XMLStreamException e) {
e.printStackTrace();
return false;
}
} |
public boolean isValid(String xmlFilePath) throws FileNotFoundException {
FileInputStream in = new FileInputStream(xmlFilePath);
try {
XMLInputFactory factory = XMLInputFactory.newInstance();
XMLStreamReader staxXmlReader = factory.createXMLStreamReader(in);
while(staxXmlReader.next() != XMLStreamConstants.END_DOCUMENT) {}
return true;
} catch (XMLStreamException e) {
e.printStackTrace();
return false;
}
}