Delphi compatibility fix ( node filtering )

Add Delphi amazon sample

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@239 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
inoussa
2007-08-13 18:12:23 +00:00
parent 1b7b1d4349
commit 65dab20c6f
7 changed files with 417 additions and 149 deletions

View File

@ -1764,15 +1764,10 @@ end;
{ TEmbeddedArrayStackItem } { TEmbeddedArrayStackItem }
function TEmbeddedArrayStackItem.CreateList(const ANodeName: string): TDOMNodeList; function TEmbeddedArrayStackItem.CreateList(const ANodeName: string): TDOMNodeList;
{$IFNDEF FPC}
var
slct : IDOMNodeSelect;
{$ENDIF}
begin begin
if ScopeObject.HasChildNodes() then begin if ScopeObject.HasChildNodes() then begin
{$IFNDEF FPC} {$IFNDEF FPC}
slct := ScopeObject as IDOMNodeSelect; Result := FilterList(ScopeObject.childNodes,ANodeName);
Result := slct.selectNodes(ANodeName); //ScopeObject.childNodes;
{$ELSE} {$ELSE}
Result := {$IFNDEF FPC_211}TDOMNodeList{$ELSE}TDOMElementList{$ENDIF}.Create(ScopeObject,ANodeName); Result := {$IFNDEF FPC_211}TDOMNodeList{$ELSE}TDOMElementList{$ENDIF}.Create(ScopeObject,ANodeName);
{$ENDIF} {$ENDIF}

View File

@ -0,0 +1,43 @@
-$A8
-$B-
-$C+
-$D+
-$E-
-$F-
-$G+
-$H+
-$I+
-$J-
-$K-
-$L+
-$M-
-$N+
-$O+
-$P+
-$Q-
-$R-
-$S-
-$T-
-$U-
-$V+
-$W-
-$X+
-$YD
-$Z1
-cg
-AWinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;
-H+
-W+
-M
-$M16384,1048576
-K$00400000
-N"obj"
-LE"c:\program files\borland\delphi7\Projects\Bpl"
-LN"c:\program files\borland\delphi7\Projects\Bpl"
-U"..\..\;..\..\..\;C:\Program Files\Borland\Delphi7\plate_forme\synapse"
-O"..\..\;..\..\..\;C:\Program Files\Borland\Delphi7\plate_forme\synapse"
-I"..\..\;..\..\..\;C:\Program Files\Borland\Delphi7\plate_forme\synapse"
-R"..\..\;..\..\..\;C:\Program Files\Borland\Delphi7\plate_forme\synapse"
-w-UNSAFE_TYPE
-w-UNSAFE_CODE
-w-UNSAFE_CAST

View File

