<?xml version=1.0 encoding=UTF-8 standalone=yes?> <NewDataSet> <WHDS> <WHBILL> <TrnDate>14-Oct-2014</TrnDate> <FromDate>01-Oct-2014</FromDate> <ToDate>31-Oct-2014</ToDate> <Location>Gujarat</Location> <ClientCode>1001</ClientCode> <ClientName>abc</ClientName> <WarehouseCode>g001</WarehouseCode> <WarehouseName>g1</WarehouseName> <ServiceTaxApplicable>y</ServiceTaxApplicable> <RefVouchNo>1</RefVouchNo> <StorageCharges>2000</StorageCharges> </WHBILL> </WHDS> </NewDataSet>
String xmlString; Document doc=getDomElement(xmlString); public Document getDomElement(String xml) { Document doc = null; DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); try { DocumentBuilder db = dbf.newDocumentBuilder(); InputSource is = new InputSource(); is.setCharacterStream(new StringReader(xml)); doc = db.parse(is); } 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)