I think the error exists in procedure TkbmMWDOMXMLNode.SetData(AValue:string);

Home Forums kbmMW I think the error exists in procedure TkbmMWDOMXMLNode.SetData(AValue:string);

Viewing 6 reply threads
  • Author
    Posts
    • #55953
      VadimMest
      Participant

      kbmMW is version 5.15.10

      procedure TkbmMWDOMXMLNode.SetData(AValue:string);
      begin
      Exclude(FFlags,mwxnoDataModified);
      Exclude(FFlags,mwxnoDataProvided);
      Exclude(FFlags,mwxnoIsNil);
      // Vad
      //FDataLength:=0;

      FDataLength:=Length(AValue);

      //

      if AValue=” then
      exit;

      {$IFDEF KBMMW_COMPACT_XML}
      FDataProvidedStringIndex:=FDOM.FStrings.Add(AValue);
      {$ELSE}
      FDataProvidedString:=AValue;
      {$ENDIF}
      Include(FFlags,mwxnoDataModified);
      Include(FFlags,mwxnoDataProvided);
      end;

    • #56046
      kimbomadsen
      Keymaster

      Hi,

      Actually this code is correct. FDataLength indicates the data in the original XML document. The moment you set it to a new specific value, the datalength is zeroed and the new actual data placed in a different field.

      Kim/C4D

    • #56050
      VadimMest
      Participant

      Maybe the problem is in the other parts but it exists. I insist

      When I’ve changed the version to  5.15.0 I’ve got the problem with kbmMemTable savetoxml + loadfromxml. If the Integer field has zero value in the source dataset when the target dataset’s field will contain the null value after the record was loaded from xml.  It was a tricky problem for me. I traced it in the debugger and I found what ANode.DataLength = 0 for this node and It was the problem.

      procedure TkbmMWCustomXMLStreamFormat.LoadData(ADataset:TkbmCustomMemTable);
      procedure PopulateFieldFromNode(const AField:TField; const ANode:TkbmMWDOMXMLNode);
      var
      i:TkbmNativeInt;
      ms:TkbmMWMemoryStream;
      s:string;
      {$IFNDEF FMX}
      {$IFNDEF LINUX}
      jpeg:TJPEGImage;
      png:TPngImage;
      bmp:TBitmap;
      {$ENDIF}
      {$ENDIF}
      begin
      if (ANode.IsNil) or
      ((ANode.DataLength<=0) and (AField.DataType in [ftBoolean,ftLargeInt,
      {$IFDEF KBMMW_SUPPORTFTSHORTINT}

      I can send test project to you.

      Thanks

      Vadim Mesheryakov

      • This reply was modified 4 years, 3 months ago by VadimMest.
    • #56064
      kimbomadsen
      Keymaster

      Hi,
      Yes please. A simple sample always helps alot.
      Kim/C4D

    • #56068
      VadimMest
      Participant
    • #56069
      VadimMest
      Participant

      All Integer fields values don’t restored from xml

    • #56112
      kimbomadsen
      Keymaster

      Hi,
      Thank you for the sample project. I can see the bug. The fix for it is to replace line 898 in kbmMWXMLStreamFormat.pas to match:

      ((not ANode.DataProvided) and (ANode.DataLength<=0) and (AField.DataType in [ftBoolean,ftLargeInt, The fix will be in next release of kbmMW. /Kim

Viewing 6 reply threads
  • You must be logged in to reply to this topic.