@ -0,0 +1,159 @@
[FileVersion]
Version=7.0
[Compiler]
A=8
B=0
C=1
D=1
E=0
F=0
G=1
H=1
I=1
J=0
K=0
L=1
M=0
N=1
O=1
P=1
Q=0
R=0
S=0
T=0
U=0
V=1
W=0
X=1
Y=1
Z=1
ShowHints=1
ShowWarnings=1
UnitAliases=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;
NamespacePrefix=
SymbolDeprecated=1
SymbolLibrary=1
SymbolPlatform=1
UnitLibrary=1
UnitPlatform=1
UnitDeprecated=1
HResultCompat=1
HidingMember=1
HiddenVirtual=1
Garbage=1
BoundsError=1
ZeroNilCompat=1
StringConstTruncated=1
ForLoopVarVarPar=1
TypedConstVarPar=1
AsgToTypedConst=1
CaseLabelRange=1
ForVariable=1
ConstructingAbstract=1
ComparisonFalse=1
ComparisonTrue=1
ComparingSignedUnsigned=1
CombiningSignedUnsigned=1
UnsupportedConstruct=1
FileOpen=1
FileOpenUnitSrc=1
BadGlobalSymbol=1
DuplicateConstructorDestructor=1
InvalidDirective=1
PackageNoLink=1
PackageThreadVar=1
ImplicitImport=1
HPPEMITIgnored=1
NoRetVal=1
UseBeforeDef=1
ForLoopVarUndef=1
UnitNameMismatch=1
NoCFGFileFound=1
MessageDirective=1
ImplicitVariants=1
UnicodeToLocale=1
LocaleToUnicode=1
ImagebaseMultiple=1
SuspiciousTypecast=1
PrivatePropAccessor=1
UnsafeType=0
UnsafeCode=0
UnsafeCast=0
[Linker]
MapFile=0
OutputObjs=0
ConsoleApp=1
DebugInfo=0
RemoteSymbols=0
MinStackSize=16384
MaxStackSize=1048576
ImageBase=4194304
ExeDescription=
[Directories]
OutputDir=
UnitOutputDir=obj
PackageDLLOutputDir=
PackageDCPOutputDir=
SearchPath=..\..\;..\..\..\;C:\Program Files\Borland\Delphi7\plate_forme\synapse
Packages=vcl;rtl;vclx;indy;inet;xmlrtl;vclie;inetdbbde;inetdbxpress;dbrtl;dsnap;dsnapcon;vcldb;soaprtl;VclSmp;dbexpress;dbxcds;inetdb;bdertl;vcldbx;webdsnap;websnap;adortl;ibxpress;teeui;teedb;tee;dss;visualclx;visualdbclx;vclactnband;vclshlctrls;IntrawebDB_50_70;Intraweb_50_70;Rave50CLX;Rave50VCL;dclOfficeXP;FIBDBMidas7;Jcl;JclVcl;JvCoreD7R;JvSystemD7R;JvStdCtrlsD7R;JvAppFrmD7R;JvBandsD7R;JvDBD7R;JvDlgsD7R;JvBDED7R;JvCmpD7R;JvCryptD7R;JvCtrlsD7R;JvCustomD7R;JvDockingD7R;JvDotNetCtrlsD7R;JvEDID7R;JvGlobusD7R;JvHMID7R;JvInterpreterD7R;JvJansD7R;JvManagedThreadsD7R;JvMMD7R;JvNetD7R;JvPageCompsD7R;JvPluginD7R;JvPrintPreviewD7R;JvRuntimeDesignD7R;JvTimeFrameworkD7R;JvUIBD7R;JvValidatorsD7R;JvWizardD7R;JvXPCtrlsD7R;dxForumLibD7;cxLibraryVCLD7;cxPageControlVCLD7;dxBarD7;dxComnD7;dxBarDBNavD7;dxBarExtItemsD7;dxBarExtDBItemsD7;dxsbD7;dxmdsD7;dxdbtrD7;dxtrmdD7;dxorgcD7;dxdborD7;dxEdtrD7;EQTLD7;ECQDBCD7;EQDBTLD7;EQGridD7;dxGrEdD7;dxExELD7;dxELibD7;cxEditorsVCLD7;cxGridVCLD7;dxThemeD7;cxDataD7;cxGridUtilsVCLD7;dxPSCoreD7;dxPsPrVwAdvD7;dxPSLnksD7;dxPSTeeChartD7;dxPSDBTeeChartD7;dxPSdxDBTVLnkD7;dxPSdxOCLnkD7;dxPSdxDBOCLnkD7;dxPScxGridLnkD7;dxPSTLLnkD7;qrpt
Conditionals=
DebugSourceDirs=
UsePackages=0
[Parameters]
RunParams=
HostApplication=
Launcher=
UseLauncher=0
DebugCWD=
[Language]
ActiveLang=
ProjectLang=
RootDir=C:\Program Files\Borland\Delphi7\Bin\
[Version Info]
IncludeVerInfo=0
AutoIncBuild=0
MajorVer=1
MinorVer=0
Release=0
Build=0
Debug=0
PreRelease=0
Special=0
Private=0
DLL=0
Locale=1036
CodePage=1252
[Version Info Keys]
CompanyName=
FileDescription=
FileVersion=1.0.0.0
InternalName=
LegalCopyright=
LegalTrademarks=
OriginalFilename=
ProductName=
ProductVersion=1.0.0.0
Comments=
[Excluded Packages]
C:\Program Files\Developer Express Inc\ExpressPrinting System\Delphi 7\Lib\dxPSdxDBTLLnkD7.bpl=ExpressPrinting System ReportLink for ExpressQuantumDBTreeList by Developer Express Inc.
C:\Program Files\Developer Express Inc\ExpressPrinting System\Delphi 7\Lib\dxPSdxDBGrLnkD7.bpl=ExpressPrinting System ReportLink for ExpressQuantumGrid by Developer Express Inc.
C:\Program Files\Developer Express Inc\ExpressPrinting System\Delphi 7\Lib\dxPSdxInsLnkD7.bpl=ExpressPrinting System ReportLink for ExpressInspector by Developer Express Inc.
C:\Program Files\Developer Express Inc\ExpressPrinting System\Delphi 7\Lib\dxPSdxOILnkD7.bpl=ExpressPrinting System ReportLink for ExpressRTTIInspector by Developer Express Inc.
C:\Program Files\Developer Express Inc\ExpressPrinting System\Delphi 7\Lib\dxPSdxMVLnkD7.bpl=ExpressPrinting System ReportLink for ExpressMasterView by Developer Express Inc.
C:\Program Files\Developer Express Inc\ExpressPrinting System\Delphi 7\Lib\dxPSdxFCLnkD7.bpl=ExpressPrinting System ReportLinks for ExpressFlowChart by Developer Express Inc.
C:\Program Files\Developer Express Inc\ExpressPrinting System\Delphi 7\Lib\dxPScxSSLnkD7.bpl=ExpressPrinting System ReportLink for ExpressSpreadSheet by Developer Express Inc.
[HistoryLists\hlUnitAliases]
Count=1
Item0=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;
[HistoryLists\hlSearchPath]
Count=7
Item0=..\..\;..\..\..\;C:\Program Files\Borland\Delphi7\plate_forme\synapse
Item1=..\..\;..\..\..\;C:\Program Files\Borland\Delphi7\plate_forme\synapse;..\
Item2=..\..\;..\..\..\
Item3=..\..\
Item4=$(DELPHI)\Lib\Debug;C:\PROGRA~1\Borland\Delphi7\MyTools\JVCL\3.20\jcl\lib\d7\debug;..\..\;..\..\..\;C:\Program Files\Borland\Delphi7\plate_forme\synapse;..\..\..\..\
Item5=..\..\;..\..\..\;C:\Program Files\Borland\Delphi7\plate_forme\synapse;..\..\..\..\
Item6=..\
[HistoryLists\hlUnitOutputDirectory]
Count=1
Item0=obj

