使用javascript从URL解析XML

时间:2016-05-25 18:05:25

标签: javascript xml parsing

我在网址中包含了一个xml。 xml包含我想使用javascript访问的信息。特别是,我想访问记录ID号。任何帮助,将不胜感激。 XML包含here

我尝试的代码如下。但是,它告诉我url是一个无效的参数。

function importTable() {
    var response = UrlFetchApp.fetch("https://homesquare.quickbase.com/db/bij3xqndm?act=API_DoQuery&ticket=8_egp8sukxb_b2b92t_dmpt_a_dthwmsbdfjfzg5bfpsm3mbxnmaiddctskjbxw2t7zbmc8xambis3bkm&apptoken=5pvyk4bw5xdu2bct798ycgcibte&query={%27190%27.EX.%27%27}&clist=3.143&options=num-4");
    var doc = Xml.parse(response.getContentText(), true);
    Logger.log(response);
}

1 个答案:

答案 0 :(得分:0)

您可能需要对网址中的花括号进行URL编码。 {=%7B和} =%7D

对于XML遍历本身,我推荐这里的教程:http://www.w3schools.com/xml/dom_nodes_traverse.asp

除非您有奇怪的XML容器,否则语法相当简单。

相关问题