From fcfa4dda857aa33a17e9b5d9a32e022ae545fdaa Mon Sep 17 00:00:00 2001 From: Mark van Renswoude Date: Tue, 22 May 2012 13:23:21 +0000 Subject: [PATCH] Fixed: map xs:anyType to IXMLNode --- Units/DelphiXMLDataBindingResources.pas | 41 ++++++++++++++++--------- 1 file changed, 27 insertions(+), 14 deletions(-) diff --git a/Units/DelphiXMLDataBindingResources.pas b/Units/DelphiXMLDataBindingResources.pas index 5f2e518..d082872 100644 --- a/Units/DelphiXMLDataBindingResources.pas +++ b/Units/DelphiXMLDataBindingResources.pas @@ -319,7 +319,8 @@ type tcDate, tcTime, tcString, - tcBase64); + tcBase64, + tcNode); TTypeConversions = set of TTypeConversion; @@ -331,7 +332,7 @@ type const - SimpleTypeMapping: array[0..12] of TTypeMapping = + SimpleTypeMapping: array[0..13] of TTypeMapping = ( (SchemaName: 'int'; DelphiName: 'Integer'; Conversion: tcNone), (SchemaName: 'integer'; DelphiName: 'Integer'; Conversion: tcNone), @@ -345,7 +346,8 @@ const (SchemaName: 'boolean'; DelphiName: 'Boolean'; Conversion: tcBoolean), (SchemaName: 'string'; DelphiName: 'WideString'; Conversion: tcString), (SchemaName: 'anyURI'; DelphiName: 'WideString'; Conversion: tcString), - (SchemaName: 'base64Binary'; DelphiName: 'WideString'; Conversion: tcBase64) + (SchemaName: 'base64Binary'; DelphiName: 'WideString'; Conversion: tcBase64), + (SchemaName: 'anyType'; DelphiName: 'IXMLNode'; Conversion: tcNode) ); @@ -358,7 +360,8 @@ const { tcDate } True, { tcTime } True, { tcString } False, - { tcBase64 } True + { tcBase64 } True, + { tcNone } False ); TypeConversionNone: array[TDelphiAccessor, TDelphiNodeType] of String = @@ -395,7 +398,8 @@ const { tcDate } ' %:s := XMLToDateTime(ChildNodes[''%:s''].NodeValue, xdtDate);', { tcTime } ' %:s := XMLToDateTime(ChildNodes[''%:s''].NodeValue, xdtTime);', { tcString } ' %:s := ChildNodes[''%:s''].Text;', - { tcBas64 } ' %:s := Base64Decode(Trim(ChildNodes[''%:s''].Text));' + { tcBase64 } ' %:s := Base64Decode(Trim(ChildNodes[''%:s''].Text));', + { tcNode } ' %:s := ChildNodes[''%:s''];' ), { dntElementNS } ( @@ -406,7 +410,8 @@ const { tcDate } ' %:s := XMLToDateTime(ChildNodes.FindNode(''%:s'', ''%:s'').NodeValue, xdtDate);', { tcTime } ' %:s := XMLToDateTime(ChildNodes.FindNode(''%:s'', ''%:s'').NodeValue, xdtTime);', { tcString } ' %:s := ChildNodes.FindNode(''%:s'', ''%:s'').Text;', - { tcBas64 } ' %:s := Base64Decode(Trim(ChildNodes.FindNode(''%:s'', ''%:s'').Text));' + { tcBase64 } ' %:s := Base64Decode(Trim(ChildNodes.FindNode(''%:s'', ''%:s'').Text));', + { tcNode } ' %:s := ChildNodes.FindNode(''%:s'', ''%:s'');' ), { dntAttribute } ( @@ -417,7 +422,8 @@ const { tcDate } ' %:s := XMLToDateTime(AttributeNodes[''%:s''].NodeValue, xdtDate);', { tcTime } ' %:s := XMLToDateTime(AttributeNodes[''%:s''].NodeValue, xdtTime);', { tcString } ' %:s := AttributeNodes[''%:s''].Text;', - { tcBase64 } ' %:s := Base64Decode(Trim(AttributeNodes[''%:s''].Text));' + { tcBase64 } ' %:s := Base64Decode(Trim(AttributeNodes[''%:s''].Text));', + { tcNode } ' %:s := AttributeNodes[''%:s''];' ), { dntNodeValue } ( @@ -428,7 +434,8 @@ const { tcDate } ' %:s := XMLToDateTime(GetNodeValue, xdtDate);', { tcTime } ' %:s := XMLToDateTime(GetNodeValue, xdtTime);', { tcString } ' %:s := GetNodeValue;', - { tcBase64 } ' %:s := Base64Decode(Trim(GetNodeValue));' + { tcBase64 } ' %:s := Base64Decode(Trim(GetNodeValue));', + { tcNode } '' ), { dntCustom} ( @@ -439,7 +446,8 @@ const { tcDate } ' %:s := XMLToDateTime(%:s, xdtDate);', { tcTime } ' %:s := XMLToDateTime(%:s, xdtTime);', { tcString } '', - { tcBase64 } ' %:s := Base64Decode(Trim(%:s));' + { tcBase64 } ' %:s := Base64Decode(Trim(%:s));', + { tcNode } '' ) ), { daSet } @@ -453,7 +461,8 @@ const { tcDate } ' ChildNodes[''%:s''].NodeValue := DateTimeToXML(%:s, xdtDate);', { tcTime } ' ChildNodes[''%:s''].NodeValue := DateTimeToXML(%:s, xdtTime);', { tcString } '', - { tcBase64 } ' ChildNodes[''%:s''].NodeValue := Base64Encode(%:s);' + { tcBase64 } ' ChildNodes[''%:s''].NodeValue := Base64Encode(%:s);', + { tcNode } ' ChildNodes[''%:s''] := %:s;' ), { dntElementNS } ( @@ -464,7 +473,8 @@ const { tcDate } ' ChildNodes.FindNode(''%:s'', ''%:s'').NodeValue := DateTimeToXML(%:s, xdtDate);', { tcTime } ' ChildNodes.FindNode(''%:s'', ''%:s'').NodeValue := DateTimeToXML(%:s, xdtTime);', { tcString } '', - { tcBase64 } ' ChildNodes.FindNode(''%:s'', ''%:s'').NodeValue := Base64Encode(%:s);' + { tcBase64 } ' ChildNodes.FindNode(''%:s'', ''%:s'').NodeValue := Base64Encode(%:s);', + { tcNode } ' ChildNodes.FindNode(''%:s'', ''%:s'') := %:s;' ), { dntAttribute } ( @@ -475,7 +485,8 @@ const { tcDate } ' SetAttribute(''%:s'', DateTimeToXML(%:s, xdtDate));', { tcTime } ' SetAttribute(''%:s'', DateTimeToXML(%:s, xdtTime));', { tcString } '', - { tcBase64 } ' SetAttribute(''%:s'', Base64Encode(%:s));' + { tcBase64 } ' SetAttribute(''%:s'', Base64Encode(%:s));', + { tcNode } '' ), { dntNodeValue } ( @@ -486,7 +497,8 @@ const { tcDate } ' SetNodeValue(DateTimeToXML(%:s, xdtDate));', { tcTime } ' SetNodeValue(DateTimeToXML(%:s, xdtTime));', { tcString } '', - { tcBase64 } ' SetNodeValue(Base64Encode(%:s));' + { tcBase64 } ' SetNodeValue(Base64Encode(%:s));', + { tcNode } '' ), { dntCustom} ( @@ -497,7 +509,8 @@ const { tcDate } ' %:s := DateTimeToXML(%:s, xdtDate);', { tcTime } ' %:s := DateTimeToXML(%:s, xdtTime);', { tcString } '', - { tcBase64 } ' %:s := Base64Encode(%:s);' + { tcBase64 } ' %:s := Base64Encode(%:s);', + { tcNode } '' ) ) );