Chilkat HOME ASP Visual Basic VB.NET C# Visual C++ C MFC Delphi FoxPro Java Perl PHP Python Ruby SQL Server VBScript
|
How to use GetParent and GetParent2How to use GetParent and GetParent2. This is a snippet of the document used in this example:
Chilkat.Xml xml0 = new Chilkat.Xml(); Chilkat.Xml xml = null; // The Chilkat XML component is freeware. // Load an XML document. Typically you might call LoadXml // to load an XML file. This example loads an XML file from // a URL: xml = xml0.HttpGet("http://www.chilkatsoft.com/testData/bookstore.xml"); // The xml object points to the root node of the XML document. // Set bookNode equal to the 1st child of the root. Chilkat.Xml bookNode = null; bookNode = xml.GetChild(0); // Set titleNode equal to the title child of bookNode: Chilkat.Xml titleNode = null; titleNode = bookNode.GetChildWithTag("title"); // Call GetParent to return a new object pointing to the parent node: Chilkat.Xml bookNode2 = null; bookNode2 = titleNode.GetParent(); // bookNode2 and bookNode point to the same node. // Call GetParent2 (which returns nothing) to modify the internal // pointer within the calling object so that it points to the immediate parent: titleNode.GetParent2(); // Now titleNode points to the same node as bookNode2 and bookNode. // To prove it, generate the XML sub-tree rooted at the calling // node and display each: string str1; string str2; string str3; str1 = bookNode.GetXml(); str2 = bookNode2.GetXml(); str3 = titleNode.GetXml(); textBox1.Text += str1 + "\r\n"; textBox1.Text += str2 + "\r\n"; textBox1.Text += str3 + "\r\n"; |
Need a specific example? Send a request to support@chilkatsoft.com
© 2000-2008 Chilkat Software, Inc. All Rights Reserved.