View Issue Details

IDProjectCategoryView StatusLast Update
0014695LazarusLCLpublic2017-10-23 12:10
ReporterChristianAssigned ToMattias Gaertner 
PrioritynormalSeveritymajorReproducibilityalways
Status resolvedResolutionfixed 
Product Version0.9.29 (SVN)Product Build 
Target VersionFixed in Version 
Summary0014695: TXMLObjectReader reads only the first collection in an XML File.
DescriptionAny other collection as Sibling or as Child later in the tree is not read.
TagsNo tags attached.
Fixed in Revision
LazTarget-
WidgetsetGTK, GTK 2, Win32/Win64, WinCE, Carbon, QT, fpGUI
Attached Files
  • xmlstreaming.patch (679 bytes)
    Index: components/codetools/laz_xmlstreaming.pas
    ===================================================================
    --- components/codetools/laz_xmlstreaming.pas	(revision 22193)
    +++ components/codetools/laz_xmlstreaming.pas	(working copy)
    @@ -762,8 +762,8 @@
                   CheckNode('collection');
                   FElementPosition:=0;
                   // go to node 'list'
    -              FElement:=FElement.FirstChild as TDOMElement;
    -              CheckNode('list');
    +              if Assigned(FElement.FirstChild) and (FElement.FirstChild.NodeName='list') then
    +                FElement:=FElement.FirstChild as TDOMElement;
                 end;
               end;
             end;
    
    xmlstreaming.patch (679 bytes)
  • xmlstreaming2.patch (1,343 bytes)
    Index: components/codetools/laz_xmlstreaming.pas
    ===================================================================
    --- components/codetools/laz_xmlstreaming.pas	(revision 22341)
    +++ components/codetools/laz_xmlstreaming.pas	(working copy)
    @@ -954,14 +954,10 @@
     function TXMLObjectReader.ReadFloat: Extended;
     var
       Value: String;
    -  FloatError: integer;
    -  Back: extended;
     begin
       Result:=0;
       Value:=FElement['value'];
    -  Val(Value, Back, FloatError);
    -  if FloatError=0 then ;
    -  Result:=Back;
    +  Result:=StrToFloat(Value);
       ReadValue;
       //writeln('TXMLObjectReader.ReadFloat ',Result);
     end;
    @@ -984,14 +980,10 @@
     function TXMLObjectReader.ReadCurrency: Currency;
     var
       Value: String;
    -  FloatError: integer;
    -  Back: currency;
     begin
       Result:=0;
       Value:=FElement['value'];
    -  Val(Value, Back, FloatError);
    -  if FloatError=0 then ;
    -  Result:=Back;
    +  Result:=StrToFloat(Value);
       ReadValue;
       //writeln('TXMLObjectReader.ReadCurrency ',Result);
     end;
    @@ -999,14 +991,10 @@
     function TXMLObjectReader.ReadDate: TDateTime;
     var
       Value: String;
    -  FloatError: integer;
    -  Back: Double;
     begin
       Result:=0;
       Value:=FElement['value'];
    -  Val(Value, Back, FloatError);
    -  if FloatError=0 then ;
    -  Result:=Back;
    +  Result:=StrToFloat(Value);
       ReadValue;
       //writeln('TXMLObjectReader.ReadDate ',Result);
     end;
    
    xmlstreaming2.patch (1,343 bytes)

Activities

Paul Ishenin

2009-10-01 04:54

manager   ~0031055

Please attach a test application

2009-10-15 15:35

 

xmlstreaming.patch (679 bytes)
Index: components/codetools/laz_xmlstreaming.pas
===================================================================
--- components/codetools/laz_xmlstreaming.pas	(revision 22193)
+++ components/codetools/laz_xmlstreaming.pas	(working copy)
@@ -762,8 +762,8 @@
               CheckNode('collection');
               FElementPosition:=0;
               // go to node 'list'
-              FElement:=FElement.FirstChild as TDOMElement;
-              CheckNode('list');
+              if Assigned(FElement.FirstChild) and (FElement.FirstChild.NodeName='list') then
+                FElement:=FElement.FirstChild as TDOMElement;
             end;
           end;
         end;
xmlstreaming.patch (679 bytes)

Christian

2009-10-15 15:36

reporter   ~0031340

@matthias, i have fixed reading clear collections (as first step) patch is attatched.
when i have time i make an simple example project for the problems.

Mattias Gaertner

2009-10-15 17:34

manager   ~0031342

Thanks. Applied.

Maybe we should first check if the writer is complete. Otherwise the current xml format might need some changes.

Christian

2009-10-15 19:10

reporter   ~0031346

The writer needs an encapsulation for lists (pure lists, no collections)
this can be done with addingction
GetPropertyElement('listproperty')
to the BeginList function.
But i was not able to correct the ReadNextValue function is useable again
As far as i see that should be the only correction to the format.

2009-10-30 15:00

 

xmlstreaming2.patch (1,343 bytes)
Index: components/codetools/laz_xmlstreaming.pas
===================================================================
--- components/codetools/laz_xmlstreaming.pas	(revision 22341)
+++ components/codetools/laz_xmlstreaming.pas	(working copy)
@@ -954,14 +954,10 @@
 function TXMLObjectReader.ReadFloat: Extended;
 var
   Value: String;
-  FloatError: integer;
-  Back: extended;
 begin
   Result:=0;
   Value:=FElement['value'];
-  Val(Value, Back, FloatError);
-  if FloatError=0 then ;
-  Result:=Back;
+  Result:=StrToFloat(Value);
   ReadValue;
   //writeln('TXMLObjectReader.ReadFloat ',Result);
 end;
