Chilkat HOME ASP Visual Basic VB.NET C# Visual C++ C MFC Delphi FoxPro Java Perl PHP Python Ruby SQL Server VBScript
|
Create XML Child Nodes with AttributesHow to create XML child nodes with attributes. CREATE PROCEDURE ChilkatSample AS BEGIN DECLARE @hr int DECLARE @iTmp0 int DECLARE @xml int EXEC @hr = sp_OACreate 'Chilkat.Xml', @xml OUT IF @hr <> 0 BEGIN PRINT 'Failed to create ActiveX component' RETURN END -- The Chilkat XML component is freeware. EXEC sp_OASetProperty @xml, 'Tag', 'product' DECLARE @xNode0 int EXEC sp_OAMethod @xml, 'NewChild', @xNode0 OUT, 'properties', '' DECLARE @xChild int EXEC sp_OAMethod @xNode0, 'NewChild', @xChild OUT, 'price', '' EXEC sp_OAMethod @xChild, 'AddAttribute', NULL, 'SellPrice', '11.99' EXEC sp_OAMethod @xNode0, 'NewChild', @xChild OUT, 'price', '' EXEC sp_OAMethod @xChild, 'AddAttribute', NULL, 'BasePrice', '11.99' EXEC sp_OAMethod @xml, 'GetXml', @iTmp0 OUT PRINT @iTmp0 -- Prints this: -- <product> -- <properties> -- <price SellPrice="11.99"></price> -- <price BasePrice="11.99"></price> -- </properties> -- </product> END GO |
Need a specific example? Send a request to support@chilkatsoft.com
© 2000-2007 Chilkat Software, Inc. All Rights Reserved.