Connecting Tech Pros Worldwide Help | Site Map

Unable to view XML content generated on-the-fly in IE 6.0

Rajiv Das
Guest
 
Posts: n/a
#1: Nov 11 '05
Programming Language: C++, XML
Development Env: VS.net 2002
Platform Win2k, SP4
Browser: IE 6.0
XML Parser MSXML 4.0
---------------------------------------------

I have an XML file having around 1000 nodes under the root. Further, each
node may have several children. However, I am only interested in displaying
only one particular node, depending on the user choice, in IE.

1. So I have instantiated a IWebBrowser2* pBrowser interface and navigated
to about:blank. Then I extracted the IHTMLDocument2* interface from it.
2. Then I parsed the XML file and located the particular node to be
displayed using the XML DOM APIs.
3. Then I write the opening XML headers to the document using
IHTMLDocument2::write
4. Finally I use IXMLDOMNode::get_xml() to get the XML content in a BSTR.
After converting the BSTR to SAFEARRAY type I write to the browser document
using IHTMLDocument2::write.
5. Then I write the closing XML tag

Now comes the problem:
Nothing shows up in IE. If I do a view-source the XML is there.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

My question is: How do I show the generated XML in the same way we see it
when we open an XML file in IE without any attached XSL stylesheets?
--
Cheers,
[Rajiv Das]


Oleg Tkachenko
Guest
 
Posts: n/a
#2: Nov 11 '05

re: Unable to view XML content generated on-the-fly in IE 6.0


Rajiv Das wrote:
[color=blue]
> I have an XML file having around 1000 nodes under the root. Further, each
> node may have several children. However, I am only interested in displaying
> only one particular node, depending on the user choice, in IE.
>
> 1. So I have instantiated a IWebBrowser2* pBrowser interface and navigated
> to about:blank. Then I extracted the IHTMLDocument2* interface from it.
> 2. Then I parsed the XML file and located the particular node to be
> displayed using the XML DOM APIs.
> 3. Then I write the opening XML headers to the document using
> IHTMLDocument2::write
> 4. Finally I use IXMLDOMNode::get_xml() to get the XML content in a BSTR.
> After converting the BSTR to SAFEARRAY type I write to the browser document
> using IHTMLDocument2::write.
> 5. Then I write the closing XML tag
>
> Now comes the problem:
> Nothing shows up in IE. If I do a view-source the XML is there.
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^[/color]

You are wrinting XML text to IHTMLDocument object? I don't think that's
good idea. You have to write HTML representation of the XML.
--
Oleg Tkachenko
http://www.tkachenko.com/blog
Multiconn Technologies, Israel

Closed Thread