This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara 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 | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
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: 41630
    
  55
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....
 
jQuery in Action, 2nd edition
 
subject: Unable to create child elements.... XMl Parsing...