R – pretty print XML in crystal reports

crystal-reportsxml

I have a crystal report that includes some XML data. This XML string is stored in a database column (Oracle 10g). Right now the report just displays the whole string in one big ugly mess. Is there any good way to either pretty print the xml (put tags on seperate lines, maybe indent nested tags) or even format the xml as I would other data in the report?

My current best idea (where best does not imply good) , is to just do a string replace everywhere I see ><, so that at least each tag will be on a separate line.

What would be awesome is a way to pass that xml string into a subreport and have the subreport use that xml as it's datasource. What would be almost as good, for my purposes, would be a prettyprintXML function somewhere in crystal that would just format the raw xml in a nice way. I have access to Crystal 11.
Thank you.

EDIT – I appreciate the help so far, but I already know 37 different ways I could do this outside of Crystal. I am looking for a solution that works within the Crystal Reports design tool itself.

Best Answer

If you are using this on a web page, I believe that you should be able to format it using a css file. But you may also be able to use XSLT outside of Crystal Reports instead. Below are some links that may help.

Link for Displaying XML with CSS

Link for to a css with crystal reports question on SO

Link of an example of XSLT instead of Crystal Reports