This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: Building XML DOM from Access DB column with mixed content
- To: <xsl-list at lists dot mulberrytech dot com>
- Subject: RE: [xsl] Building XML DOM from Access DB column with mixed content
- From: "Chris Bayes" <chris at bayes dot co dot uk>
- Date: Tue, 13 Nov 2001 17:41:59 -0000
- Reply-to: xsl-list at lists dot mulberrytech dot com
[Get raw message]
Doug,
You would have to do something like
Set newElem = gobjXML.createElement("definition")
Dim xml:set xml = server.createobject("msxml2.domdocument")
xml.loadXML("<?xml version=""1.0""?><t>" & objRS("Definition") & "</t>")
Dim nodes:set nodes = xml.selectNodes("/t/*")
For n in nodes
newElem.appendChild n
Next
root.childNodes.Item(i).appendChild newElem
Ciao Chris
XML/XSL Portal
http://www.bayes.co.uk/xml
> -----Original Message-----
> From: owner-xsl-list@lists.mulberrytech.com
> [mailto:owner-xsl-list@lists.mulberrytech.com] On Behalf Of
> Doug Howell
> Sent: 13 November 2001 16:38
> To: XSL-List@lists.mulberrytech.com
> Subject: [xsl] Building XML DOM from Access DB column with
> mixed content
>
>
> Do any of you have any direction for me on this problem:
>
> I have a glossary.xml file which I've been parsing and
> transforming on the
> IE 5 client. Now, for a test, I'm implementing it via an ASP
> page, parsing
> and transforming on the server, and storing the glossary in an Access
> database. I'm building a DOM, transforming it, then including
> the string
> result into the document. I've got the mechanics of it
> working, but I've run
> into a problem. If one of you could steer me in the right
> direction, I'd
> really appreciate it.
>
> I'm storing several of the XML elements in their own columns
> in the Access
> DB ("term," etc.). The trouble is that the "definition"
> element has child
> elements which I'm not breaking out into their own columns.
> In other words,
> the Definition field in my DB has child elements (such as
> "<em>," "<uri>,"
> etc.) within it, as well as entity references. This means
> that when I create
> a "definition" element from the Definition field, the embedded child
> elements and entity references are not parsed like they were
> in my XML file,
> but are treated like text.
>
> Is there a way to parse the contents of the Definition field
> "on its way" to
> the DOM document, so these elements/entity refs will be transformed
> correctly to the HTML output?
>
> Thanks,
> Doug Howell
>
> Here's part of the code: (I'm using MSXML3 SP1)
>
> <%
> 'create XML doc from SQL results
> dim root
> dim entry
> dim newElem
> dim newAttrib
> dim i
>
> Set root = gobjXML.documentElement
>
> i = 0
> While Not objRS.EOF
> Set newElem = gobjXML.createElement("entry") 'create a new entry
> root.appendChild newElem
> Set newElem = gobjXML.createElement("term") 'create the term element
> root.childNodes.Item(i).appendChild newElem
> root.childNodes.Item(i).lastChild.Text = objRS("Term")
> Set newElem = gobjXML.createElement("definition")
> root.childNodes.Item(i).appendChild newElem
> root.childNodes.Item(i).lastChild.Text = objRS("Definition")
> i = i + 1
> objRS.MoveNext
> Wend
> objRS.close
> objConn.close
> Set objRS = Nothing
> Set objConn = Nothing
> 'do the transformation and write the results into the page below
> strResult = gobjXML.transformNode(gobjXSL)
>
> %>
>
>
>
>
> XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
>
>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list