HTML in XML call?

Discussion in 'XML' started by Fergus O'Shea, Nov 21, 2003.

  1. 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.
     
    Fergus O'Shea, Nov 21, 2003
    #1
    1. Advertising

  2. Fergus O'Shea

    GIMME Guest

    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
    that data is getting stored, so it stores <html>, or else
    you need some sort of query that will substitute out the < and
    > signs.


    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 ?

    (Fergus O'Shea) wrote in message news:<>...
    > 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.
     
    GIMME, Nov 24, 2003
    #2
    1. Advertising

  3. 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.

    (GIMME) wrote in message news:<>...
    > 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
    > that data is getting stored, so it stores <html>, or else
    > you need some sort of query that will substitute out the < and
    > > signs.

    >
    > 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 ?
    >
    > (Fergus O'Shea) wrote in message news:<>...
    > > 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.
     
    Fergus O'Shea, Nov 25, 2003
    #3
  4. Fergus O'Shea

    GIMME Guest

    >
    > 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('\\\\','\\');
    }


    > Thanks again.
    >
    > (GIMME) wrote in message news:<>...
    > > 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
    > > that data is getting stored, so it stores <html>, or else
    > > you need some sort of query that will substitute out the < and
    > > > signs.

    > >
    > > 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 ?
    > >
    > > (Fergus O'Shea) wrote in message news:<>...
    > > > 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.
     
    GIMME, Nov 26, 2003
    #4
  5. (GIMME) wrote in message news:<>...
    > >
    > > 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; ?
    >


    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.

    > >
    > > 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('\\\\','\\');
    > }
    >


    I'll send it on, Thanks.

    >
    > > Thanks again.
    > >
    > > (GIMME) wrote in message news:<>...
    > > > 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
    > > > that data is getting stored, so it stores <html>, or else
    > > > you need some sort of query that will substitute out the < and
    > > > > signs.
    > > >
    > > > 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 ?
    > > >
    > > > (Fergus O'Shea) wrote in message news:<>...
    > > > > 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.
     
    Fergus O'Shea, Nov 26, 2003
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Monorom
    Replies:
    0
    Views:
    407
    Monorom
    Jul 29, 2003
  2. hagar
    Replies:
    1
    Views:
    383
    Simon Brooke
    Oct 19, 2006
  3. HTML to XML call

    , May 2, 2007, in forum: XML
    Replies:
    3
    Views:
    458
    Andy Dingley
    May 3, 2007
  4. Fabio Mastria
    Replies:
    4
    Views:
    735
    Fabio Mastria
    Jan 28, 2008
  5. Erik Wasser
    Replies:
    5
    Views:
    465
    Peter J. Holzer
    Mar 5, 2006
Loading...

Share This Page