From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,55f7b17fb2df41a X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-10-15 13:14:47 PST Path: archiver1.google.com!news1.google.com!sn-xit-02!sn-post-01!supernews.com!corp.supernews.com!not-for-mail From: Al Christians Newsgroups: comp.lang.ada Subject: Re: XML for Win32 Date: Mon, 15 Oct 2001 13:14:49 -0700 Organization: Public Property Software Message-ID: <3BCB43B9.1D861B23@easystreet.com> X-Mailer: Mozilla 4.76 [en] (WinNT; U) X-Accept-Language: en MIME-Version: 1.0 References: <3BCB1D6F.1B3468C1@easystreet.com> <3BCB3F12.3CDBC35E@easystreet.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Complaints-To: newsabuse@supernews.com Xref: archiver1.google.com comp.lang.ada:14583 Date: 2001-10-15T13:14:49-07:00 List-Id: At first glance, the following appears to work as a variant of the Win32-XML code from AdaPower. What should I straighten out? Al ----------------------Code Follows----------------------- with GNAT.IO; use GNAT.IO; with Interfaces.C; with GnatCom.Types; with GnatCom.BSTR; use GnatCom.BSTR; with GnatCom.Variant; use GnatCom.Variant; with GnatCom.Initialize; with MSXML; with MSXML.IXMLDomDocument_Interface; use MSXML.IXMLDomDocument_Interface; with MSXML.IXMLDomNode_Interface; with MSXML.IXMLDomNodeList_Interface; use MSXML; procedure XMLWalk is use type GnatCom.Types.VARIANT_BOOL; -- Document : Dispinterface_Type; Document : MSXML.IXMLDomDocument_Interface.IXMLDomDocument_Type; Node : IXMLDOMNode_Interface.IXMLDOMNode_Type; Input_File : aliased GnatCom.Types.Variant := To_Variant("J:\QAReview\Src\test.xml"); Result : GnatCom.Types.Variant_Bool; procedure Walk (Node : IXMLDOMNode_Interface.IXMLDOMNode_Type; Level : Integer := 0) is use type Interfaces.C.Long; Node_List : IXMLDOMNodeList_Interface.IXMLDOMNodeList_Type; M : Interfaces.C.Long; Name : GnatCom.Types.BSTR; Value : GnatCom.Types.Variant; begin begin Name := IXMLDOMNode_Interface.Get_NodeName(Node); Value := IXMLDOMNode_Interface.Get_NodeValue(Node); exception when others => Initialize(Value); end; for N in 1 .. Level loop Put(" "); end loop; Put_Line("Name: " & To_Ada(Name) & " Value: " & To_Ada(Value) & " Level: " & Integer'Image(Level)); IXMLDOMNodeList_Interface.Attach (Node_List, IXMLDOMNode_Interface.Get_ChildNodes(Node)); M := IXMLDOMNodeList_Interface.Get_Length(Node_List); Put_Line("Nodes:" & Natural'Image(Natural(M))); for N in 1 .. M loop declare Next_Node : IXMLDOMNode_Interface.IXMLDOMNode_Type; begin IXMLDOMNode_Interface.Attach (Next_Node, IXMLDOMNodeList_Interface.NextNode(Node_List)); Walk(Next_Node, Level+1); end; end loop; GnatCom.BSTR.Free(Name); GnatCom.Variant.Free(Value); end Walk; begin GnatCom.Initialize.Initialize_Com; Put_Line("Creating Document..."); Create( Document, CLSID_DOMDocument); IXMLDOMDocument_Interface.Put_Async(Document, 0); Put_Line("Loading Document..."); Result := IXMLDomDocument_Interface.Load(Document, Input_File); if Result /= 0 then Put_Line("Document Loaded..."); MSXML.IXMLDomNode_Interface.Attach( Node, cloneNode(Document, -1)); Walk(Node); end if; Free(Input_File); end XMLWalk;