Solved

IXMLDOMSelection::Clone - Why would one use this function?

Posted on 2001-08-20
2
646 Views
Last Modified: 2007-12-19
When I tried to this function after a selectNodes call, it did not clone the nodes in the list.  I would have to call cloneNode to actually clone the node itself.  Therefore, I was wondering, what would someone use this function for?


Here is a Microsoft example of the Clone function:
//Create a DOMDocument2 object and load some XML:
xmldoc = new ActiveXObject("Msxml2.DOMDocument");
xmldoc.loadXML("<root><elem1>foo</elem1><elem2>bar</elem2></root>");
//Create an XMLDOMSelection object from selected nodes:
xpath = xmldoc.selectNodes("root/elem1");
//Cache the XPath expression and context:
xpath.expr = "root/elem1";
xpath.context = xmldoc;

//Clone the XMLDOMSelection object
xpath2 = xpath.clone();
temp1 = xpath.peekNode();  // temp1 == <elem1/>
temp2 = xpath2.peekNode();  // temp2 == <elem1/> Note the position and context are maintained.


0
Comment
Question by:sgerlach
2 Comments
 
LVL 3

Accepted Solution

by:
elcapitan earned 50 total points
ID: 6409428
As you noticed, IXMLDOMSelection::Clone() Clones a copy of the current IXMLDOMSelection, with the same position and context, i.e. it clones the result of the xpath or xsl pattern query. In order to clone a node you need to call IXMLDomeNode::CloneNode().

>>, I was wondering, what would someone
use this function for?
Well, I never had to clone a selection, but hey, if you'll be required to do that, you have the tool for the job. :-)

--EC--
0
 
LVL 1

Expert Comment

by:Moondancer
ID: 6789927
It's time to clean up this topic area and that means taking care of this question. Your options at this point are:

1. Award points to the Expert who provided an answer, or who helped you most. Do this by clicking on the "Accept Comment as Answer" button that lies above and to the right of the appropriate expert's name.

2. PAQ the question because the information might be useful to others, but was not useful to you. To use this option, you must state why the question is no longer useful to you, and the experts need to let me know if they feel that you're being unfair.

3.  Ask Community Support to help split points between participating experts.  Just comment here with details.

4.  Delete the question because it is of no value to you or to anyone else.  To use this option, you must state why the question is no longer useful to you, and the experts need to let me know if they feel that you're being unfair.

If you elect for option 2, 3 or 4, just post comment with details here and I'll take it from there.  We also request that you review any other open questions you might have and update/close them.  Display all your question history from your Member Profile to view details.

PLEASE DO NOT AWARD THE POINTS TO ME.
____________________________________________
---------->  Hi Experts:

In the event that the Asker does not respond, I would very much appreciate your opinions as to which Expert ought to receive points (if any) as a result of this question.  Likewise, you can also suggest that I PAQ or delete the question.

------------->  The ALL TOPICS link has been updated today to reflect all the new TAs.

Thank you everyone.

Moondancer :)
Community Support Moderator @ Experts Exchange
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

The Client Need Led Us to RSS I recently had an investment company ask me how they might notify their constituents about their newsworthy publications.  Probably you would think "Facebook" or "Twitter" but this is an interesting client.  Their cons…
The Confluence of Individual Knowledge and the Collective Intelligence At this writing (summer 2013) the term API (http://dictionary.reference.com/browse/API?s=t) has made its way into the popular lexicon of the English language.  A few years ago, …
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question