displaying xml with indents

C

chonkme

Hi, was wondering if there was a way to present an xml string such as

"<?xml version='1.0' encoding='ISO-8859-1'?><hl7:QueryByParameter
xmlns:hl7='urn:hl7-org:v3' ><hl7:statusCode
code='new'/></hl7:QueryByParameter>";

"properly" with indents of say 2 spaces for each child element of the
root element like ..

<?xml version='1.0' encoding='ISO-8859-1'?>
<hl7:QueryByParameter xmlns:hl7='urn:hl7-org:v3' >
<hl7:statusCode code='new'/>
</hl7:QueryByParameter>

i dont mind if it is transformed into html and looks like that or if
the actual xml string is changed to have spaces in it. any helps
greatly appreciated
 
P

Peter Flynn

Hi, was wondering if there was a way to present an xml string such as

"<?xml version='1.0' encoding='ISO-8859-1'?><hl7:QueryByParameter
xmlns:hl7='urn:hl7-org:v3' ><hl7:statusCode
code='new'/></hl7:QueryByParameter>";

"properly" with indents of say 2 spaces for each child element of the
root element like ..

<?xml version='1.0' encoding='ISO-8859-1'?>
<hl7:QueryByParameter xmlns:hl7='urn:hl7-org:v3' >
<hl7:statusCode code='new'/>
</hl7:QueryByParameter>

i dont mind if it is transformed into html and looks like that or if
the actual xml string is changed to have spaces in it. any helps
greatly appreciated

Open the file in Emacs with xml-mode or similar and hit C-c C-q on the
root element start-tag.

///Peter
 
S

Soren Kuula

Peter said:
(e-mail address removed) wrote:



Open the file in Emacs with xml-mode or similar and hit C-c C-q on the
root element start-tag.
Or (on most Linux systems): xmllint --format --output foo.xml foo.xml

Soren
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,999
Messages
2,570,247
Members
46,844
Latest member
JudyGvh32

Latest Threads

Top