admin管理员组文章数量:1277372
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.
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.
Share Improve this question edited Dec 1, 2023 at 18:43 nullromo 2,6473 gold badges23 silver badges50 bronze badges asked Jan 22, 2017 at 4:45 yuvarajyuvaraj 951 gold badge3 silver badges9 bronze badges 1- 1 Possible duplicate of Cross-Browser Javascript XML Parsing – luiscrjr Commented Jan 22, 2017 at 5:04
1 Answer
Reset to default 6If 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 remend 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";
本文标签: Read and modify XML data using JavaScriptStack Overflow
版权声明:本文标题:Read and modify XML data using JavaScript - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741235015a2362838.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论