Displaying unparsed HTML in a WebBrowser control

A

Artie

Hi,

I'm using a WebBrowser control to display xml formatted to html using
a stylesheet.

In certain scenarios, if I detect that the xml is invalid, I'd need to
display the raw invalid xml in the WebBrowser control. I've wrapped
the raw invalid xml in some html tags, and it displays, however, all
the xml tags have been parsed out - it just displays the values.

My question is, how can I get the WebBrowser to display the actual
xml, including all the tags?

Example:

I want to display "<Forenam>John</Forename><Surname>Smith</Surname>"
in the WebBrowser
(deliberate mistake 'Forenam')

rather than
"JohnSmith"


Any help much appreciated

Cheers

Attie
 
P

Paul E Collins

Artie said:
I've wrapped the raw invalid xml in some html tags, and it displays,
however, all the xml tags have been parsed out - it just displays the
values.

Web browsers assume that anything like <blah> is an HTML element they
don't recognise, and they ignore it when rendering. (Imagine the mess of
tags otherwise whenever a new element was introduced.)

You probably want to replace < and > with the character entities &lt;
and &gt;.

Eq.
 
A

Artie

Web browsers assume that anything like <blah> is an HTML element they
don't recognise, and they ignore it when rendering. (Imagine the mess of
tags otherwise whenever a new element was introduced.)

You probably want to replace < and > with the character entities &lt;
and &gt;.

Eq.

Thanks Paul, that worked perfectly.

Artie
 

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

Top