This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes XML and Related Technologies and the fly likes Unable to create child elements.... XMl Parsing... Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Reply Bookmark "Unable to create child elements.... XMl Parsing..." Watch "Unable to create child elements.... XMl Parsing..." New topic
Author

Unable to create child elements.... XMl Parsing...

Jigar Naik
Ranch Hand

Joined: Dec 12, 2006
Posts: 744
hi folloing is the structure of my XML file

XML file : bofore adding child node to root node.



Method to add child node to a parent node



ERROR I'm getting :



Jigar Naik


Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 35252
    
    7
getElementsByTagName returns a NodeList, not an Element. I'm curious how that code can even compile.

If you're certain that the list only contains a single element, then something like

Element element = (Element) doc.getElementsByTagName("blog").item(0);


Android appsImageJ pluginsJava web charts
Jigar Naik
Ranch Hand

Joined: Dec 12, 2006
Posts: 744
ya i did that and its working fine...



Thanks....
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: Unable to create child elements.... XMl Parsing...
 
Similar Threads
Unable to get the correct data from the XML file
Unable to create child elements.... XMl Parsing...
Java beginner- trying a DOM parser
dom problem
JRE 1.4.2 to 1.5 Migration issue in XML