BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

XML Parser

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Thirdparty Tools (General)
View previous topic :: View next topic  
Author Message
Thomas Miller
Guest





PostPosted: Fri Jun 23, 2006 9:36 pm    Post subject: XML Parser Reply with quote



I have an XML WideString (not a file) that I need to find a Node/Value
pair (actually several of them). Anyone know of any utilities that can
do that? Is this built in to Delphi already (D2006). Thanks.


--
Thomas Miller
Chrome Portal Project Manager
CPCUG Programmers SIG Chairperson (formally Delphi)
Delphi Client/Server Certified Developer
BSS Accounting & Distribution Software
BSS Enterprise Accounting FrameWork

http://www.bss-software.com
http://programmers.cpcug.org/
http://sourceforge.net/projects/chromeportal/
http://sourceforge.net/projects/uopl/
http://sourceforge.net/projects/dbexpressplus
Back to top
Bob S
Guest





PostPosted: Fri Jun 23, 2006 10:39 pm    Post subject: Re: XML Parser Reply with quote



I don't have D2006, but D7... so I don't know about D006. A couple you might check out:

NativeXml
http://www.simdesign.nl/xml.html

ATagParser
http://www.compnet101.com/atagparser/

Thomas Miller <tmiller@bss-software.com> wrote:
Quote:
I have an XML WideString (not a file) that I need to find a Node/Value
pair (actually several of them). Anyone know of any utilities that can
do that? Is this built in to Delphi already (D2006). Thanks.
Back to top
Remy Lebeau (TeamB)
Guest





PostPosted: Fri Jun 23, 2006 10:55 pm    Post subject: Re: XML Parser Reply with quote



"Thomas Miller" <tmiller@bss-software.com> wrote in message
news:449c1877$1 (AT) newsgroups (DOT) borland.com...

Quote:
I have an XML WideString (not a file) that I need to find a Node/Value
pair (actually several of them). Anyone know of any utilities that can
do that? Is this built in to Delphi already (D2006).

Look at the TXMLDocument component, which has been available in Delphi since
D6.


Gambit
Back to top
Thomas Miller
Guest





PostPosted: Sat Jun 24, 2006 12:03 am    Post subject: Re: XML Parser Reply with quote

Thanks. I figured there was something in there, but since I am more a
database guy, I didn't know what to look for Smile .

Remy Lebeau (TeamB) wrote:
Quote:
"Thomas Miller" <tmiller@bss-software.com> wrote in message
news:449c1877$1 (AT) newsgroups (DOT) borland.com...

I have an XML WideString (not a file) that I need to find a Node/Value
pair (actually several of them). Anyone know of any utilities that can
do that? Is this built in to Delphi already (D2006).

Look at the TXMLDocument component, which has been available in Delphi since
D6.


Gambit



--
Thomas Miller
Chrome Portal Project Manager
CPCUG Programmers SIG Chairperson (formally Delphi)
Delphi Client/Server Certified Developer
BSS Accounting & Distribution Software
BSS Enterprise Accounting FrameWork

http://www.bss-software.com
http://programmers.cpcug.org/
http://sourceforge.net/projects/chromeportal/
http://sourceforge.net/projects/uopl/
http://sourceforge.net/projects/dbexpressplus
Back to top
William Egge
Guest





PostPosted: Sat Jun 24, 2006 3:28 am    Post subject: Re: XML Parser Reply with quote

The microsoft MSXML library will do it. You need to import the type library.

This unit might help you get started:

================
unit SimpleXML;

interface
uses
MSXML2_TLB;

type
TSimpleXML = class
private
FDom: DOMDocument40;
FCurrNode, FLastNode: IXMLDOMNode;
function GetValue(Attribute: string): string;
function GetEOF: Boolean;
public
procedure LoadXMLFile(const AFileName: string);
procedure LoadXMLText(const AText: string);
property Value[Attribute: string]: string read GetValue; default;
procedure OpenSubNodes(const NodeName: string);
property EOF: Boolean read GetEOF;
procedure MoveNext;
end;

implementation

{ TSimpleXML }

procedure TSimpleXML.LoadXMLFile(const AFileName: string);
begin
FCurrNode:= nil;
FDom:= nil;
FLastNode:= nil;
FDom:= CoDOMDocument40.Create;
try
FDom.async:= False;
FDom.Load(AFileName);
except
FDom:= nil;
raise;
end;
end;

procedure TSimpleXML.LoadXMLText(const AText: string);
begin
FCurrNode:= nil;
FDom:= nil;
FLastNode:= nil;
FDom:= CoDOMDocument40.Create;
try
FDom.async:= False;
FDom.LoadXML(AText);
except
FDom:= nil;
raise;
end;
end;

function TSimpleXML.GetValue(Attribute: string): string;
begin
Result:= FCurrNode.attributes.getNamedItem(Attribute).text;
end;

function TSimpleXML.GetEOF: Boolean;
begin
Result:= FCurrNode = nil;
end;

procedure TSimpleXML.MoveNext;
begin
FCurrNode:= FLastNode.nextSibling;
if FCurrNode <> nil then
FLastNode:= FCurrNode;
end;

procedure TSimpleXML.OpenSubNodes(const NodeName: string);
begin
if FLastNode <> nil then
FCurrNode:= FLastNode.selectSingleNode(NodeName)
else
FCurrNode:= FDom.selectSingleNode(NodeName);

if FCurrNode <> nil then
FLastNode:= FCurrNode;
end;

end.

=================


"Remy Lebeau (TeamB)" <no.spam (AT) no (DOT) spam.com> wrote in message
news:449c2ba0$3 (AT) newsgroups (DOT) borland.com...
Quote:

"Thomas Miller" <tmiller@bss-software.com> wrote in message
news:449c1877$1 (AT) newsgroups (DOT) borland.com...

I have an XML WideString (not a file) that I need to find a Node/Value
pair (actually several of them). Anyone know of any utilities that can
do that? Is this built in to Delphi already (D2006).

Look at the TXMLDocument component, which has been available in Delphi since
D6.


Gambit

Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Thirdparty Tools (General) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.