Article View: borland.public.cppbuilder.internet.web
Article #1563Re: deleting a TXMLDocument
From: Fabi�n
Date: Sat, 18 Sep 2004 04:23
Date: Sat, 18 Sep 2004 04:23
91 lines
3360 bytes
3360 bytes
I didn't explained the code I send very well.
I delete the xmldocument allways. After the catch there is a lot of code
that reads the xml.
If I put this in a button
XMLDocument = new TXMLDocument("");
delete XMLDocument;
it works....
but this trows an error at runtime:
AnsiString Texto, Evento, Room_id;
TXMLDocument *XMLDocument;
_di_IXMLNode Nodo;
XMLDocument = new TXMLDocument("");
try
{
Texto = Socket->ReceiveText();
Memo1->Lines->Add(Texto);
try
{
XMLDocument->LoadFromXML(WideString(Texto));
Nodo = XMLDocument->DocumentElement->ChildNodes->GetNode(0); //here
Evento = Nodo->Attributes[WideString("name")];
(...)
I readed somewhere that this error happends because ther is a problem with
the sincronization or something like that.
so I use this code that works fine:
AnsiString Texto, Evento, Room_id;
TXMLDocument *XMLDocument;
_di_IXMLDocument d;
_di_IXMLNode Nodo;
XMLDocument = new TXMLDocument("");
try
{
Texto = Socket->ReceiveText();
Memo1->Lines->Add(Texto);
try
{
XMLDocument->GetInterface(d);
d->LoadFromXML(WideString(Texto));
Nodo = XMLDocument->DocumentElement->ChildNodes->GetNode(0);
Evento = Nodo->Attributes[WideString("name")];
but i can not delete XMLDocument.
I think that the problem in this line: XMLDocument->GetInterface(d);
well... the problem is very strange...
I hope you can help me.
Fabi�n
"Hans Galema" <dontusethis@dontusethis.nl> escribi� en el mensaje
news:414a8efe@newsgroups.borland.com...
> Fabi�n wrote:
> > yes, the error is at runtime... the classic acces violation at address
> > 000000000.... error reading....
>
> You only delete XMLDocument in case there is a catch.
> You are executing this code in ServerSocket1ClientRead().
>
> In case there is no catch what does delete XMLDocument; do ?
>
> What has this AV to do with ServerSocket1ClientRead() and with a
> failing try ?
>
> What I like to know if you just have the two statements
>
> XMLDocument = new TXMLDocument("");
> delete XMLDocument;
>
> in for instance an TButton's OnClick handler, if you then get the same
error.
>
> Hans.
Technical Details
Message-ID:
<414bb86a@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!fr.ip.ndsoftware.net!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<4148c0b5@newsgroups.borland.com> <41499f8e$1@newsgroups.borland.com> <414a2597$1@newsgroups.borland.com> <414a8efe@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: feeec,857cefac094b3c55 X-Google-Attributes: gidfeeec,public X-Google-Language: ENGLISH,ASCII Reply-To: "Fabi�n" <fabianfierro@hotmail.com> From: "Fabi�n" <fabianfierro@hotmail.com> Newsgroups: borland.public.cppbuilder.internet.web References: <4148c0b5@newsgroups.borland.com> <41499f8e$1@newsgroups.borland.com> <414a2597$1@newsgroups.borland.com> <414a8efe@newsgroups.borland.com> Subject: Re: deleting a TXMLDocument Date: Sat, 18 Sep 2004 01:23:58 -0300 Lines: 93 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 NNTP-Posting-Host: 200.55.107.242 Message-ID: <414bb86a@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1095481450 200.55.107.242 (17 Sep 2004 21:24:10 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!fr.ip.ndsoftware.net!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail