🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.delphi.xml
1 messages
1 total messages Started by user Thu, 05 Jun 2008 13:24
IXMLNode.CloneNode question
#180
Author: user
Date: Thu, 05 Jun 2008 13:24
37 lines
2410 bytes
I defined an XSD Schema for my data files, and used the XML data binding 
wizard to generate the Pascal binding.  Very cool!  But now I'm having 
some problems, and I'm sure I'm missing something fundamental.  At 
various times, I want to clone a node for later use - for example, I 
want the user to be able to select a node, issue a "Copy" command, and 
later be able to "Paste" the node, possibly into another data structure 
representing a different file.

Here's an example:

1.    procedure DoSomething(src: IXMLMyNode);
2.    var dest: IXMLMyNode;	// IXMLMyNode is derived from IXMLNode
                                 // by XML data binding wizard
       begin
3.      dest := IXMLMyNode(src.CloneNode(True));
4.      dest.SubNodes.Clear;
       end;

Questions:

1. Line 3 is admittedly rather suspect, but CloneNode is not virtual, so 
I don't know what to do.  What is the proper way to do this?  How can I 
create a copy of an existing XML node?  Do I need to write a 
function/procedure, and if so, what does its signature look like?

2. If I set a breakpoint on line 4, and put the cursor over dest, the 
tooltip window says: "dest | TXMLNode($B62AD0) as IXMLNodeAccess", even 
though dest is explicitly declared as an IXMLMyNode (see line 2).  I 
have no idea what IXMLNodeAccess, as the help file says simply "This is 
class XMLDoc.IXMLNodeAccess."

3. Can a node exist outside of a XMLDocument, such that it can be 
inserted into other documents, or simply used locally without ever 
existing in a file?

Thanks,
-Bob
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads