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:
CREATE PROCEDURE ChilkatSample AS BEGIN DECLARE @hr int DECLARE @xml0 int EXEC @hr = sp_OACreate 'Chilkat.Xml', @xml0 OUT IF @hr <> 0 BEGIN PRINT 'Failed to create ActiveX component' RETURN END DECLARE @xml int -- 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: EXEC sp_OAMethod @xml0, 'HttpGet', @xml OUT, '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. DECLARE @bookNode int EXEC sp_OAMethod @xml, 'GetChild', @bookNode OUT, 0 -- Set titleNode equal to the title child of bookNode: DECLARE @titleNode int EXEC sp_OAMethod @bookNode, 'GetChildWithTag', @titleNode OUT, 'title' -- Call GetParent to return a new object pointing to the parent node: DECLARE @bookNode2 int EXEC sp_OAMethod @titleNode, 'GetParent', @bookNode2 OUT -- 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: EXEC sp_OAMethod @titleNode, 'GetParent2', NULL -- 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: DECLARE @str1 nvarchar(4000) DECLARE @str2 nvarchar(4000) DECLARE @str3 nvarchar(4000) EXEC sp_OAMethod @bookNode, 'GetXml', @str1 OUT EXEC sp_OAMethod @bookNode2, 'GetXml', @str2 OUT EXEC sp_OAMethod @titleNode, 'GetXml', @str3 OUT PRINT @str1 PRINT @str2 PRINT @str3 END GO |
Need a specific example? Send a request to support@chilkatsoft.com
© 2000-2007 Chilkat Software, Inc. All Rights Reserved.