View File

@ -0,0 +1,97 @@
program amazon_sample;
{$APPTYPE CONSOLE}
uses
delphi_init_com,
Classes, SysUtils,
soap_formatter,
synapse_http_protocol,
metadata_repository,
AWSECommerceService, AWSECommerceService_proxy;
const sACCES_ID = <your key here>;
function ReadEntry(const APromp : string):string ;
begin
Result := '';
Write(APromp);
while True do begin
ReadLn(Result);
Result := Trim(Result);
if ( Length(Result) > 0 ) then
Break;
end;
end;
var
locService : AWSECommerceServicePortType;
rqst : ItemSearch_Type;
rsps : ItemSearchResponse_Type;
rspsItem : Items_Type;
i, j, k : Integer;
itm : Item_Type;
begin
SYNAPSE_RegisterHTTP_Transport();
WriteLn('Web Services Toolkit Amazon sample');
WriteLn('This sample demonstrates the "ItemSearch" method of the Amazon web service');
WriteLn;
rqst := ItemSearch_Type.Create();
try
locService := wst_CreateInstance_AWSECommerceServicePortType();
rqst.AWSAccessKeyId := sACCES_ID;
while True do begin
rqst.Request.SetLength(1);
rqst.Request[0].SearchIndex := ReadEntry('Enter the Search Index : ');
rqst.Request[0].Availability := Available;
rqst.Request[0].Count := 10;
rqst.Request[0].MerchantId := 'Amazon';
rqst.Request[0].ItemPage := 1;
rqst.Request[0].Keywords := ReadEntry('Enter the Keywords : ');
rsps := locService.ItemSearch(rqst);
if ( rsps.OperationRequest.Errors.Length > 0 ) then begin
WriteLn(Format('Errors ( %d ) : ',[rsps.OperationRequest.Errors.Length]));
for i := 0 to Pred(rsps.OperationRequest.Errors.Length) do begin
WriteLn(Format(' Error[%d] :',[i]));
WriteLn(' ' + rsps.OperationRequest.Errors[i].Code);
WriteLn(' ' + rsps.OperationRequest.Errors[i].Message);
end;
end else begin
WriteLn(Format('Response ( %d ) : ',[rsps.Items.Length]));
if Assigned(rsps) then begin
for i := 0 to Pred(rsps.Items.Length) do begin
rspsItem := rsps.Items[i];
WriteLn(' TotalPages :' + IntToStr(rspsItem.TotalPages));
WriteLn(' TotalResults :' + IntToStr(rspsItem.TotalResults));
WriteLn(' Items :' + IntToStr(rspsItem._Item.Length));
WriteLn('');
for j := 0 to Pred(rspsItem._Item.Length) do begin
itm := rspsItem._Item[j];;
WriteLn(' ASIN :' + itm.ASIN);
WriteLn(' DetailPageURL :' + itm.DetailPageURL);
if Assigned(itm.ItemAttributes) then begin
WriteLn(' Title :' + itm.ItemAttributes.Title);
for k := 0 to Pred(itm.ItemAttributes.Author.Length) do begin
WriteLn(' Author[ ' + IntToStr(k) + ' ] ' + itm.ItemAttributes.Author.Item[k]);
end;
WriteLn(' Manufacturer :' + itm.ItemAttributes.Manufacturer);
WriteLn(' ProductGroup :' + itm.ItemAttributes.ProductGroup);
end;
WriteLn('');
end;
end;
end else begin
WriteLn('Unexpected service response : Invalid response');
end;
end;
WriteLn;
WriteLn;
if ( UpperCase(ReadEntry('Continue ( Y/N ) :'))[1] <> 'Y' ) then
Break;
end;
finally
FreeAndNil(rqst);
FreeAndNil(rsps);
end;
ReadLn;
end.

