This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: html inside xml
Dear Jeni,
Thank you so much for your response. As you suggest, I can load the html
content into an xmldom object, such as HTMLDOM. But I am still not sure how
to append the HTMLDOM to one specific node of my original xmldom object. My
code is something like the following:
'my original xmlDom object
Set xmldoc = Server.CreateObject("Microsoft.XMLDOM")
'htmlDom to store html content
Set htmlDom = Server.CreateObject("Microsoft.XMLDOM")
HTMLString = '<snippet>' + HTMLString + '</snippet>';
HTMLDOM.loadXML(HTMLString);
' Build the XML document here
If (xmldoc.childNodes.length = 0) Then
Set root = xmldoc.createNode("element", "report", "")
xmldoc.appendChild (root)
Set rootnode = xmldoc.createNode("element", "row", "")
root.appendChild(rootnode)
'column node
Set colNode = xmldoc.createNode("element", "column", "")
rootnode.appendChild(colNode)
Set innernode = xmldoc.createNode("element","caption","")
innernode.Text ="ID"
colNode.appendChild(innernode)
Set innernode = xmldoc.createNode("element","value","")
??? ???
'Here I want to append htmlDom to the value node, but I am not sure how
to do it. I have a play with Chris Bayes's domtodom.js but have no idea how
to implement his javascript functions into my case here. If you can go
through a little more detail in this topic here, it will be very very
helpful.
Thank you so much for your great help
Henry
> For example, if the string is held in the HTMLString variable, then
> you could add an start and end tag to it:
>
> HTMLString = '<snippet>' + HTMLString + '</snippet>';
>
> to make it a well-formed XML document, then read that into an XMLDOM
> object:
>
> HTMLDOM.loadXML(HTMLString);
>
> Then you can copy the nodes in the HTMLDOM over to the XMLDOM that
> you're working on, e.g. using Chris Bayes' domtodom.js
> (http://www.bayes.co.uk/xml).
>
> That way, the XML document will have the HTML embedded in it properly,
> and you'll be able to just copy it into the output.
>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list