Two Laptop Bag*
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 | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
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: 751
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: 39549
    
  27
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);


Ping & DNS - updated with new look and Ping home screen widget
Jigar Naik
Ranch Hand

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



Thanks....
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Unable to create child elements.... XMl Parsing...
 
Similar Threads
Unable to create child elements.... XMl Parsing...
JRE 1.4.2 to 1.5 Migration issue in XML
Unable to get the correct data from the XML file
dom problem
Java beginner- trying a DOM parser