Home All Groups Group Topic Archive Search About
Author
16 Jan 2006 8:32 AM
Lee
Hi,

I am using the WebBrowser control included with VS2005 to view XML files,
and they are being displayed correctly as far as I can tell.

The problem I am having is saving these XML files to disk.

If I try to save the contents of the WebBrowser.DocumentText to disk, the
resulting file contains HTML and script that I don't want. Is there any way
I can save the actual XML document to disk from the WebBrowser control?

Many thanks.

Lee.

Author
16 Jan 2006 8:50 AM
Cyril Gupta
Hello Lee,

This is just a hunch, but a HTTPRequestDocument should retrieve pure XML and
not the HTML code that then IE adds while rendering.

Regards
Cyril Gupta
Author
16 Jan 2006 9:20 AM
Tim Anderson
"Lee" <l**@somewhere.com> wrote in message
news:eKaAAdnGGHA.1396@TK2MSFTNGP11.phx.gbl...

> I am using the WebBrowser control included with VS2005 to view XML files,
> and they are being displayed correctly as far as I can tell.

> If I try to save the contents of the WebBrowser.DocumentText to disk, the
> resulting file contains HTML and script that I don't want. Is there any
> way
> I can save the actual XML document to disk from the WebBrowser control?

Can you clarify what you want to do? Are you modifying the XML in any way?
If not, why is there any need to save from IE, as opposed to copying from
your original source?

That aside, what is interesting here is that if you load XML into a
WebBrowser, right-click and choose View Source, you get the original file.
Maybe it does it like this:

When IE displays XML, it applies a stylesheet to give you the pretty
hierarchical view. However, have a look here:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnwebteam/html/webteam05072001.asp

and note this:

"Conveniently, as well as transforming your XML into a collapsible hierarchy
display, Internet Explorer also adds an XMLDocument expando property to the
document object that provides access to the original XML."

It looks like you can get at this through the DOM, or adapt the C++ code in
the article :-)

Tim

Read my tech blog:
http://www.itwriting.com/blog