| View previous topic :: View next topic |
| Author |
Message |
Thomas Miller Guest
|
|
| Back to top |
|
 |
Bob S Guest
|
Posted: Fri Jun 23, 2006 10:39 pm Post subject: Re: XML Parser |
|
|
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
|
Posted: Fri Jun 23, 2006 10:55 pm Post subject: Re: XML Parser |
|
|
"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
|
Posted: Sat Jun 24, 2006 12:03 am Post subject: Re: XML Parser |
|
|
Thanks. I figured there was something in there, but since I am more a
database guy, I didn't know what to look for .
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
|
Posted: Sat Jun 24, 2006 3:28 am Post subject: Re: XML Parser |
|
|
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 |
|
 |
|