0

谁能告诉我在哪里可以找到这里提到的“短手指南”:

https://developers.google.com/apps-script/class_xml#parseJS

function createXmlDocument() {
  var elementName   = 'customerName';
  var customerName = 'Bad Boys Inc.';
  var parseJSparameter = [elementName, customerName];
  var xmlDoc = Xml.parseJS(parseJSparameter);
  var textOfXml = xmlDoc.toXmlString();
  Logger.log(textOfXml);
}

function createXmlDocument2() {
  var shortHand = ['customer', 
                   {'active' : 'true'},
                   ['name', 'Bad Boys Inc.'], 
                   ['customerId', '6060']
                  ];
  var xmlDoc = Xml.parseJS(shortHand);
  var textOfXml = shortHand.toXmlString();
  Logger.log(textOfXml);
}

createXmlDocument 有效,但 createXmlDocument2 无效。

4

2 回答 2

1

当我有同样的问题时,我唯一能找到的是肥皂概述的第 2 节:

https://developers.google.com/apps-script/soap_overview

于 2012-08-06T14:12:04.037 回答
0

毫不奇怪,后一个片段不起作用,因为其中有一些错误。试试这个:

function createXmlDocument2() {
    var shortHand = ['customer', 
                      ['active' , 'true'],
                      ['name', 'Bad Boys Inc.'], 
                      ['customerId', '6060']
                    ];
    var xmlDoc = Xml.parseJS(shortHand);
    var textOfXml = xmlDoc.toXmlString();
    Logger.log(textOfXml);
}
于 2012-08-28T13:10:21.630 回答