@@ -984,14 +980,10 @@
 function TXMLObjectReader.ReadCurrency: Currency;
 var
   Value: String;
-  FloatError: integer;
-  Back: currency;
 begin
   Result:=0;
   Value:=FElement['value'];
-  Val(Value, Back, FloatError);
-  if FloatError=0 then ;
-  Result:=Back;
+  Result:=StrToFloat(Value);
   ReadValue;
   //writeln('TXMLObjectReader.ReadCurrency ',Result);
 end;
@@ -999,14 +991,10 @@
 function TXMLObjectReader.ReadDate: TDateTime;
 var
   Value: String;
-  FloatError: integer;
-  Back: Double;
 begin
   Result:=0;
   Value:=FElement['value'];
-  Val(Value, Back, FloatError);
-  if FloatError=0 then ;
-  Result:=Back;
+  Result:=StrToFloat(Value);
   ReadValue;
   //writeln('TXMLObjectReader.ReadDate ',Result);
 end;
xmlstreaming2.patch (1,343 bytes)

Christian

2009-10-30 15:00

reporter   ~0031804

Hers the next patch, it fixes loading Floats/Currencys/dates from the XML Serialized files.

Christian

2009-10-31 19:17

reporter   ~0031823

The base Problem is not fixed at time:
Every Property that is located after the first Collection isnt read.
I will look if i can fix it also.
At time i can work around.

Mattias Gaertner

2010-10-30 14:08

manager   ~0042421

Can you add a test application?

Vincent Snijders

2010-12-12 21:31

manager   ~0044197

Waiting for test application, so I set the status to feedback.

Vincent Snijders

2011-03-31 10:43

manager   ~0047004

Last edited: 2011-03-31 10:43

Removed target 0.99, because of missing test application.

Christian

2011-03-31 21:14

reporter   ~0047029

OK, hers the feedback :)
At Time it takes too long for me to make a test App.
I have in the App ive need that shipped around the isse before more than one jear. When ill need it again ill make an test app.

Martin Friebe

2013-09-13 20:54

manager   ~0070023

no feedback / reporter will reopen if still present

Christian

2013-09-14 09:01

reporter   ~0070045

Last edited: 2013-09-14 09:02

View 2 revisions

The last feedback IS from reporter, so what...
And the bug was never fixed so surely it is still present
I will see if i find the time to make an test application

Reinier Olislagers

2014-08-08 16:43

developer   ~0076523

Christian, are you still interested and prepared to write a test application or can we close this bug?

Juha Manninen

2017-10-23 12:10

developer   ~0103714

No feedback for over 4 years. Resolving.

Issue History

Date Modified Username Field Change
2009-09-30 14:01 Christian New Issue
2009-09-30 14:01 Christian Widgetset => GTK, GTK 2, Win32/Win64, WinCE, Carbon, QT, fpGUI
2009-10-01 04:54 Paul Ishenin LazTarget => -
2009-10-01 04:54 Paul Ishenin Note Added: 0031055
2009-10-01 04:54 Paul Ishenin Status new => feedback
2009-10-15 15:35 Christian File Added: xmlstreaming.patch
2009-10-15 15:36 Christian Note Added: 0031340
2009-10-15 17:34 Mattias Gaertner Note Added: 0031342
2009-10-15 19:10 Christian Note Added: 0031346
2009-10-30 15:00 Christian File Added: xmlstreaming2.patch
2009-10-30 15:00 Christian Note Added: 0031804
2009-10-30 15:11 Vincent Snijders LazTarget - => 0.9.30
2009-10-30 15:11 Vincent Snijders Assigned To => Mattias Gaertner
2009-10-30 15:11 Vincent Snijders Status feedback => assigned
2009-10-30 15:11 Vincent Snijders Target Version => 0.9.30
2009-10-31 12:41 Mattias Gaertner Status assigned => resolved
2009-10-31 12:41 Mattias Gaertner Resolution open => fixed
2009-10-31 19:17 Christian Status resolved => assigned
2009-10-31 19:17 Christian Resolution fixed => reopened
2009-10-31 19:17 Christian Note Added: 0031823
2010-10-30 14:08 Mattias Gaertner Note Added: 0042421
2010-12-12 21:31 Vincent Snijders LazTarget 0.9.30 => 0.99.0
2010-12-12 21:31 Vincent Snijders Note Added: 0044197
2010-12-12 21:31 Vincent Snijders Status assigned => feedback
2010-12-12 21:31 Vincent Snijders Target Version 0.9.30 => 0.99.0
2011-03-31 10:43 Vincent Snijders LazTarget 0.99.0 => -
2011-03-31 10:43 Vincent Snijders Note Added: 0047004
2011-03-31 10:43 Vincent Snijders Target Version 0.99.0 =>
2011-03-31 10:43 Vincent Snijders Note Edited: 0047004
2011-03-31 21:14 Christian Note Added: 0047029
2013-09-13 20:54 Martin Friebe Note Added: 0070023
2013-09-13 20:54 Martin Friebe Status feedback => resolved
2013-09-13 20:54 Martin Friebe Resolution reopened => unable to reproduce
2013-09-14 09:01 Christian Note Added: 0070045
2013-09-14 09:01 Christian Status resolved => assigned
2013-09-14 09:01 Christian Resolution unable to reproduce => reopened
2013-09-14 09:02 Christian Note Edited: 0070045 View Revisions
2014-08-08 16:43 Reinier Olislagers Note Added: 0076523
2014-08-08 17:59 Bart Broersma Status assigned => feedback
2017-10-23 12:10 Juha Manninen Note Added: 0103714
2017-10-23 12:10 Juha Manninen Status feedback => resolved
2017-10-23 12:10 Juha Manninen Resolution reopened => fixed