View File

@ -7,7 +7,7 @@
<MainUnit Value="0"/> <MainUnit Value="0"/>
<IconPath Value="./"/> <IconPath Value="./"/>
<TargetFileExt Value=".exe"/> <TargetFileExt Value=".exe"/>
<ActiveEditorIndexAtStart Value="6"/> <ActiveEditorIndexAtStart Value="0"/>
</General> </General>
<PublishOptions> <PublishOptions>
<Version Value="2"/> <Version Value="2"/>
@ -43,8 +43,8 @@
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<ResourceFilename Value="umain.lrs"/> <ResourceFilename Value="umain.lrs"/>
<UnitName Value="umain"/> <UnitName Value="umain"/>
<CursorPos X="43" Y="158"/> <CursorPos X="1" Y="44"/>
<TopLine Value="138"/> <TopLine Value="52"/>
<EditorIndex Value="0"/> <EditorIndex Value="0"/>
<UsageCount Value="134"/> <UsageCount Value="134"/>
<Loaded Value="True"/> <Loaded Value="True"/>
@ -54,7 +54,7 @@
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<UnitName Value="synapse_http_protocol"/> <UnitName Value="synapse_http_protocol"/>
<CursorPos X="3" Y="15"/> <CursorPos X="3" Y="15"/>
<TopLine Value="1"/> <TopLine Value="146"/>
<EditorIndex Value="1"/> <EditorIndex Value="1"/>
<UsageCount Value="134"/> <UsageCount Value="134"/>
<Loaded Value="True"/> <Loaded Value="True"/>
@ -266,8 +266,8 @@
<Unit30> <Unit30>
<Filename Value="..\files\eBayWSDL.pas"/> <Filename Value="..\files\eBayWSDL.pas"/>
<UnitName Value="eBayWSDL"/> <UnitName Value="eBayWSDL"/>
<CursorPos X="42" Y="43950"/> <CursorPos X="13" Y="43380"/>
<TopLine Value="43950"/> <TopLine Value="43398"/>
<EditorIndex Value="3"/> <EditorIndex Value="3"/>
<UsageCount Value="21"/> <UsageCount Value="21"/>
<Loaded Value="True"/> <Loaded Value="True"/>
@ -363,127 +363,23 @@
<UsageCount Value="10"/> <UsageCount Value="10"/>
</Unit42> </Unit42>
</Units> </Units>
<JumpHistory Count="30" HistoryIndex="29"> <JumpHistory Count="4" HistoryIndex="3">
<Position1> <Position1>
<Filename Value="..\files\eBayWSDL.pas"/> <Filename Value="umain.pas"/>
<Caret Line="42693" Column="55" TopLine="42678"/> <Caret Line="158" Column="43" TopLine="138"/>
</Position1> </Position1>
<Position2> <Position2>
<Filename Value="..\files\eBayWSDL.pas"/> <Filename Value="umain.pas"/>
<Caret Line="15" Column="28" TopLine="1"/> <Caret Line="75" Column="49" TopLine="60"/>
</Position2> </Position2>
<Position3> <Position3>
<Filename Value="..\files\eBayWSDL.pas"/> <Filename Value="umain.pas"/>
<Caret Line="780" Column="32" TopLine="766"/> <Caret Line="56" Column="34" TopLine="41"/>
</Position3> </Position3>
<Position4> <Position4>
<Filename Value="..\files\eBayWSDL.pas"/> <Filename Value="..\files\eBayWSDL.pas"/>
<Caret Line="15809" Column="18" TopLine="15795"/> <Caret Line="42145" Column="24" TopLine="42141"/>
</Position4> </Position4>
<Position5>
<Filename Value="..\files\eBayWSDL.pas"/>
<Caret Line="15811" Column="27" TopLine="15796"/>
</Position5>
<Position6>
<Filename Value="..\files\eBayWSDL.pas"/>
<Caret Line="15814" Column="29" TopLine="15799"/>
</Position6>
<Position7>
<Filename Value="..\files\eBayWSDL.pas"/>
<Caret Line="15815" Column="38" TopLine="15800"/>
</Position7>
<Position8>
<Filename Value="..\files\eBayWSDL.pas"/>
<Caret Line="15824" Column="26" TopLine="15806"/>
</Position8>
<Position9>
<Filename Value="..\files\eBayWSDL.pas"/>
<Caret Line="18142" Column="32" TopLine="18127"/>
</Position9>
<Position10>
<Filename Value="..\files\eBayWSDL.pas"/>
<Caret Line="37007" Column="25" TopLine="36992"/>
</Position10>
<Position11>
<Filename Value="..\files\eBayWSDL.pas"/>
<Caret Line="37013" Column="37" TopLine="36997"/>
</Position11>
<Position12>
<Filename Value="..\files\eBayWSDL.pas"/>
<Caret Line="37017" Column="38" TopLine="37002"/>
</Position12>
<Position13>
<Filename Value="..\files\eBayWSDL.pas"/>
<Caret Line="37023" Column="47" TopLine="37007"/>
</Position13>
<Position14>
<Filename Value="..\files\eBayWSDL.pas"/>
<Caret Line="41990" Column="32" TopLine="41976"/>
</Position14>
<Position15>
<Filename Value="..\files\eBayWSDL.pas"/>
<Caret Line="1" Column="1" TopLine="1"/>
</Position15>
<Position16>
<Filename Value="umain.pas"/>
<Caret Line="72" Column="60" TopLine="61"/>
</Position16>
<Position17>
<Filename Value="umain.pas"/>
<Caret Line="158" Column="29" TopLine="149"/>
</Position17>
<Position18>
<Filename Value="..\files\eBayWSDL_proxy.pas"/>
<Caret Line="17" Column="26" TopLine="19"/>
</Position18>
<Position19>
<Filename Value="umain.pas"/>
<Caret Line="178" Column="29" TopLine="158"/>
</Position19>
<Position20>
<Filename Value="..\..\synapse_http_protocol.pas"/>
<Caret Line="68" Column="13" TopLine="54"/>
</Position20>
<Position21>
<Filename Value="..\..\soap_formatter.pas"/>
<Caret Line="171" Column="9" TopLine="153"/>
</Position21>
<Position22>
<Filename Value="..\..\base_soap_formatter.pas"/>
<Caret Line="862" Column="19" TopLine="856"/>
</Position22>
<Position23>
<Filename Value="..\..\soap_formatter.pas"/>
<Caret Line="29" Column="52" TopLine="22"/>
</Position23>
<Position24>
<Filename Value="..\..\service_intf.pas"/>
<Caret Line="40" Column="45" TopLine="16"/>
</Position24>
<Position25>
<Filename Value="..\..\base_service_intf.pas"/>
<Caret Line="126" Column="70" TopLine="109"/>
</Position25>
<Position26>
<Filename Value="..\..\soap_formatter.pas"/>
<Caret Line="29" Column="38" TopLine="22"/>
</Position26>
<Position27>
<Filename Value="..\..\base_soap_formatter.pas"/>
<Caret Line="338" Column="36" TopLine="305"/>
</Position27>
<Position28>
<Filename Value="test_ebay_gui.lpr"/>
<Caret Line="11" Column="56" TopLine="1"/>
</Position28>
<Position29>
<Filename Value="..\files\eBayWSDL.pas"/>
<Caret Line="43974" Column="20" TopLine="43949"/>
</Position29>
<Position30>
<Filename Value="umain.pas"/>
<Caret Line="158" Column="22" TopLine="130"/>
</Position30>
</JumpHistory> </JumpHistory>
</ProjectOptions> </ProjectOptions>
<CompilerOptions> <CompilerOptions>

