在google apps脚本中使用XmlService.Parse设置DOCTYPE

在google apps脚本中使用XmlService.Parse设置DOCTYPE,xml,parsing,google-apps-script,Xml,Parsing,Google Apps Script,我试图使用zillows API调用来获取属性的可用数据。我在他们的网站上随机列出了我的问题。我犯了错误 [文档:无DOCTYPE声明,根为[Element:] 尝试通过XML字符串时 谷歌应用程序脚本代码: function zillow() { var zwsid = <zwsid>; var streetnum = "2023"; var streetName = "SE 53rd"; var streetType = &

我试图使用zillows API调用来获取属性的可用数据。我在他们的网站上随机列出了我的问题。我犯了错误

[文档:无DOCTYPE声明,根为[Element:]

尝试通过XML字符串时

谷歌应用程序脚本代码:

function zillow() {
  var zwsid = <zwsid>;
  var streetnum = "2023";
  var streetName = "SE 53rd";
  var streetType = "Ave";
  var city = "Hillsboro";
  var state = "OR";
  var full = streetnum + streetName + streetType;
  
  var parameters = zwsid+"&address="+streetnum+"+"+streetName+"+"+streetType+"&citystatezip="+city+"%2C+"+state;
  var url = "http://www.zillow.com/webservice/GetSearchResults.htm?zws-id="+parameters;


  var result = UrlFetchApp.fetch(url).getContentText();
  var parse = XmlService.parse(result);
  var root = parse.getRootElement();

//set variables to data
  var test = root.getChild('response').getChild('results').getChild('result').getChild('street');
  Logger.log(parse)
}

我希望能够将各种子变量分配给变量,然后将这些值分配给工作表中的单元格。

我不得不为我糟糕的英语技能道歉。不幸的是,我无法从
中了解您的期望值。我希望能够将各种子变量分配给变量,然后将这些值分配给工作表中的单元格。
。我可以问一下您预期结果的详细信息吗?我希望能够提取值,比如“zestimate”,将其分配给变量,然后将其分配给单元格值。谢谢您的回复。我希望能够从
中提取值,例如“zestimate”,将其分配给变量,然后将其分配给单元格值。
,不幸的是,我仍然无法理解您的目标。这是因为我的英语水平差。对此我深表歉意。您知道我为什么会得到“[Document:无DOCTYPE声明,Root为[Element:看起来您没有收到格式良好的XML。请参阅。”。
<?xml version="1.0" encoding="utf-8"?>
<SearchResults:searchresults xsi:schemaLocation="http://www.zillow.com/static/xsd/SearchResults.xsd http://www.zillowstatic.com/vstatic/80d5e73/static/xsd/SearchResults.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SearchResults="http://www.zillow.com/static/xsd/SearchResults.xsd">
<request>
<address>2023 SE 53rd Ave</address>
<citystatezip>Hillsboro, OR</citystatezip>
</request>
<message>
<text>Request successfully processed</text>
<code>0</code>
</message>
<response>
<results>
<result>
<zpid>48595852</zpid>
<links>
<homedetails>http://www.zillow.com/homedetails/2023-SE-53rd-Ave-Hillsboro-OR-97123/48595852_zpid/</homedetails>
<graphsanddata>http://www.zillow.com/homedetails/2023-SE-53rd-Ave-Hillsboro-OR-97123/48595852_zpid/#charts-and-data</graphsanddata>
<mapthishome>http://www.zillow.com/homes/48595852_zpid/</mapthishome>
<comparables>http://www.zillow.com/homes/comps/48595852_zpid/</comparables>
</links>
<address>
<street>2023 SE 53rd Ave</street>
<zipcode>97123</zipcode>
<city>Hillsboro</city>
<state>OR</state>
<latitude>45.504557</latitude>
<longitude>-122.928718</longitude>
</address><zestimate>
<amount currency="USD">395122</amount>
<last-updated>10/22/2020</last-updated>
<oneWeekChange deprecated="true"></oneWeekChange>
<valueChange duration="30" currency="USD">9444</valueChange>
<valuationRange><low currency="USD">375366</low>
<high currency="USD">414878</high>
</valuationRange>
<percentile>0</percentile>
</zestimate>
<localRealEstate>
<region name="Hillsboro" id="11914" type="city">
<zindexValue>341,800</zindexValue>
<links>
<overview>http://www.zillow.com/local-info/OR-Hillsboro/r_11914/</overview>
<forSaleByOwner>http://www.zillow.com/hillsboro-or/fsbo/</forSaleByOwner>
<forSale>http://www.zillow.com/hillsboro-or/</forSale>
</links>
</region>
</localRealEstate>
</result>
</results>
</response>
</SearchResults:searchresults>
<!-- H:003  T:56ms  S:869  R:Fri Oct 23 19:26:02 PDT 2020  B:5.0.66204-master.6d3b619~delivery_ready.62512d5f -->