- This topic has 7 replies, 2 voices, and was last updated 4 years, 2 months ago by .
Viewing 6 reply threads
Viewing 6 reply threads
- You must be logged in to reply to this topic.
Home › Forums › kbmMW › I think the error exists in procedure TkbmMWDOMXMLNode.SetData(AValue:string);
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;
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
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
Hi,
Yes please. A simple sample always helps alot.
Kim/C4D
All Integer fields values don’t restored from xml
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