You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by "Pugh, Eric" <EP...@MuseumCompany.com> on 2002/01/02 22:56:37 UTC

How to output XML as HTML nicely..

Hi all,

I have a .vm file that I want to output some XML on the page in a table of
other data.  Obviously, if I output my raw XML, it doesn't show up, because
of the < and > tags...  What have people done to output XML nicely?  I would
love it if I could take my very compact machine readable XML with no returns
or spaces, and convert it to nice pretty XML with returns and
indentations...

Slapping the XML in a textarea is a plain, ugly, but workable method, I am
looking for something better!

Eric

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: How to output XML as HTML nicely..

Posted by Matthew Koranda <ma...@orkan.no>.
I'm a new user so I don't quite know the flow of the programming yet but
couldn't you stream the XML through a function that replaces the the < and >
with the HTML equivilants &lt; and &gt; and then place the whole thing
between <pre> tags?

I guess to format the XML 'nicely' you could make the function add a
carriage return after each opening tag along with a tab, the next opening
tag would get a carriage return along with two tabs (say tabAmount + 1),
etc. Each closing tag would get a carriage return and remove a tab
(tabAmount - 1)

Does this help?

Matt
----- Original Message -----
From: Pugh, Eric <EP...@MuseumCompany.com>
To: 'Turbine Users List' <tu...@jakarta.apache.org>
Sent: Wednesday, January 02, 2002 10:56 PM
Subject: How to output XML as HTML nicely..


> Hi all,
>
> I have a .vm file that I want to output some XML on the page in a table of
> other data.  Obviously, if I output my raw XML, it doesn't show up,
because
> of the < and > tags...  What have people done to output XML nicely?  I
would
> love it if I could take my very compact machine readable XML with no
returns
> or spaces, and convert it to nice pretty XML with returns and
> indentations...
>
> Slapping the XML in a textarea is a plain, ugly, but workable method, I am
> looking for something better!
>
> Eric
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>