-1

嗨,我有一个现有的 XML 文件,想通过 Javascript 添加一个新条目(atm 没有任何形式或类似硬编码的东西),所以我的问题是如何处理它来添加一本新书。

<?xml version="1.0"?>
<catalog>
   <book id="bk101">
      <author>Gambardella, Matthew</author>
      <title>XML Developer's Guide</title>
      <genre>Computer</genre>
      <price>44.95</price>
      <publish_date>2000-10-01</publish_date>
      <description>An in-depth look at creating applications 
      with XML.</description>
   </book>
</catalog>
4

2 回答 2

0
XML.BeginNode(“Foo”);
XML.Attrib(“Bar”, “Some Value”);
XML.EndNode();
//Produces: <Foo Bar=”Some Value” />

也检查下面的 URL。

http://www.codeproject.com/Articles/12504/Writing-XML-using-JavaScript

于 2012-04-19T13:43:41.327 回答
0

恐怕 JavaScript 无法按照您的意愿写入本地文件。您可以生成 XML,但不能将其写入/保存到文件...

于 2012-04-19T13:45:13.327 回答