Rendering an XML Stream II
Posted on 2001-06-24
With XML/XSL adding such great capabilities for formatting output I would like to be able to stream XML data into a CHTMLView. While the XSL sheet can reside in the program directory, the XML is produced dynamically as output from various calculations with the view rendering it in the same way that it does if you load an xml document from the local drive. Is it possible to insert items into an XML document and have it render (using the XSL sheet) as each element is added as with HTML? Can anyone show me a way of going about this?
I have got as far as this:
// Load the default xml document
Where the resource in this case is inserted as an HTML page containing XML. ie
<?xml version="1.0" standalone="no"?>
<?xml-stylesheet type="text/xsl" href="file://c:\OLSSAMP.xsl"?>
<!-- Here begins the XML data -->
<COMMAND>OLS CONSUME INCOME PRICE / ANOVA PCOV</COMMAND>
This loads an empty (but properly rendered XML document) and from there I was hoping to be able to insert elements and have the view update the element based on the stylesheet. Using the methods suggested by Dan Rollins:
1) pElem->put_innerHTML( bstrHtml ); using get_body()
2) pPersistStreamInit->Load( pStm ); using CreateStreamOnHGlobal(.)
(which are both methods for inserting HTML that is automatically rendered correctly) do not cause the page to render the XML with the XSL formatting - rather the XML is treated as HTML with unrecognised tags ie. inserted as plain text.
Finally if there is an alternative to XSL that will cause the XML stream (or element inserts) to render (eg. dynamic HTML methods of working with XML) than that would be also be fine.
Thanks in advance for any suggestions. Roll on DXML....