View File

@ -7,7 +7,7 @@
<MainUnit Value="0"/> <MainUnit Value="0"/>
<IconPath Value="./"/> <IconPath Value="./"/>
<TargetFileExt Value=".exe"/> <TargetFileExt Value=".exe"/>
<ActiveEditorIndexAtStart Value="5"/> <ActiveEditorIndexAtStart Value="4"/>
</General> </General>
<PublishOptions> <PublishOptions>
<Version Value="2"/> <Version Value="2"/>
@ -42,8 +42,8 @@
<Filename Value="testformatter_unit.pas"/> <Filename Value="testformatter_unit.pas"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<UnitName Value="testformatter_unit"/> <UnitName Value="testformatter_unit"/>
<CursorPos X="48" Y="814"/> <CursorPos X="17" Y="1733"/>
<TopLine Value="796"/> <TopLine Value="1726"/>
<EditorIndex Value="4"/> <EditorIndex Value="4"/>
<UsageCount Value="200"/> <UsageCount Value="200"/>
<Bookmarks Count="1"> <Bookmarks Count="1">
@ -73,7 +73,7 @@
<UnitName Value="base_binary_formatter"/> <UnitName Value="base_binary_formatter"/>
<CursorPos X="15" Y="1479"/> <CursorPos X="15" Y="1479"/>
<TopLine Value="1464"/> <TopLine Value="1464"/>
<EditorIndex Value="13"/> <EditorIndex Value="12"/>
<UsageCount Value="200"/> <UsageCount Value="200"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit4> </Unit4>
@ -82,7 +82,7 @@
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<UnitName Value="base_service_intf"/> <UnitName Value="base_service_intf"/>
<CursorPos X="46" Y="4524"/> <CursorPos X="46" Y="4524"/>
<TopLine Value="4504"/> <TopLine Value="4490"/>
<EditorIndex Value="0"/> <EditorIndex Value="0"/>
<UsageCount Value="200"/> <UsageCount Value="200"/>
<Bookmarks Count="2"> <Bookmarks Count="2">
@ -95,8 +95,8 @@
<Filename Value="..\..\base_soap_formatter.pas"/> <Filename Value="..\..\base_soap_formatter.pas"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<UnitName Value="base_soap_formatter"/> <UnitName Value="base_soap_formatter"/>
<CursorPos X="1" Y="1705"/> <CursorPos X="1" Y="1"/>
<TopLine Value="1676"/> <TopLine Value="1"/>
<EditorIndex Value="1"/> <EditorIndex Value="1"/>
<UsageCount Value="200"/> <UsageCount Value="200"/>
<Loaded Value="True"/> <Loaded Value="True"/>
@ -115,7 +115,7 @@
<UnitName Value="binary_streamer"/> <UnitName Value="binary_streamer"/>
<CursorPos X="14" Y="14"/> <CursorPos X="14" Y="14"/>
<TopLine Value="1"/> <TopLine Value="1"/>
<EditorIndex Value="18"/> <EditorIndex Value="17"/>
<UsageCount Value="200"/> <UsageCount Value="200"/>
<Bookmarks Count="1"> <Bookmarks Count="1">
<Item0 X="38" Y="490" ID="2"/> <Item0 X="38" Y="490" ID="2"/>
@ -144,7 +144,7 @@
<UnitName Value="testmetadata_unit"/> <UnitName Value="testmetadata_unit"/>
<CursorPos X="1" Y="1"/> <CursorPos X="1" Y="1"/>
<TopLine Value="1"/> <TopLine Value="1"/>
<EditorIndex Value="15"/> <EditorIndex Value="14"/>
<UsageCount Value="202"/> <UsageCount Value="202"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit11> </Unit11>
@ -174,7 +174,7 @@
<UnitName Value="metadata_wsdl"/> <UnitName Value="metadata_wsdl"/>
<CursorPos X="44" Y="21"/> <CursorPos X="44" Y="21"/>
<TopLine Value="209"/> <TopLine Value="209"/>
<EditorIndex Value="14"/> <EditorIndex Value="13"/>
<UsageCount Value="206"/> <UsageCount Value="206"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit14> </Unit14>
@ -288,7 +288,7 @@
<UnitName Value="test_parserdef"/> <UnitName Value="test_parserdef"/>
<CursorPos X="93" Y="76"/> <CursorPos X="93" Y="76"/>
<TopLine Value="11"/> <TopLine Value="11"/>
<UsageCount Value="173"/> <UsageCount Value="176"/>
</Unit30> </Unit30>
<Unit31> <Unit31>
<Filename Value="..\..\..\..\..\lazarusClean\fpc\2.0.4\source\rtl\inc\objpash.inc"/> <Filename Value="..\..\..\..\..\lazarusClean\fpc\2.0.4\source\rtl\inc\objpash.inc"/>
@ -329,7 +329,7 @@
<CursorPos X="8" Y="1352"/> <CursorPos X="8" Y="1352"/>
<TopLine Value="1335"/> <TopLine Value="1335"/>
<EditorIndex Value="2"/> <EditorIndex Value="2"/>
<UsageCount Value="111"/> <UsageCount Value="114"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit36> </Unit36>
<Unit37> <Unit37>
@ -452,7 +452,7 @@
<UnitName Value="wst_fpc_xml"/> <UnitName Value="wst_fpc_xml"/>
<CursorPos X="8" Y="38"/> <CursorPos X="8" Y="38"/>
<TopLine Value="11"/> <TopLine Value="11"/>
<UsageCount Value="57"/> <UsageCount Value="60"/>
</Unit54> </Unit54>
<Unit55> <Unit55>
<Filename Value="..\..\wst_global.inc"/> <Filename Value="..\..\wst_global.inc"/>
@ -473,8 +473,8 @@
<UnitName Value="test_utilities"/> <UnitName Value="test_utilities"/>
<CursorPos X="29" Y="43"/> <CursorPos X="29" Y="43"/>
<TopLine Value="3"/> <TopLine Value="3"/>
<EditorIndex Value="17"/> <EditorIndex Value="16"/>
<UsageCount Value="48"/> <UsageCount Value="51"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit57> </Unit57>
<Unit58> <Unit58>
@ -489,8 +489,8 @@
<UnitName Value="testregistry"/> <UnitName Value="testregistry"/>
<CursorPos X="39" Y="27"/> <CursorPos X="39" Y="27"/>
<TopLine Value="17"/> <TopLine Value="17"/>
<EditorIndex Value="16"/> <EditorIndex Value="15"/>
<UsageCount Value="15"/> <UsageCount Value="17"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit59> </Unit59>
<Unit60> <Unit60>
@ -531,7 +531,7 @@
<CursorPos X="16" Y="2045"/> <CursorPos X="16" Y="2045"/>
<TopLine Value="2031"/> <TopLine Value="2031"/>
<EditorIndex Value="6"/> <EditorIndex Value="6"/>
<UsageCount Value="10"/> <UsageCount Value="12"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit65> </Unit65>
<Unit66> <Unit66>
@ -539,9 +539,7 @@
<UnitName Value="DOM"/> <UnitName Value="DOM"/>
<CursorPos X="3" Y="196"/> <CursorPos X="3" Y="196"/>
<TopLine Value="191"/> <TopLine Value="191"/>
<EditorIndex Value="12"/>
<UsageCount Value="10"/> <UsageCount Value="10"/>
<Loaded Value="True"/>
</Unit66> </Unit66>
<Unit67> <Unit67>
<Filename Value="..\..\type_lib_edtr\umoduleedit.pas"/> <Filename Value="..\..\type_lib_edtr\umoduleedit.pas"/>
@ -552,7 +550,7 @@
<CursorPos X="47" Y="21"/> <CursorPos X="47" Y="21"/>
<TopLine Value="18"/> <TopLine Value="18"/>
<EditorIndex Value="7"/> <EditorIndex Value="7"/>
<UsageCount Value="10"/> <UsageCount Value="12"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit67> </Unit67>
<Unit68> <Unit68>
@ -564,7 +562,7 @@
<CursorPos X="41" Y="21"/> <CursorPos X="41" Y="21"/>
<TopLine Value="18"/> <TopLine Value="18"/>
<EditorIndex Value="8"/> <EditorIndex Value="8"/>
<UsageCount Value="10"/> <UsageCount Value="12"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit68> </Unit68>
<Unit69> <Unit69>
@ -576,7 +574,7 @@
<CursorPos X="41" Y="9"/> <CursorPos X="41" Y="9"/>
<TopLine Value="5"/> <TopLine Value="5"/>
<EditorIndex Value="9"/> <EditorIndex Value="9"/>
<UsageCount Value="10"/> <UsageCount Value="12"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit69> </Unit69>
<Unit70> <Unit70>
@ -588,7 +586,7 @@
<CursorPos X="22" Y="9"/> <CursorPos X="22" Y="9"/>
<TopLine Value="7"/> <TopLine Value="7"/>
<EditorIndex Value="10"/> <EditorIndex Value="10"/>
<UsageCount Value="10"/> <UsageCount Value="12"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit70> </Unit70>
<Unit71> <Unit71>
@ -600,7 +598,7 @@
<CursorPos X="22" Y="9"/> <CursorPos X="22" Y="9"/>
<TopLine Value="6"/> <TopLine Value="6"/>
<EditorIndex Value="11"/> <EditorIndex Value="11"/>
<UsageCount Value="10"/> <UsageCount Value="12"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit71> </Unit71>
</Units> </Units>

