I’m using REST::Client perl module to test my REST server. I want to print REST response as usual xml
Currently I’m using
print $client->responseContent()
which prints xml in one line:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><ns2:messageReference xmlns:ns2="urn:com:test:xml:rest:mds:1"><messageId>775775</messageId></ns2:messageReference>
The REST::Client module also returns xpath context for the body content by $client->responseXpath(), but I cannot find a way to use it with toString() function from XML::LibXML, which allows to print it as I want:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ns2:messageReference xmlns:ns2="urn:com:test:xml:rest:mds:1">
<messageId>775775</messageId>
</ns2:messageReference>
$client->responseContent() outputs the response as is, if you would like to beautify it use XML::LibXML