HTML in XML call?

F

Fergus O'Shea

I have some text that appears in a Database. This text includes
HTML(e.g. <br> tags).

I also have a Webpage that makes an XML call to that database. But
when the text is displayed on the page, the HTML isn't used, just
printed out as normal text.

Is there some way I can change the text in the Database, so that when
it is called in the XML call, that it displays as HTML?

p.s. I'm not in charge of the Webpage so can't do anything fancy
dynamically. I am only in charge of the Text. Please confine any
answers to that area, thanks.
 
G

GIMME

First examine the data in the database.

If the data looks like

&lt;html&gt;
&lt;body&gt;

instead of
<html>
<body>

Then indeed the data stored in the database needs tweaking to
get it to render. In that case you need to either examine how
or else said:

If the database has
<html>
<body>

Then see if there is a way in your "xmlcall" to fetch the html
as a CDATA element.

Since, as you described, your options are limited. You may have
to load the html into a gigantic javascript variable, do the
substitution in javascript, and then write the html from javascript.

BTW, there isn't a standard SQL function that changes the &lt;
it < and excetra. I'm stretching even thinking of a sql query
that would do it. Anyone ?
 
F

Fergus O'Shea

Thanks for the input.

In the database it is being stored as <br>. It is only when the XML
call is made that the < is changed to &lt; .

We are playing with the idea of having a Replace function is the front
end to change &lt; to <. This option wasn't previously open to me, but
does seem to solve the problem even though it won't be pretty. I'll
still welcome other suggestions.

Thanks again.
 
G

GIMME

In the database it is being stored as <br>. It is only when the XML
call is made that the < is changed to &lt; .

Can the xml call be configured to store the html in a
CDATA element so that it comes over as < instead of &lt; ?
We are playing with the idea of having a Replace function is the front
end to change &lt; to <. This option wasn't previously open to me, but
does seem to solve the problem even though it won't be pretty. I'll
still welcome other suggestions.

Just for laughs and giggles this replace function might work for you
....


function Html2St( st)
{
return String(st).replace('&lt;','<').replace('&gt;','>').replace('&nbsp;','
').replace('\\\\','\\');
}
 
F

Fergus O'Shea

Can the xml call be configured to store the html in a
CDATA element so that it comes over as < instead of &lt; ?

Well the XML goes to more than one location, some of which we don't
have any control of, so that could break the systems of those other
locations.
Just for laughs and giggles this replace function might work for you
...


function Html2St( st)
{
return String(st).replace('&lt;','<').replace('&gt;','>').replace('&nbsp;','
').replace('\\\\','\\');
}

I'll send it on, Thanks.
 

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

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,019
Latest member
RoxannaSta

Latest Threads

Top