• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Getting all child element from root element

 
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


Hi , that's my code above. How do I get all following elements from an XML document ?

I use the below codes to test...



My xml I am parsing is this below...



And the output when running the test is...


How could nodes length be 0 when there's so many nodes in the xml documents as you can see ?

If you noticed, I didn't put to class and full codes since it's going to make this post very long so I only post the imports and the essential codes so that anyone can get an idea what I am trying to do.
 
Ranch Hand
Posts: 874
Android VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Tay,



Why do you want to get NodeList here. getDocumentElement() returns Element(which implements Node) . Typically you get Node first and get child Nodes from it. This is right way to use.




 
Tay Thotheolh
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the help
 
reply
    Bookmark Topic Watch Topic
  • New Topic