PDA

View Full Version : XMLDataModel Load XML DOC Object



John
3 Jan 2007, 5:48 PM
I have a function that calls a server side script that returns an xmldoc object that is constructed from a database. I was wondering if I can pass an xmldoc object into an XMLDataModel object



function getXML( db, sql) {
xmldoc = new ActiveXObject("Msxml2.DOMDocument");
var xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
xmlhttp.Open("Get","http://localhost/ffs2/receiver.asp?type=1&db=" + db + "&sql=" + sql,false);
xmlhttp.send();
xmldoc.loadXML(xmlhttp.responseText); //load the returned stream into the dom document
return xmldoc;
}

(later in program...)

dataModel.load(getXML("data","select * from entry)");


dataModel.load('xmlfile.xml') works fine of course, however, would dataModel.load(new ActiveXObject("Msxml2.XMLHTTP")); work?

tryanDLS
3 Jan 2007, 6:19 PM
Take a look at the docs - you can pass an XML doc to the constructor or loadData method of XMLDataModel.

John
3 Jan 2007, 6:55 PM
Thanks.