Parse and Process XML Files Retrieved From Another Web Site rename

author:

contributor:

published:

updated:

source uri:

Summary

To fetch and parse an XML file given a URL, do:

> var doc = acre.xml.parse(acre.urlfetch(url...

Content

To fetch and parse an XML file given a URL, do:

> var doc = acre.xml.parse(acre.urlfetch(url).body);

Then you can use W3C DOM API to traverse the `doc`. For example, to get news items from an RSS feeds:

> var itemNodes = doc.getElementsByTagName("item");
> for (var i = 0; i < itemNodes.length; i++) {
> var itemNode = itemNodes[i];
> var title = itemNode.getElementsByTagName("title")[0].firstChild.nodeValue;
> // ...
> }

Created by: dfhuynh via Cookbook Jun 3, 2009
Last edited by: dfhuynh via Cookbook Jul 9, 2009

Recent Discussions about Parse and Process XML Files Retrieved From Another Web Site

There is no discussion about this document.

Start the Discussion »
Explore the Data
View all the data we have for Parse and Process XML Files Retrieved From Another Web Site
Flag this Document
Why do you want to flag this document?