CycleGyncgany
New Member
I am trying to read an xml file from android application but xml file is being generated from php instantly (so the file is .php)When i am asking on that url from java i get this error : Expected file scheme in URI : "http://someserver.com/foo/bar/Myuri.php"\[code\]try { File file = new File(new URI("http://someserver.com/foo/bar/Myuri.php")); DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); DocumentBuilder db = dbf.newDocumentBuilder(); Document doc = db.parse(file); doc.getDocumentElement().normalize(); System.out.println("Root element " + doc.getDocumentElement().getNodeName()); NodeList nodeLst = doc.getElementsByTagName("employee"); //System.out.println("Information of all employees"); for (int s = 0; s < nodeLst.getLength(); s++) { Node fstNode = nodeLst.item(s); if (fstNode.getNodeType() == Node.ELEMENT_NODE) { Element fstElmnt = (Element) fstNode; NodeList fstNmElmntLst = fstElmnt.getElementsByTagName("name"); Element fstNmElmnt = (Element) fstNmElmntLst.item(0); NodeList fstNm = fstNmElmnt.getChildNodes(); System.out.println("Name : " + ((Node) fstNm.item(0)).getNodeValue()); NodeList lstNmElmntLst = fstElmnt.getElementsByTagName("lastname"); Element lstNmElmnt = (Element) lstNmElmntLst.item(0); NodeList lstNm = lstNmElmnt.getChildNodes(); System.out.println("Last Name : " + ((Node) lstNm.item(0)).getNodeValue()); } } } catch (Exception e) { alertDialog.setMessage(e.getMessage()); alertDialog.show(); }\[/code\]