Subject: RE: [xsl] Coding and node context under MSXML3 From: "Chris Bayes" <Chris@xxxxxxxxxxx> Date: Fri, 13 Apr 2001 11:19:04 +0100 |
Joel, Only you can decide when to create a document. I would say A. C is the same as you have to create a node within a document. So wether the function adds it or returns a pointer to the newly created node so that the caller can insert it depends on what you are doing. Have a look at http://www.bayes.co.uk/xml/index.xml?/xml/utils/domtodom.xml 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 Joel P >Thornton >Sent: 12 April 2001 21:20 >To: Xsl-List >Subject: [xsl] Coding and node context under MSXML3 > > >Hi. > >I'm writing code using MSXML3/ASP to do various node creation and >processing >tasks. I'm having some trouble defining exactly where, who, and when it is >best to create nodes/documents. > >Specifically -- when calling a function which creates a new node, say >fetchContentNode(), is it better to: > > >A) Have the caller create an XMLDOMDocument, and pass a context node into >the function for the function to create the new node on or as a child of? > >B) Have the function itself create an XMLDOMDocument, and return the >document to the caller, who would then be responsible for appending the >returned DOMDocument.documentElement to its own working DOMDocument (or >doing something else with it)? > >C) Have the caller create an XMLDOMDocument and pass it to the function, >then have the function return the newly created node -- whose parent is the >XMLDOMDocument originally passed in? > > >I'm looking for any advice on "best practices" in this area, because I'm >having trouble conceptualizing through the whole process. > >Option A seems like it would make the best use of resources, however at the >cost of being able to control exactly what happens with the newly created >node. > >Option B seems like an unnecessary waste of resources, since you would be >instantiating a new DOMDocument every time you wanted the function >to create >a node for you, which would then be appended to another, pre-existing >DOMDocument (presumably). > >So Option C seems to be a fair medium between the two: it does not require >the called function to create a new DOMDocument to carry out its operation. >But it also seems rather messy to do it that way, e.g.: > > > >[ create a new DOMDocument, xmlDoc, with some children nodes ] > >Set nodContent = fetchContentNode(xmlDoc, "content-lookup-name") >xmlDoc.documentElement.appendChild nodContent > > > > >Ideas please! :) > >joel > > > XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list > XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Coding and node context under, Joel P Thornton | Thread | [xsl] How to use xsl:key to get all, Di Luo |
Re: [xsl] select only first node, Ronald | Date | RE: [xsl] select only first node, Chris Bayes |
Month |