View File

@ -26,6 +26,8 @@ type
procedure WriteXMLFile(ADoc : TXMLDocument; AStream : TStream); procedure WriteXMLFile(ADoc : TXMLDocument; AStream : TStream);
procedure ReadXMLFile(ADoc : TXMLDocument; AStream : TStream); procedure ReadXMLFile(ADoc : TXMLDocument; AStream : TStream);
function NodeToBuffer(ANode : TDOMNode):string ; function NodeToBuffer(ANode : TDOMNode):string ;
function FilterList(const ALIst : IDOMNodeList; const ANodeName : widestring):IDOMNodeList ;
implementation implementation
uses XmlDoc; uses XmlDoc;
@ -106,4 +108,82 @@ begin
end; end;
end; end;
type
TDOMNodeSelectListImp = class(TInterfacedObject,IDOMNodeList)
private
FItemName : widestring;
FInnerList : IDOMNodeList;
FCount : Integer;
private
function internal_get_item(index: Integer): IDOMNode;
protected
function get_item(index: Integer): IDOMNode; safecall;
function get_length: Integer; safecall;
public
constructor Create(
const AInnerList : IDOMNodeList;
const AItemName : widestring
);
end;
function FilterList(const ALIst : IDOMNodeList; const ANodeName : widestring):IDOMNodeList ;
begin
Result := TDOMNodeSelectListImp.Create(ALIst,ANodeName);
end;
{ TDOMNodeSelectListImp }
constructor TDOMNodeSelectListImp.Create(
const AInnerList: IDOMNodeList;
const AItemName: widestring
);
begin
Assert(AInnerList <> nil);
FInnerList := AInnerList;
FItemName := AItemName;
FCount := -1;
end;
function TDOMNodeSelectListImp.get_item(index: Integer): IDOMNode;
begin
Result := internal_get_item(index);
if ( Result = nil ) then
raise Exception.CreateFmt('Invalid item at %d.',[index]);
end;
function TDOMNodeSelectListImp.get_length() : Integer;
begin
if ( FCount >= 0 ) then begin
Result := FCount;
end else begin
FCount := 0;
while Assigned(internal_get_item(FCount)) do begin
Inc(FCount);
end;
Result := FCount;
end;
end;
function TDOMNodeSelectListImp.internal_get_item(index: Integer): IDOMNode;
var
i : Integer;
crt : IDOMNode;
begin
Result := nil;
if ( FInnerList.length > 0 ) then begin
i := -1;
crt := FInnerList.item[0];
while ( crt <> nil ) do begin
if ( FItemName = crt.nodeName ) then begin
Inc(i);
if ( i = index ) then begin
Result := crt;
Break;
end;
end;
crt := crt.nextSibling;
end;
end;
end;
end. end.