Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa XML dynamically how to change attiribute values in xml

Have Programming Question? Ask it here!
 
 
 


kumar
dynamically how to change attiribute values in xml
1 Answer(s)      a year and 11 months ago
Posted in : XML


Hi, I am facing the problem to update the Attribute values in XML file.dynamically how to change attribute values in XML . for example below is my XML structure.

text-box 5

I want to change 5 .Default value from '5' to other values dynamically like 1 or 2 or 3 .

Any one please help me resolve the issue.It is very urgent for me.


Advertisement
View Answers

June 7, 2013 at 3:31 PM


hi friend,

Use the following code snippet, may this will be helpful for you.

Node tag = doc.getElementsByTagName("tagName").item(0);
NamedNodeMap tagAttr = tag.getAttributes();
Node nodeAttr = tagAttr.getNamedItem("id");
nodeAttr.setTextContent("3");

Thanks.



Related Tutorials/Questions & Answers:
 

 

 

DMCA.com