1

i am loading xml as String from Remote using curl as below:

$ curl -i -H "Accept: application/xml"  -X GET "URL Here"

but response is not xml format, hence not easily readable.

<?xml version="1.0" encoding="UTF-8" standalone="yes"?><RunConfig <PipeLineXmlVersion>1.0</PipeLineXmlVersion><DateTime>20161128_160859</DateTime><Analysis><Lane>1</Lane><PipeLine>run_multiplexed_auto_start_v4.0.sh</PipeLine><Version>4.0</Version><Mismatch>1</Mismatch><MergeLane>0</MergeLane<Version>4.0</Version></Analysis></RunConfig>

When i try the same API using some REST client then i can see the proper xml.

As i searched, Accept header should work but unfortunately not in my case.

Please help me with this.

Thanks.

2
  • what do you mean by "not proper" ? Seems correct to me. Commented Nov 29, 2016 at 7:37
  • @Derlin response is right but i expect Xml format, with proper hierarchy of nodes. Please see here one example:jonathanmedd.net/wp-content/uploads/2009/12/ExampleXML.png Commented Nov 29, 2016 at 7:41

1 Answer 1

8

If what you mean by "not proper" is the fact that the response is not pretty printed (i.e. lack spaces and indent), there are plenty of command line tools to format xml.

For example:

curl ... | xmllint --format -

Here, you pass the response of curl to xmllint (part of xmllib2-utils), which will format your answer. The - in the end tells the tool to read the input from stdin (that is, the piped content).

Have a look at this question for more ways to achieve it.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.