LeeNeverGup
LeeNeverGup

Reputation: 1114

Format XML in racket

I am working now with racket and XML creation files. To do so, I'm using the function:

(display-to-file
 ( SOME_XEXPR )
(FILE_PATH)

And the XML looks like one bit mess. No newlines, identation or whitespaces, only one long line. How do I make the output look nicer?

Upvotes: 2

Views: 347

Answers (1)

uselpa
uselpa

Reputation: 18927

Have a look at the xml module; display-xml can be of help for example:

(require xml)
(display-xml (read-xml (open-input-string "<a>1<b>2</b></a>")))

yields

<a>
  1
  <b>
    2
  </b>
</a>

Upvotes: 3

Related Questions