🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.internet.web
Article #1566

Re: deleting a TXMLDocument

#1566
From: Remy Lebeau (TeamB)
Date: Mon, 20 Sep 2004 22:35
44 lines
2341 bytes
"Fabi�n" <fabianfierro@hotmail.com> wrote in message
news:4148c0b5@newsgroups.borland.com...

> hi...  I'm creating XMLDocuments dinamicaly, but I don't know
> how to delete them. If I use:  delete XMLDocument;     the
> compiler throws an error.

TXMLDocument is a special-case class.  It does not act like other classes.
When dropped onto a form at design-time, it acts like a component.  When
instantiated dynamically at runtime, it acts like an interface instead.  As
such, you should not instantiate TXMLDocument dynamically at all.  Use the
IXMLDocument interface directly instead, via the NewXMLDocument() function.
For example:

    void __fastcall TFMain::ServerSocket1ClientRead(TObject *Sender,
TCustomWinSocket *Socket)
    {
        AnsiString Texto, Evento, Room_id;
        _di_IXMLDocument XMLDocument;
        _di_IXMLNode Nodo;

        Texto = Socket->ReceiveText();
        Memo1->Lines->Add(Texto);

        XMLDocument = NewXMLDocument("");
        try
        {
            XMLDocument->LoadFromXML(Texto);
            Nodo = XMLDocument->DocumentElement->ChildNodes->GetNode(0);
            Evento = Nodo->Attributes["name"];
        }
        catch (const Exception &)
        {
            //...
        }
    }

When the _di_IXMLDocument wrapper goes out of scope, it will automatically
free the IXMLDocument for you, the same thing that the _di_IXMLNode wrapper
does for the IXMLNode as well.


Gambit
Technical Details
Message-ID: <414f5a90$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!npeer.de.kpn-eurorings.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <4148c0b5@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: feeec,857cefac094b3c55
X-Google-Attributes: gidfeeec,public
X-Google-Language: ENGLISH,ASCII
From: "Remy Lebeau \(TeamB\)" <no.spam@no.spam.com>
Newsgroups: borland.public.cppbuilder.internet.web
References: <4148c0b5@newsgroups.borland.com>
Subject: Re: deleting a TXMLDocument
Date: Mon, 20 Sep 2004 15:35:08 -0700
Lines: 46
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1409
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409
NNTP-Posting-Host: 68.69.17.41
Message-ID: <414f5a90$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1095719568 68.69.17.41 (20 Sep 2004 15:32:48 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!npeer.de.kpn-eurorings.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail