I am running Delphi 7 Enterprise on Windows XP SP2 with Internet Explorer 6.
I have a program that needs to access some XML data downloaded from a certain website. The website sends XML data with an XSL stylesheet, which Internet Explorer renders into formatted HTML for viewing. Most of the methods I've tried so far have been accessing the rendered HTML instead of the underlying XML data directly. I want to work with the XML data directly, probably with TXMLDocument (unless someone can point me to something better).
Ironically, if you right-click on the WebBrowser and select 'View Source', a Notepad window pops up with JUST the XML data inside, which is exactly what I want; however, my program will be browsing through several hundred web pages automatically, and having it click on 'View Source', then saving the file, then re-loading the file, then processing the XML would take too long in the long run. I need something a little speedier than having to save, then reload, a file every time I want to work with the XML.
For an example, here is a website that also sends XML data with an XSL stylesheet:
It's important that I can work with the XML document directly, because in my case, the XML document contains data which is not rendered by the XSL stylesheet, so extracting my data from the rendered HTML would not give me all the data I need.
I've tried saving the contents of TWebBrowser into a StringStream, then loading the StringStream into a string, but not only does that return the rendered HTML and not the XML alone, it also returns it as UTF-16 with #0 characters after every character. Not fun to read.
Is there a way to get the XML data from TWebBrowser into TXMLDocument? Preferrably without saving a temporary file?