Solved

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

Posted on 2001-08-20
2
634 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
Comment Utility
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
Comment Utility
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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

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, …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

763 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now