Sunday, June 2, 2024
 Popular · Latest · Hot · Upcoming
42
rated 0 times [  43] [ 1]  / answers: 1 / hits: 18533  / 8 Years ago, sun, january 22, 2017, 12:00:00

I'm having XML file I want to read and modify XML data using JavaScript, this is my XML data:



<?xml version=1.0 encoding=utf-8 standalone=yes?>
<figlist>
<figgroup name=Circuit Diagram>
<category id=A>
<name>A GENERAL INFORMATION</name>
<subcategory name=GI GENERAL INFORMATION>
<fig id=jtawa5397gb>
<name>CONSULT CHECKING SYSTEM</name>
<svgfile>jtawa5397gb.svg</svgfile>
</fig>
</subcategory>
</category >


In this XML data CONSULT CHECKING SYSTEM I want to modify what ever contents inside tag by reading csv file data



For example in CSV file data it will have



CONSULT CHECKING SYSTEM CONSULTAR EL SISTEMA DE CONTROL



like this contents inside the tag it should change according Csv file data, I need to your help to modify this content through JavaScript. Can anybody help me



with regards,
yuvaraj


More From » xml

 Answers
38

If you are using the JavaScript environment of a modern web browser, you can manipulate XML data as I explained here: Create XML in Javascript



If not, I recommend to use another XML DOM implementation for JavaScript, for example xmldom.



Let's suppose, xmlDoc is your XML document as an XML DOM object. To change the text CONSULT CHECKING SYSTEM to CONSULT CHECKING SYSTEM CONSULTAR EL SISTEMA DE CONTROL, you could retrieve the element node like this:



var name = xmlDoc.getElementsByTagName(name)[1];


and change the content like this:



name.textContent = CONSULT CHECKING SYSTEM CONSULTAR EL SISTEMA DE CONTROL;

[#59253] Friday, January 20, 2017, 8 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
daquanmilesw

Total Points: 57
Total Questions: 102
Total Answers: 110

Location: Wallis and Futuna
Member since Sat, Aug 6, 2022
2 Years ago
daquanmilesw questions
;