Reputation: 13
I am trying to get data from the below XML.
<vehicle>
<id>vehicle</id>
<frame>
<material>plastic</material>
When I read the data from the frame tag, how do i get the value of frame tag.
Upvotes: 0
Views: 47
Reputation: 1571
You should fetch only the "Frame" tags using doc.getElementsByTagName("frame") and then print the value of their child "Material" tags.
Upvotes: 1
Reputation: 1100
frameList= doc.getElementsByTagName("material");
Should be
frameList= doc.getElementsByTagName("frame");
Upvotes: 0