public Document getDomElement(String xml) { Document doc = null; DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); try { DocumentBuilder db = dbf.newDocumentBuilder(); InputSource is = new InputSource(); is.setEncoding("ISO-8859-1"); //UTF-8 or 16 is.setCharacterStream(new StringReader(xml)); doc = db.parse(is); //doc = db.parse(new ByteArrayInputStream(xml.getBytes())); } catch (ParserConfigurationException e) { Log.e("Error: ", e.getMessage()); return null; } catch (SAXException e) { Log.e("Error: ", e.getMessage()); return null; } catch (IOException e) { Log.e("Error: ", e.getMessage()); return null; } return doc; }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)