From 487ee6e2ccb5a058815c23dfee651980e3086b59 Mon Sep 17 00:00:00 2001 From: Andrey Matveev Date: Tue, 25 Oct 2011 17:40:37 +0400 Subject: [PATCH] Library unloads 'null' variant values as '{{null}}' string. But it can't load this string as null value back. It loads this string as an ordinary string value. Problem is solved by add new function: function GetVarVal(aValue: TXmlString): Variant; This function is used in procedure TXmlNode.SetAttr(const aName, aValue: TXmlString); and procedure TXmlNode.SetAttr(aNameID: Integer; const aValue: TXmlString); Signed-off-by: Andrey Matveev --- SimpleXML.pas | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/SimpleXML.pas b/SimpleXML.pas index fc44fa0..6e8a4b9 100644 --- a/SimpleXML.pas +++ b/SimpleXML.pas @@ -2642,14 +2642,20 @@ begin Set_Text(aValue) end; +function GetVarVal(aValue: TXmlString): Variant; +begin + if aValue = XSTR_NULL then Result := null + else Result := aValue +end; + procedure TXmlNode.SetAttr(const aName, aValue: TXmlString); begin - SetVarAttr(FNames.GetID(aName), aValue) + SetVarAttr(FNames.GetID(aName), GetVarVal(aValue)) end; procedure TXmlNode.SetAttr(aNameID: Integer; const aValue: TXmlString); begin - SetVarAttr(aNameID, aValue) + SetVarAttr(aNameID, GetVarVal(aValue)) end; procedure TXmlNode.SetBoolAttr(aNameID: Integer; aValue: Boolean);