共用方式為


Sys.Net.WebRequestExecutor xml Property

Attempts to get the response to the current request as an XMLDOM object.

Note

To get or set property values for client API properties, you must call property accessor methods that are named with the get_ and set_ prefixes. For example, to get or set a value for a property such as cancel, you call the get_cancel or set_cancel methods.

var xml = MyExecutor.get_xml();

Remarks

If a request finished successfully with valid response data, this method tries to get the response as an XMLDOM object.

Example

The following example shows how to use the xml property by using the default Sys.Net.XMLHttpExecutor class.

// This is the event handler called after 
// the Web request returns. It is designed
// for Web requests that return XML.
function OnSucceededXml(executor, eventArgs) 
{
    if (executor.get_responseAvailable()) 
    {
        // Display XML.
       if (document.all)
            resultElementId.innerText += executor.get_xml().xml;
        else
            // Firefox 
            resultElementId.textContent += "First node: " + 
                executor.get_xml().documentElement.nodeName;

    }
    else
    {
        if (executor.get_timedOut())
            alert("Timed Out");
        else
            if (executor.get_aborted())
                alert("Aborted");
    }
} 

See Also

Reference

Sys.Net.WebRequestManager Class

Sys.Net.WebRequest Class

Sys.Net.XMLHttpExecutor Class