Einzelnen Beitrag anzeigen

Delphi-Lover

Registriert seit: 19. Okt 2004
Ort: Amsterdam
30 Beiträge
 
Delphi 2005 Professional
 
#1

Saving Document XML Source from TWebbrowser

  Alt 9. Okt 2006, 17:59
Hello,

For saving the internetpage loaded in the TWebbrowser-component are two properties.
like : Document.Body.InnerHTML and Document.Body.InnerText (and the two OuterHTML, OuterText)

The problem with the InnerHTML property is that the browser already rendered the page received, so it is including all kinds of extra HTML tags:

Original XML from the webserver:

<?xml version="1.0" encoding="UTF-8"?>
<Delphi exampe-version="1.0">&gt;
<tag>
<text>Delphi is great</text>
....

The InnerHTML will give:

<DIV class=e><SPAN class=b></SPAN> <SPAN class=m>&lt;?</SPAN><SPAN class=pi>xml version="1.0" encoding="UTF-8" </SPAN><SPAN class=m>?&gt;</SPAN> </DIV>
<DIV class=e>......

The problem with the InnerText is that it will include "-" symbols, like the Internet Explorer does if it loads a XML file. (You can click on these "-" to open and close the nodes of the XML)

So the InnerText gives:

<?xml version="1.0" encoding="UTF-8" ?>
- <Delphi exampe-version="1.0">
>
- <tag>

As you see it corrupts also the XML source file.

Question: Anyone knows how to save the real XML file received by the Webbrowser?
If you use the "view source" option in the browser the XML-file will open OK without any formatting by the browser.
How can you simulate this option and save it to file??

Greets,

Delphi-Lover.
Rob
  Mit Zitat antworten Zitat