File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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: 755
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: 41524
    
  53
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 - my free Android networking tools app
Jigar Naik
Ranch Hand

Joined: Dec 12, 2006
Posts: 755
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...