jlizarraga
09-01-2008, 10:47 AM
Hi all.
I want to use Yahoo's YUI DataSource utility to parse my XML data, but I'm having trouble understanding the parameters of the function that parses the data!
YUI is really good about giving solid examples for their stuff, but an example for simple XML seems to have been overlooked. Here is the page where they provide examples:
http://developer.yahoo.com/yui/datasource/
And here is the ONLY documentation I could find anywhere of DataSource's parseXMLData method:
http://developer.yahoo.com/yui/docs/YAHOO.util.DataSource.html#method_parseXMLData
And finally, here is the code I have come up with based on those examples:
var invData = new YAHOO.util.DataSource("http://www.example.com/example.xml");
invData.responseType = YAHOO.util.DataSource.TYPE_XML;
invData.responseSchema = {
resultNode: "result",
fields: [
"vin",
"stock",
{key: "year", parser: YAHOO.util.DataSource.parseNumber}
]
};
var invListing = invData.parseXMLData(oRequest,oFullResponse);
I'm stumped on what to do with oRequest and oFullResponse.
Any help greatly appreciated! Oh, and happy Labor Day everyone!
I want to use Yahoo's YUI DataSource utility to parse my XML data, but I'm having trouble understanding the parameters of the function that parses the data!
YUI is really good about giving solid examples for their stuff, but an example for simple XML seems to have been overlooked. Here is the page where they provide examples:
http://developer.yahoo.com/yui/datasource/
And here is the ONLY documentation I could find anywhere of DataSource's parseXMLData method:
http://developer.yahoo.com/yui/docs/YAHOO.util.DataSource.html#method_parseXMLData
And finally, here is the code I have come up with based on those examples:
var invData = new YAHOO.util.DataSource("http://www.example.com/example.xml");
invData.responseType = YAHOO.util.DataSource.TYPE_XML;
invData.responseSchema = {
resultNode: "result",
fields: [
"vin",
"stock",
{key: "year", parser: YAHOO.util.DataSource.parseNumber}
]
};
var invListing = invData.parseXMLData(oRequest,oFullResponse);
I'm stumped on what to do with oRequest and oFullResponse.
Any help greatly appreciated! Oh, and happy Labor Day everyone!