could you provide more informations to the output you want ?
There are many ways to indent XML code. Maybe you don’t want to wrap
lines
with content, but what if the content is longer ? Do you have a
column limit ?
In your place, I would take the pp code of nokogiri and tweak it until
it
gives me what I want.
In my experience, everyone has a different definition of “pretty
printing”.
If you want to get more specific about what you’d like to see, perhaps
people can give you a more specific answer.
““But nokogiri has another problem, which unwrap CDATA.””
You can’t preserve CDATA or !ENTITY using XSLT.
The XML parser will expand them, and there is absolutly no way to
prevent it. (It causes many headaches for me.)
You would have to do it strictly with regular expressions, treating the
XML as text.
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.