1
0
mirror of synced 2024-11-21 21:43:49 +00:00

Fixed: xs:anyType properties should be read-only

This commit is contained in:
Mark van Renswoude 2012-05-22 13:31:56 +00:00
parent fcfa4dda85
commit cb4e3a1148

View File

@ -1105,6 +1105,21 @@ function TDelphiXMLDataBindingGenerator.WriteSchemaInterfaceProperty(AStream: TS
end; end;
function IsReadOnly(AProperty: TXMLDataBindingProperty): Boolean;
var
typeMapping: TTypeMapping;
begin
Result := AProperty.IsReadOnly;
if (not Result) and (AProperty.PropertyType = ptSimple) then
begin
if GetDataTypeMapping(TXMLDataBindingSimpleProperty(AProperty).DataType, typeMapping) then
Result := (typeMapping.Conversion = tcNode);
end;
end;
var var
sourceCode: TNamedFormatStringList; sourceCode: TNamedFormatStringList;
writeOptional: Boolean; writeOptional: Boolean;
@ -1214,7 +1229,7 @@ begin
end; end;
dxmPropertySet: dxmPropertySet:
if not AProperty.IsReadOnly then if not IsReadOnly(AProperty) then
begin begin
WriteNewLine; WriteNewLine;
@ -1235,7 +1250,7 @@ begin
if writeOptional then if writeOptional then
sourceCode.Add(PropertyInterfaceOptional); sourceCode.Add(PropertyInterfaceOptional);
if AProperty.IsReadOnly then if IsReadOnly(AProperty) then
begin begin
if writeNil then if writeNil then
sourceCode.Add(PropertyInterfaceNilReadOnly); sourceCode.Add(PropertyInterfaceNilReadOnly);
@ -1341,7 +1356,7 @@ begin
sourceCode.AddLn; sourceCode.AddLn;
end; end;
dxmPropertySet: dxmPropertySet:
if not AProperty.IsReadOnly then if not IsReadOnly(AProperty) then
begin begin
WriteNewLine; WriteNewLine;