How to create Elements and Attributes using ElementImpl
Shoba Ramachandran
Ranch Hand
Joined: Mar 29, 2001
Posts: 68
posted
0
Hi, I have a basic XML template.I read this template and want to add elements to it. Here is what I did... Document xmlDoc = parser.parse("Tree.xml"); Element ele = xmlDoc.createElement("Element1"); ele.setAttributes("Attribute1", "Value1"); ..... It is not throwing any exception, but if I traverse the nodes I can't see the elements and attributes that I have added. I greatly appreciate any help. Thanks.
SAFROLE YUTANI
Ranch Hand
Joined: Jul 06, 2001
Posts: 257
posted
0
You created the Element, yes, but you forgot to add it to your document. Add an element to any Node by calling appendChild( Node) and pass the element that you wish to add as the argument. SAF
Shoba Ramachandran
Ranch Hand
Joined: Mar 29, 2001
Posts: 68
posted
0
SAF, Thanks...I just found out this. Thanks for your reply... -shoba
subject: How to create Elements and Attributes using ElementImpl