🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.internet.socket
Article #4012

how to create XMLDocument from text string

#4012
From: Daniel Stevenson
Date: Wed, 27 Apr 2005 06:26
28 lines
1866 bytes
I'm using BCB6, i have an application with a TServerSocket, I am being sent
XML to my socket and I am struggling to turn the text string into a valid
XML document using TXMLDocument.

my code is...

//--------------------------------------------------------------------------
-
void __fastcall TMyService::SocketRead(TObject *Sender,
      TCustomWinSocket *Socket)
{
  AnsiString RxBuffer = Socket->ReceiveText();

  TXMLDocument *XML = new TXMLDocument("");
  XML->Options = XML->Options << doNodeAutoIndent;
  XML->XML->Text = RxBuffer;              \\  <--I'm making my mistake here
but no error occurs

  _di_IXMLNodeList NodeList = XML->ChildNodes;      \\  <--error occurs here
as it is not in the correct XML format
  _di_IXMLNode Node = NodeList->FindNode(L"Status");
  AnsiString ServiceType = Node->GetAttribute(L"service");
}
//--------------------------------------------------------------------------
-


What is the correct method of attempting to import text into an XMLDocument?
Technical Details
Message-ID: <426f30b1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!news-out.nntp.be!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,202e5b119b206323,start
X-Google-Attributes: gid11508e,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Daniel Stevenson" <daniel@ocreage.com.au>
Newsgroups: borland.public.cppbuilder.internet.socket
Subject: how to create XMLDocument from text string
Date: Wed, 27 Apr 2005 16:26:56 +1000
Lines: 30
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
NNTP-Posting-Host: 202.174.233.53
Message-ID: <426f30b1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1114583217 202.174.233.53 (26 Apr 2005 23:26:57 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!news-out.nntp.be!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail