[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: Building XML DOM from Access DB column with mixed
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@xxxxxxxxxxxxxxxxxxxxxx > [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of > Doug Howell > Sent: 13 November 2001 16:38 > To: XSL-List@xxxxxxxxxxxxxxxxxxxxxx > Subject: 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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|