3.0.5

How to get XML as string?

When I call getXML() I can't see the XML code using alert():
alert(table.getXML())

Instead of showing XML it writes "[object]"
freebsd[dog]list.ru
May 2,
I am assuming that the getXML() method is returning an Xml node collection. You will probably need to iterate over the nodes and build the string by hand.
Tim
November 12,
why can't get XML's value?

document.write(data.getXML());


show:"undefined"?

:(
prient
November 16,

Quoting Tim
> I am assuming that the getXML() method is returning an Xml node collection

So use the .xml property to retrieve as string. It works in IE for me.. But i haven't checked it others though.

alert(table.getXML().xml);


I saw that you get xml only if setXML property was used. Issuing getXML() to a data model that uses HTTP Requests becomes undefined either.

Can somebody show some light on this? Probably Alex might ;-) Come on Alex, show yourself!! :)
Md. Sheriff, Drivestream
November 24,
Oops, I just solved this issue myself. Since HTTP Request that was made are async we obviously would not be able to see any XML until the response arrives.. So instead of scripting in code i tried this in the browser address bar.. and voila! IT WORKED :)

javascript:alert(javascript:alert(GridConfig.DataTables["UserDetails"].getXML().xml))


in similar contexts for

//	create ActiveWidgets data model - XML-based table
    var table = new Active.XML.Table;

    //	provide data URL
    table.setURL(strDataSetURL);
  // DataSetURL

    //	set rows XPath
    table.setRows("//NewDataSet/*");

    //	set columns XPath
    table.setColumns(["UserID", "UserName", "UserAddress", "CompanyName", "CompanyState"]);

    //	start asyncronous data retrieval
    req=table.request();

    //	create ActiveWidgets Grid javascript object
    var obj = new Active.Controls.Grid;

    //	provide column labels
    obj.setColumnProperty("texts", GridConfig.Columns[columnID]);

    //	provide external model as a grid data source
    obj.setDataModel(GridConfig.DataTables["UserDetails"]=table);


Hope this helps :-)

(hmm... There isn't any option for this post to be followed-up so that this can be marked as [Resolved] and people with similar problems will readily pick this one and get away with the solution)
Md. Sheriff, Drivestream
November 24,
javascript:alert(GridConfig.DataTables["UserDetails"].getXML().xml)

Apologies, that was a typo... (i think i should improve the habit typing in mains)
Md. Sheriff, Drivestream
November 24,

This topic is archived.

See also:


Back to support forum