How will know if there is a blank node in xml...
The XML file have a structure like this:
<rollercoaster build="0.1 (Dec 30 2010)" debug="no">
<settings name="roller coaster" sourcefile="rolcost.pas">
<description>Roller Coaster admin function</description>
<year>2010</year>
<manufacturer>ArtTeck</manufacturer>
<sears name="sears.uk" size="1024" mda="87117ba5082cd7a615b4ec7c02dd819" region="england" set1="25d"/>
<sears name="sears.dk" size="1056" mda="326dbbf94c6fa2e96613dedb53702f8" region="denmark" set1="25d"/>
<sears name="sears.gr" size="6802" mda="01b4c38108d9dc4e48da4f8d5821377" region="greece" set1="65d"/>
</settings>
<settings name="roller coaster2" sourcefile="rolcost2.pas">
<description>Roller Coaster user function</description>
<year></year>
<manufacturer>ArtTeck</manufacturer>
</settings>...... and goes on
</rollercoaster>
The things I want to know are:
Example the second year is empty and when i try to get text node i get an error and stops the produser how can i pass this error or better how can i control the blank node ... Thank you....
here is the code
for iNode := 0 to rollerList.Length - 1 do
begin
Conf.nxtgrd.BeginUpdate;
noderoller := rollerList.Item[iNode];
Conf.nxtgrd.Cell[0,RowNum].AsBoolean := StrToBool(GetNodeTextStr(noderoller,'description'));
if GetNodeTextStr(noderoller,'year') <> '' then // here get the exception...
Conf.nxtgrd.Cell[1,RowNum].AsString := GetNodeTextStr(noderoller,'year');
Conf.nxtgrd.EndUpdate;
end;
Simply storage isn't for delphi 7? p.s. I correct the above xml example in second year...
Instead of
if GetNodeTextStr(nodegame,'year') <> '' then
just use the overloaded version
if GetNodeTextStr(nodegame,'year', '') <> '' then
This one takes default value and returns that if the text node is not found. I also see a problem here. You iterate through a list of nodes, but where do you get "nodegame" from. Are you sure that this node is not nil? I think it should be like this:
if GetNodeTextStr(noderoller,'year', '') <> '' then
Unfortunately SimpleStorage is BDS 2006 and up compatible.