private Document getDocument(InputStream input) throws IOException {
try {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder;
builder = factory.newDocumentBuilder();
return builder.parse(input);
}
catch (ParserConfigurationException e) {
throw new IOException("Error instantiation XML parser:" + e.getMessage());
}
catch (SAXException e) {
throw new IOException("Error parsing user data:" + e.getMessage());
}
}
|