Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/36.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在javascript中将xml数据格式存储到字符串中?_Javascript_Node.js_Xml_String - Fatal编程技术网

如何在javascript中将xml数据格式存储到字符串中?

如何在javascript中将xml数据格式存储到字符串中?,javascript,node.js,xml,string,Javascript,Node.js,Xml,String,如何在javascript中将xml数据格式存储到字符串中。我想在下面存储xml。我们如何在下面存储xml数据?对字符串中的特殊字符进行转义可以解决这个问题吗 xml 2013-03-15T8:22:40 4RT6FGE6HJ78F3DF56 2013 河流浅水处 Ford Focus您可以使用以下命令将其放入字符串: const smlString=` 2013-03-15T8:22:40 4RT6FGE6HJ78F3DF56 2013 河流浅水处 无论如何,Ford FocusXML只是文

如何在javascript中将xml数据格式存储到字符串中。我想在下面存储xml。我们如何在下面存储xml数据?对字符串中的特殊字符进行转义可以解决这个问题吗

xml

2013-03-15T8:22:40
4RT6FGE6HJ78F3DF56
2013
河流浅水处

Ford Focus您可以使用以下命令将其放入字符串:

const smlString=`
2013-03-15T8:22:40
4RT6FGE6HJ78F3DF56
2013
河流浅水处

无论如何,Ford FocusXML只是文本,所以您可以将其存储在一个字符串中,如
var s=“您的xml放在这里”
<?xml version="1.0" encoding="UTF-8"?>
  <?ADF VERSION="1.0"?>
    <adf>
      <prospect>
        <id sequence="yourLeadID" source="site name"></id>
        <requestdate>2013-03-15T8:22:40</requestdate>
        <vehicle interest="buy" status="used">
        <vin>4RT6FGE6HJ78F3DF56</vin>
        <year>2013</year>
        <make>Ford</make>
        <model>Ford Focus</model&gt
        <stock>4321</stock>
        </vehicle>
    
      <customer>
        <contact>
        <name part="first" type="individual">John</name>
        <name part="last" type="individual">XYZ</name>
        <email>john at example.com</email>
        <phone type="home">111-222-7777</phone>
        <phone type="mobile">111-444-5555</phone>
        <phone type="work">111-222-3333</phone>
        </contact>
        <comments>Inquiry regarding vehicle</comments>
      </customer>
 
      <vendor>
       <contact>
       <name part="full">website name from where you are sending email</name>
       <email>john at example.com</email>
       <phone type="business">111-666-7777</phone>
       </contact>
     </vendor>
 </prospect>
</adf>