Share on Google+Share on Google+

kumar
dynamically how to change attiribute values in xml
1 Answer(s)      4 years and 6 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.

Ads

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:
dynamically how to change attiribute values in xml
dynamically how to change attiribute values 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
change xml dynamically
change xml dynamically  How to change an XML dynamically in Java
Advertisements
How to change the checkbox value dynamically.
How to change the checkbox value dynamically.  Hi, I am using struts 1.2 checkbox tag. Requirement is on page load the value must be "true"(checked). And after loading the page i am uncheking the check box and again loading
How to change the data in the table dynamically ?
How to change the data in the table dynamically ?  This is my code. I... then the data displayed in the table below should get sorted dynamically in this jsp page... datastore = DatastoreServiceFactory.getDatastoreService(); Query q = new Query
Java-Change Xml values - Java Beginners
Java-Change Xml values   test_final_1 2009-025T13:23:45 B2B I have the following xml.. I want to change the values of , and .. Can any one please tel me the code to update the values for the tags metioned above
how to validate values in the dynamically created textboxes?
how to validate values in the dynamically created textboxes?  how to validate values in the dynamically created textboxes in HTML using javascript? Here s my code. Anyone plz help me. Thanks in advance. <!DOCTYPE html PUBLIC
UITextView Change Height dynamically
UITextView Change Height dynamically  dynamically expand the height of UITextView.   - (void) textViewDidEndEditing:(UITextView *)textView { CGRect frame = mTextView.frame; frame.size.height
how to get the values from dynamically generated textbox in java?
how to get the values from dynamically generated textbox in java?  I... as per the retrieved data) and I want to store textbox values into the two table... to get and update this textbox values into both the tables(Xray,CTScan
Create XMl dynamically - XML
Create XMl dynamically  Hi I am retreiving the list from database which i need to display in an XML file with some nodes How can I do
how to read values from java in xml?
how to read values from java in xml?  how to read values from java in xml
How to store extracted values from xml in a database? - XML
How to store extracted values from xml in a database?  I want to store extracted xml values in a database... How can i store extacted xml values in a database... give me a example
How to store extracted values from xml in a database? - XML
How to store extracted values from xml in a database?  I want to store extracted xml values in a database... How can i store extacted xml values in a database... give me a example
How to values from xml using java?
How to values from xml using java?  Hi All, I want to read value from following < Line> xml using java.. In < Line>,data is in format of key and value pair.. i want to read only values..could u plz help me
How to change the dropdown values based on other dropdown in itext pdf or in any other?
How to change the dropdown values based on other dropdown in itext pdf or in any other?  How to change the drop down values based on another drop..... please provide some suggestions how to do this.. thanks in advance
Atomic values in Xml
Atomic values in Xml  Hi..... please give me the ans How you define atomic values in Xml? Thanks
How to parse the attributes values from XML using KXML parser in j2me
How to parse the attributes values from XML using KXML parser in j2me  hai team, i did xml parsing from serverside...i got a resultant value from xml,but here tag value name only came from parsing attribute name cant come
Store values of dynamically generated textboxes into database
Store values of dynamically generated textboxes into database   I'm trying to create a form where the user gives number to generate textboxes. when for example the user enters 3 into textbox, three text boxes get generated
retrieving values from dynamically added textboxes in jsp - JSP-Servlet
retrieving values from dynamically added textboxes in jsp  hai friends, iam new to this site ,please help me in this senario in jsp how to retrieve values from dynamically added textbox like we can see in naukri.com
Reflecting changes in xml files included in jsp page dynamically...
change my data (xml files) dynamically through "service.java" file it does...Reflecting changes in xml files included in jsp page dynamically...  ... way that I can change my xml file and that will be reflected in jsp(next time
Reflecting changes in xml files included in jsp page dynamically...
change my data (xml files) dynamically through "service.java" file it does...Reflecting changes in xml files included in jsp page dynamically...  .... Is there any way that I can change my xml file and that will be reflected in jsp(next time
How to change background, change background
How to change background       This example will teach you to change background of any object... a picture to change background. Selection: Make selection by the Magic wand tool
Can anybody help how to store values to the following xml from .NET application
Can anybody help how to store values to the following xml from .NET application  Can anybody help how to store values to the following xml from .NET application <SQLSchema> <Databases>
change database values when click next button on jsp page
change database values when click next button on jsp page  How to retrive database values rondomly and display jsp page ,when user click next and previous bottons change the values on jsp page
How to change the face, change the face
How to change the face       You have a chance to learn how to change the face of the person to another face. It has very simple technique to make this effect
Need to retain the values on submiting the form - XML
Need to retain the values on submiting the form  I have created the form using XML and XSL, with textbox,checkbox,textarea and two button submit and RESET. how to retain the values in the same page on clicking submit
Dynamically display values in dropdown box and then show the selected values as selected by the user which is already stored in the DB
Dynamically display values in dropdown box and then show the selected values.... so if I have 5 values in the dropdown this selected one is added as 6th values... selected values directly from the Database and not adding to it as an extra one
Dynamically display values in dropdown box and then show the selected values as selected by the user which is already stored in the DB
Dynamically display values in dropdown box and then show the selected values..., This is for Updating. I had two SQL queries one for only selected values the user has choosen before and the second SQL query to show all the values. Iwas
how to display selected checkboxes dynamically using jsp
how to display selected checkboxes dynamically using jsp  Hi friends i have a requirement that : in my JSP page i have radio buttons followed by the DB fields..when i click SUBMIT button,if the field(or record
how to write in xml? - XML
how to write in xml?  can anybody give the code how to write in xml...(new InputStreamReader(System.in)); System.out.print("Enter XML file name...().newTransformer(); // Output Types (text/xml/html
how to change color of titlebar in java
how to change color of titlebar in java  pls help
How to display gridview details to labels dynamically?
How to display gridview details to labels dynamically?  I am using SQLDataSource to connect to MySQL. I have a gridview that retrieves information from MySQL database based on a selected id(dropdownlist). I need to display
Tutorials   
Java Spring Hibernate Struts Training were to start with xml, XSD and java write a program that Implement an integrated COM client server to add two numbers.by visuall studio 2010 Building a Parent Child relationship XML how i connect two page xml question struts cfg file for DispatchAction with mysql db Creating custom output using XMLUnit - MatchTracker duplicates the output data Related to XML Related to XML Reading child of child nodes in xml Reading multiple xml files Spliting Large XML and one by one Moved to Output Folder XMl and Java web services project download xml file from website using java code Download how to create an xml file in following clear format Conditional increment in xslt Conditional increment in xslt Conditional increment in xslt HOW TO STORE MULTIPLE EMPLOYEE DETAILS TO XML FILE USING JSP? xml and servlets xml and servlets Question about parsing XML document with DOM in JAVA. Removal of XML header Converting PHP page with flash to JSP page without flash saving data in xml Doubt about Xstream Converter Reading xml file using dom parser in java with out using getelementby tag name xml dynamically how to change attiribute values in xml XML Schema xml xml sax parser for xml parsing xml using sax xml to html via java i want java code for this xml file...please show me.. SAX Parser for huge XML file xml parsing "opening video data error" in j2me XML to JSP mapview1 mapview searchbar searchbar jsonparsing xmlparsing retrieve multiple attribute values retrieve multiple attribute values

Ads

 
Advertisement null

Ads