Skip to content

ExecuteXml

Executes the request and returns the response body as an XML node.

1
myRestRequest.ExecuteXml(contextNode?: Xml):Xml

Parameters

Xml contextNode optional
    Optional XML node whose namespace and schema context is used while parsing the response.

Returns

The response body as an Xml node.

Remarks

Unlike RestRequest.Execute, this method verifies the response status: by default, OK (200) and NoContent (204) are accepted. Otherwise, an exception is thrown.

Examples

Read values from an XML response

1
2
3
4
5
var rates = $Rest.Create('https://rates.example.com/')
    .Request('today.xml')
    .ExecuteXml();

$Xml.SetValue('Rate', rates.Evaluate("Currency[@Code='USD']/Rate"));

See Also