Error in Forming DOM element from XML parsed String

BRUIMIPIEMITS

New Member
I am trying to get the \[code\]DOM\[/code\] element from a \[code\]UTF-8\[/code\] Encoded XML parsed file containing arabic characters. The below method take the parsed xml string and is supposed to return the Document.here is a link to the xml:\[code\]http://212.12.165.44:7201/UniNews121.xml\[/code\]\[code\]public Document getDomElement(String xml){ Document doc = null; DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); try { DocumentBuilder db = dbf.newDocumentBuilder(); InputSource is = new InputSource(); StringReader xmlstring=new StringReader(xml); is.setCharacterStream(xmlstring); is.setEncoding("UTF-8"); //APP CRASHES HERE 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 DOM return doc;}\[/code\]Error:\[code\]09-18 13:36:20.031: E/Error:(3846): Unexpected token (position:TEXT xml version="1.0...@2:1 in java.io.InputStreamReader@4144ac08)\[/code\]I would appreciate your help but please be specific in your answers
 
Back
Top