Skip to content

ToXml

Returns the response content parsed as an Xml node.

1
myRestResponse.ToXml(contextNode?: Xml):Xml

Parameters

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

Returns

The response content parsed as an Xml node.

Remarks

The status code is verified first, as with RestResponse.Verify. If the content is not valid XML, a parsing error occurs.

Examples

Read values from an XML response

1
2
3
4
5
6
var rates = $Rest.Create('https://rates.example.com/')
    .Request('daily.xml')
    .Get()
    .ToXml();

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

See Also