asked on
ASKER
Delphi is the most powerful Object Pascal IDE and component library for cross-platform Native App Development with flexible Cloud services and broad IoT connectivity. It provides powerful VCL controls for Windows 10 and enables FMX development for Windows, Mac and Mobile. Delphi is your choice for ultrafast Enterprise Strong Development™. Look for increased memory for large projects, extended multi-monitor support, improved Object Inspector and much more. Delphi is 5x faster for development and deployment across multiple desktop, mobile, cloud and database platforms including 32-bit and 64-bit Windows 10.
TRUSTED BY
unit uxmltoado;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, MSXML2_TLB, DB, ADODB, Grids, DBGrids, StdCtrls, ActiveX, COMObj;
type
TForm1 = class(TForm)
Memo1: TMemo;
Button1: TButton;
DataSource1: TDataSource;
DBGrid1: TDBGrid;
ADOTable1: TADOTable;
ADOConnection1: TADOConnection;
ADOTable1type: TWideStringField;
ADOTable1value: TWideStringField;
ADOTable1align: TWideStringField;
ADOTable1face: TWideStringField;
ADOTable1size: TWideStringField;
ADOTable1style: TWideStringField;
ADOTable1voffset: TWideStringField;
ADOTable1mroffset: TWideStringField;
ADOTable1break: TWideStringField;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender
var
oXMLDoc: IXMLDOMDocument2;
s: String;
oTicketNodeList: IXMLDOMNodeList;
oDataNodeList: IXMLDOMNodeList;
oDataNode: IXMLDOMNode;
oDataAttribs: IXMLDOMNamedNodeMap;
oDataAttrib: IXMLDOMNode;
i, j, x: Integer;
sType: String;
sValue: String;
sAlign: String;
sFace: String;
sSize: String;
sStyle: String;
sVoffset: String;
sMroffset: String;
sBreak: String;
begin
oXMLDoc := CreateOleObject('MSXML2.DO
try
s := StringReplace(StringReplac
oXMLDoc.loadXML(s);
// GET the ticket nodes
oTicketNodeList := oXMLDoc.selectNodes('//Tic
for i := 0 to oTicketNodeList.length-1 do
begin
// get the DATA nodes
oDataNodeList := oTicketNodeList.item[i].ch
for j := 0 to oDataNodeList.length-1 do
begin
oDataNode := oDataNodeList.item[j];
// Get the Attributes of the DATA node
// Clear out old values from last DATA node.
sType := '';
sValue := '';
sAlign := '';
sFace := '';
sSize := '';
sStyle := '';
sVoffset := '';
sMroffset := '';
sBreak := '';
oDataAttribs := oDataNode.attributes;
for x := 0 to oDataAttribs.length-1 do
begin
oDataAttrib := oDataAttribs.item[x];
if oDataAttrib.nodeName = 'type' then
sType := oDataAttrib.text;
if oDataAttrib.nodeName = 'value' then
sValue := oDataAttrib.text;
if oDataAttrib.nodeName = 'align' then
sAlign := oDataAttrib.text;
if oDataAttrib.nodeName = 'face' then
sFace := oDataAttrib.text;
if oDataAttrib.nodeName = 'size' then
sSize := oDataAttrib.text;
if oDataAttrib.nodeName = 'style' then
sStyle := oDataAttrib.text;
if oDataAttrib.nodeName = 'voffset' then
sVoffset := oDataAttrib.text;
if oDataAttrib.nodeName = 'mroffset' then
sMroffset := oDataAttrib.text;
if oDataAttrib.nodeName = 'break' then
sBreak := oDataAttrib.text;
end;
ADOTable1.InsertRecord([sT
Application.ProcessMessage
end;
end;
finally
oXMLDoc := nil;
end;
end;
end.