Show XML tags in HTML

Discussion in 'HTML' started by Nick Locke, Jul 5, 2007.

  1. Nick Locke

    Nick Locke Guest

    I have a need to display some XML without IE interpreting the tags. I want
    something like this:

    <html>
    <head><title>xxxx</title></head>
    <body>
    <h1>hhhhhhh</h1>
    <p>oooooo</p>
    <xmltag>Hello World</xmltag>
    <p>oooooo</p>
    </body>
    </html>

    At the moment, that renders as:

    hhhhhhhh
    oooooo
    Hello World
    oooooo

    Whereas what I need is:

    hhhhhhhh
    oooooo
    <xmltag>Hello World</xmltag>
    oooooo

    I have tried wrapping the XML in <pre></pre> and <blockquote></blockquote>
    and both still just lose the tags. View Source works fine, but I need to
    see the tags within the page itself.

    Ideas welcome!

    Thanks, Nick.
    Nick Locke, Jul 5, 2007
    #1
    1. Advertising

  2. Nick Locke

    Ben C Guest

    On 2007-07-05, Nick Locke <> wrote:
    > I have a need to display some XML without IE interpreting the tags. I want
    > something like this:
    >
    ><html>
    ><head><title>xxxx</title></head>
    ><body>
    ><h1>hhhhhhh</h1>
    ><p>oooooo</p>
    ><xmltag>Hello World</xmltag>
    ><p>oooooo</p>
    ></body>
    ></html>

    [...]
    > Whereas what I need is:
    >
    > hhhhhhhh
    > oooooo
    ><xmltag>Hello World</xmltag>
    > oooooo
    >
    > I have tried wrapping the XML in <pre></pre> and <blockquote></blockquote>
    > and both still just lose the tags. View Source works fine, but I need to
    > see the tags within the page itself.
    >
    > Ideas welcome!


    &lt;xmltag&gt;Hello world&lt;/xmltag&gt;
    Ben C, Jul 5, 2007
    #2
    1. Advertising

  3. Scripsit Nick Locke:

    > I have a need to display some XML without IE interpreting the tags.


    If you were not able to figure that out on your own, are you really
    competent to write documents about XML issues? After all, XML has just the
    same principle in this respect as HTML does. At the minimum, the "<"
    character must be written using an entity reference or a character
    reference. Any "&" character must be "escaped" in a similar manner. There's
    no need to "escape" the ">" character, but people usually do that, for
    symmetry.

    --
    Jukka K. Korpela ("Yucca")
    http://www.cs.tut.fi/~jkorpela/
    Jukka K. Korpela, Jul 5, 2007
    #3
  4. Nick Locke

    nmi

    Joined:
    Jul 6, 2007
    Messages:
    13
    Use <xmp>. It's told to be deprecated, but it works fine.
    nmi, Jul 6, 2007
    #4
  5. Nick Locke

    GreatArtist Guest

    I think you're not competent to write messages on Usenet until you
    stop being an asshole.
    GreatArtist, Jul 8, 2007
    #5
  6. GreatArtist wrote:

    > I think you're not competent to write messages on Usenet until you
    > stop being an asshole.


    Who isn't competent? You didn't quote anything.

    Well, if as I suspect it was Jukka, consider this: once you get past
    the brusqueness of his posts, you will find sound advice. Relax a bit,
    read carefully. Take your meds if necessary.

    --
    -bts
    -Motorcycles defy gravity; cars just suck
    Beauregard T. Shagnasty, Jul 8, 2007
    #6
  7. Scripsit Beauregard T. Shagnasty:

    > GreatArtist wrote:
    >
    >> I think you're not competent to write messages on Usenet until you
    >> stop being an asshole.

    >
    > Who isn't competent? You didn't quote anything.


    Well, this was rather obvious: "GreatArtist" used the pronoun "you" in the
    generic sense, referring to any person - and, in this, particularly
    applicable to "GreatArtist" himself/herself/itself.

    --
    Jukka K. Korpela ("Yucca")
    http://www.cs.tut.fi/~jkorpela/
    Jukka K. Korpela, Jul 8, 2007
    #7
    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. Dean H. Saxe
    Replies:
    0
    Views:
    1,025
    Dean H. Saxe
    Jan 3, 2004
  2. Rob Nicholson
    Replies:
    3
    Views:
    717
    Rob Nicholson
    May 28, 2005
  3. Ranganath

    Custom Tags within Custom Tags.

    Ranganath, Oct 17, 2003, in forum: Java
    Replies:
    2
    Views:
    454
    Ranganath
    Oct 21, 2003
  4. Donald Firesmith

    html tags within meta tags allowed?

    Donald Firesmith, Jan 5, 2005, in forum: XML
    Replies:
    5
    Views:
    883
    Andy Dingley
    Jan 8, 2005
  5. Critcho
    Replies:
    1
    Views:
    1,758
    Critcho
    Sep 6, 2010
Loading...

Share This Page