Thanks Marks, but I did not understand your response since I'm a beginner in Android.
On Thu, Jan 26, 2012 at 10:20 PM, Mark Murphy <[email protected]>wrote: > Your Android device does not have a C: drive. > > On Thu, Jan 26, 2012 at 2:14 PM, Mai Al-Ammar <[email protected]> > wrote: > > Thank you very much for your responding. > > > > This is one way which I tried with it but it did not return a result and > not > > throw an exception : > > > > try { > > > > DocumentBuilderFactory docBuilderFactory = > > DocumentBuilderFactory.newInstance(); > > DocumentBuilder docBuilder = > > docBuilderFactory.newDocumentBuilder(); > > Document doc = docBuilder.parse (new > > File("C:\\Users\\Mai\\workspace\\Test\\res\\xml\test.xml")); > > > > // normalize text representation > > doc.getDocumentElement ().normalize (); > > > > tv.setText( doc.getDocumentElement().getNodeName()); > > > > setContentView(tv); > > > > > > NodeList listOfPersons = doc.getElementsByTagName("person"); > > int totalPersons = listOfPersons.getLength(); > > System.out.println("Total no of people : " + totalPersons); > > > > for(int s=0; s<listOfPersons.getLength() ; s++){ > > > > > > Node firstPersonNode = listOfPersons.item(s); > > if(firstPersonNode.getNodeType() == Node.ELEMENT_NODE){ > > > > > > Element firstPersonElement = > (Element)firstPersonNode; > > > > //------- > > NodeList firstNameList = > > firstPersonElement.getElementsByTagName("first"); > > Element firstNameElement = > > (Element)firstNameList.item(0); > > > > NodeList textFNList = > firstNameElement.getChildNodes(); > > System.out.println("First Name : " + > > > > ((Node)textFNList.item(0)).getNodeValue().trim()); > > > > //------- > > NodeList lastNameList = > > firstPersonElement.getElementsByTagName("last"); > > Element lastNameElement = > (Element)lastNameList.item(0); > > > > NodeList textLNList = > lastNameElement.getChildNodes(); > > System.out.println("Last Name : " + > > > > ((Node)textLNList.item(0)).getNodeValue().trim()); > > > > //---- > > NodeList ageList = > > firstPersonElement.getElementsByTagName("age"); > > Element ageElement = (Element)ageList.item(0); > > > > NodeList textAgeList = ageElement.getChildNodes(); > > System.out.println("Age : " + > > > > ((Node)textAgeList.item(0)).getNodeValue().trim()); > > > > //------ > > > > */ > > // }//end of if clause > > > > > > // }//end of for loop with s var > > > > > > }catch (SAXParseException err) { > > System.out.println ("** Parsing error" + ", line " > > + err.getLineNumber () + ", uri " + err.getSystemId ()); > > System.out.println(" " + err.getMessage ()); > > > > }catch (SAXException e) { > > Exception x = e.getException (); > > ((x == null) ? e : x).printStackTrace (); > > > > }catch (Throwable t) { > > t.printStackTrace (); > > } > > > > and this is the xml file : > > <book> > > <person> > > <first>Kiran</first> > > <last>Pai</last> > > <age>22</age> > > </person> > > <person> > > <first>Bill</first> > > <last>Gates</last> > > <age>46</age> > > </person> > > <person> > > <first>Steve</first> > > <last>Jobs</last> > > <age>40</age> > > </person> > > </book> > > > > please help me, I really very tired with this problem :( :( > > > > > > On Thu, Jan 26, 2012 at 9:56 PM, TreKing <[email protected]> wrote: > >> > >> On Wed, Jan 25, 2012 at 12:05 PM, Mai Al-Ammar <[email protected]> > >> wrote: > >>> > >>> the R.java which is generated automatically did not refresh itself and > >>> put xml folder as for other folders. > >> > >> > >> Refresh or clean your project. > >> > >> > >> > ------------------------------------------------------------------------------------------------- > >> TreKing - Chicago transit tracking app for Android-powered devices > >> > >> -- > >> You received this message because you are subscribed to the Google > >> Groups "Android Developers" group. > >> To post to this group, send email to > [email protected] > >> To unsubscribe from this group, send email to > >> [email protected] > >> For more options, visit this group at > >> http://groups.google.com/group/android-developers?hl=en > > > > > > > > > > -- > > Mai A. Al-Ammar > > Teacher Assistant > > Imam Mohammad bin Saud Islamic University > > College of Computer Science > > > > -- > > You received this message because you are subscribed to the Google > > Groups "Android Developers" group. > > To post to this group, send email to [email protected] > > To unsubscribe from this group, send email to > > [email protected] > > For more options, visit this group at > > http://groups.google.com/group/android-developers?hl=en > > > > -- > Mark Murphy (a Commons Guy) > http://commonsware.com | http://github.com/commonsguy > http://commonsware.com/blog | http://twitter.com/commonsguy > > Android Training in DC: http://marakana.com/training/android/ > > -- > You received this message because you are subscribed to the Google > Groups "Android Developers" group. > To post to this group, send email to [email protected] > To unsubscribe from this group, send email to > [email protected] > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en > -- Mai A. Al-Ammar Teacher Assistant Imam Mohammad bin Saud Islamic University College of Computer Science -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

