public static Document getDocument(String data)
{
DocumentBuilderFactory
factory = DocumentBuilderFactory.newInstance();
DocumentBuilder
builder = null;
try {
builder =
factory.newDocumentBuilder();
} catch (ParserConfigurationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Document
document = null;
try {
document =
builder.parse(new
ByteArrayInputStream(data.getBytes("UTF-8")));
} catch (SAXException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
document.getDocumentElement().normalize();
return document;
}
No comments:
Post a Comment