Fixed: incorrect type for certain collection items
Fixed: use XMLIntf.IXMLDocument in case of a conflicting 'Document' element (Google KML)
This commit is contained in:
parent
7ed849490c
commit
65d792471d
@ -785,6 +785,10 @@ begin
|
|||||||
begin
|
begin
|
||||||
propertyItem := AItem.Properties[propertyIndex];
|
propertyItem := AItem.Properties[propertyIndex];
|
||||||
|
|
||||||
|
if propertyItem.PropertyType = ptItem then
|
||||||
|
begin
|
||||||
|
itemProperty := TXMLDataBindingItemProperty(propertyItem);
|
||||||
|
|
||||||
if (not AItem.IsCollection) and Assigned(propertyItem.Collection) then
|
if (not AItem.IsCollection) and Assigned(propertyItem.Collection) then
|
||||||
begin
|
begin
|
||||||
WritePrototype;
|
WritePrototype;
|
||||||
@ -794,22 +798,19 @@ begin
|
|||||||
begin
|
begin
|
||||||
AStream.WriteLnNamedFmt(' RegisterChildNode(''%<ItemSourceName>:s'', %<ItemClass>:s);',
|
AStream.WriteLnNamedFmt(' RegisterChildNode(''%<ItemSourceName>:s'', %<ItemClass>:s);',
|
||||||
['ItemSourceName', propertyItem.Name,
|
['ItemSourceName', propertyItem.Name,
|
||||||
'ItemClass', PrefixClass + propertyItem.TranslatedName]);
|
'ItemClass', PrefixClass + itemProperty.Item.TranslatedName]);
|
||||||
|
|
||||||
AStream.WriteLnNamedFmt(' %<FieldName>:s := CreateCollection(%<CollectionClass>:s, %<ItemInterface>:s, ''%<ItemSourceName>:s'') as %<CollectionInterface>:s;',
|
AStream.WriteLnNamedFmt(' %<FieldName>:s := CreateCollection(%<CollectionClass>:s, %<ItemInterface>:s, ''%<ItemSourceName>:s'') as %<CollectionInterface>:s;',
|
||||||
['FieldName', PrefixField + propertyItem.TranslatedName,
|
['FieldName', PrefixField + propertyItem.TranslatedName,
|
||||||
'CollectionClass', PrefixClass + propertyItem.Collection.TranslatedName,
|
'CollectionClass', PrefixClass + propertyItem.Collection.TranslatedName,
|
||||||
'CollectionInterface', PrefixInterface + propertyItem.Collection.TranslatedName,
|
'CollectionInterface', PrefixInterface + propertyItem.Collection.TranslatedName,
|
||||||
'ItemInterface', PrefixInterface + propertyItem.TranslatedName,
|
'ItemInterface', PrefixInterface + itemProperty.Item.TranslatedName,
|
||||||
'ItemSourceName', propertyItem.Name]);
|
'ItemSourceName', propertyItem.Name]);
|
||||||
end;
|
end;
|
||||||
end else if (propertyItem.PropertyType = ptItem) and
|
end else if ((not AItem.IsCollection) or
|
||||||
((not AItem.IsCollection) or
|
|
||||||
(propertyItem <> AItem.CollectionItem)) then
|
(propertyItem <> AItem.CollectionItem)) then
|
||||||
begin
|
begin
|
||||||
{ Item property }
|
{ Item property }
|
||||||
itemProperty := TXMLDataBindingItemProperty(propertyItem);
|
|
||||||
|
|
||||||
if Assigned(itemProperty.Item) and
|
if Assigned(itemProperty.Item) and
|
||||||
(itemProperty.Item.ItemType = itInterface) then
|
(itemProperty.Item.ItemType = itInterface) then
|
||||||
begin
|
begin
|
||||||
@ -828,6 +829,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
if AItem.IsCollection then
|
if AItem.IsCollection then
|
||||||
begin
|
begin
|
||||||
|
@ -38,12 +38,12 @@ const
|
|||||||
|
|
||||||
DocumentBinding = 'GetDocBinding(''%<SourceName>:s'', TXML%<Name>:s, TargetNamespace) as IXML%<Name>:s';
|
DocumentBinding = 'GetDocBinding(''%<SourceName>:s'', TXML%<Name>:s, TargetNamespace) as IXML%<Name>:s';
|
||||||
|
|
||||||
DocumentFunctionsInterface = ' function Get%<Name>:s(ADocument: IXMLDocument): IXML%<Name>:s;' + CrLf +
|
DocumentFunctionsInterface = ' function Get%<Name>:s(ADocument: XMLIntf.IXMLDocument): IXML%<Name>:s;' + CrLf +
|
||||||
' function Load%<Name>:s(const AFileName: String): IXML%<Name>:s;' + CrLf +
|
' function Load%<Name>:s(const AFileName: String): IXML%<Name>:s;' + CrLf +
|
||||||
' function Load%<Name>:sFromStream(AStream: TStream): IXML%<Name>:s;' + CrLf +
|
' function Load%<Name>:sFromStream(AStream: TStream): IXML%<Name>:s;' + CrLf +
|
||||||
' function New%<Name>:s: IXML%<Name>:s;' + CrLf;
|
' function New%<Name>:s: IXML%<Name>:s;' + CrLf;
|
||||||
|
|
||||||
DocumentFunctionsImplementation = 'function Get%<Name>:s(ADocument: IXMLDocument): IXML%<Name>:s;' + CrLf +
|
DocumentFunctionsImplementation = 'function Get%<Name>:s(ADocument: XMLIntf.IXMLDocument): IXML%<Name>:s;' + CrLf +
|
||||||
'begin' + CrLf +
|
'begin' + CrLf +
|
||||||
' Result := ADocument.' + DocumentBinding + CrLf +
|
' Result := ADocument.' + DocumentBinding + CrLf +
|
||||||
'end;' + CrLf +
|
'end;' + CrLf +
|
||||||
@ -55,7 +55,7 @@ const
|
|||||||
'' + CrLf +
|
'' + CrLf +
|
||||||
'function Load%<Name>:sFromStream(AStream: TStream): IXML%<Name>:s;' + CrLf +
|
'function Load%<Name>:sFromStream(AStream: TStream): IXML%<Name>:s;' + CrLf +
|
||||||
'var' + CrLf +
|
'var' + CrLf +
|
||||||
' doc: IXMLDocument;' + CrLf +
|
' doc: XMLIntf.IXMLDocument;' + CrLf +
|
||||||
'' + CrLf +
|
'' + CrLf +
|
||||||
'begin' + CrLf +
|
'begin' + CrLf +
|
||||||
' doc := NewXMLDocument;' + CrLf +
|
' doc := NewXMLDocument;' + CrLf +
|
||||||
@ -194,7 +194,7 @@ type
|
|||||||
|
|
||||||
|
|
||||||
const
|
const
|
||||||
SimpleTypeMapping: array[0..10] of TTypeMapping =
|
SimpleTypeMapping: array[0..11] of TTypeMapping =
|
||||||
(
|
(
|
||||||
(SchemaName: 'int'; DelphiName: 'Integer'; Conversion: tcNone),
|
(SchemaName: 'int'; DelphiName: 'Integer'; Conversion: tcNone),
|
||||||
(SchemaName: 'integer'; DelphiName: 'Integer'; Conversion: tcNone),
|
(SchemaName: 'integer'; DelphiName: 'Integer'; Conversion: tcNone),
|
||||||
@ -206,6 +206,7 @@ const
|
|||||||
(SchemaName: 'double'; DelphiName: 'Double'; Conversion: tcFloat),
|
(SchemaName: 'double'; DelphiName: 'Double'; Conversion: tcFloat),
|
||||||
(SchemaName: 'boolean'; DelphiName: 'Boolean'; Conversion: tcBoolean),
|
(SchemaName: 'boolean'; DelphiName: 'Boolean'; Conversion: tcBoolean),
|
||||||
(SchemaName: 'string'; DelphiName: 'WideString'; Conversion: tcString),
|
(SchemaName: 'string'; DelphiName: 'WideString'; Conversion: tcString),
|
||||||
|
(SchemaName: 'anyURI'; DelphiName: 'WideString'; Conversion: tcString),
|
||||||
(SchemaName: 'base64Binary'; DelphiName: 'WideString'; Conversion: tcBase64)
|
(SchemaName: 'base64Binary'; DelphiName: 'WideString'; Conversion: tcBase64)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -717,6 +717,7 @@ var
|
|||||||
complexAliasItem: TXMLDataBindingComplexTypeAliasItem;
|
complexAliasItem: TXMLDataBindingComplexTypeAliasItem;
|
||||||
simpleAliasItem: TXMLDataBindingSimpleTypeAliasItem;
|
simpleAliasItem: TXMLDataBindingSimpleTypeAliasItem;
|
||||||
elementIndex: Integer;
|
elementIndex: Integer;
|
||||||
|
simpleTypeDef: IXMLSimpleTypeDef;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
Result := nil;
|
Result := nil;
|
||||||
@ -755,7 +756,9 @@ begin
|
|||||||
complexAliasItem.Item := Result;
|
complexAliasItem.Item := Result;
|
||||||
ASchema.AddItem(complexAliasItem);
|
ASchema.AddItem(complexAliasItem);
|
||||||
end;
|
end;
|
||||||
end else if AElement.DataType.Enumerations.Count > 0 then
|
end else if Supports(AElement.DataType, IXMLSimpleTypeDef, simpleTypeDef) then
|
||||||
|
begin
|
||||||
|
if simpleTypeDef.Enumerations.Count > 0 then
|
||||||
begin
|
begin
|
||||||
{ References enumeration. }
|
{ References enumeration. }
|
||||||
Result := FindEnumeration(ASchema, AElement.DataTypeName);
|
Result := FindEnumeration(ASchema, AElement.DataTypeName);
|
||||||
@ -765,7 +768,7 @@ begin
|
|||||||
Result := TXMLDataBindingUnresolvedItem.Create(Self, AElement, AElement.DataTypeName, ifEnumeration);
|
Result := TXMLDataBindingUnresolvedItem.Create(Self, AElement, AElement.DataTypeName, ifEnumeration);
|
||||||
ASchema.AddItem(Result);
|
ASchema.AddItem(Result);
|
||||||
end;
|
end;
|
||||||
end else if AElement.IsGlobal then
|
end else if simpleTypeDef.IsBuiltInType and AElement.IsGlobal then
|
||||||
begin
|
begin
|
||||||
{ The element is global, but only references a simple type. }
|
{ The element is global, but only references a simple type. }
|
||||||
simpleAliasItem := TXMLDataBindingSimpleTypeAliasItem.Create(Self, AElement, AElement.Name);
|
simpleAliasItem := TXMLDataBindingSimpleTypeAliasItem.Create(Self, AElement, AElement.Name);
|
||||||
@ -775,6 +778,7 @@ begin
|
|||||||
Result := simpleAliasItem;
|
Result := simpleAliasItem;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
if not Assigned(Result) then
|
if not Assigned(Result) then
|
||||||
begin
|
begin
|
||||||
@ -1239,7 +1243,11 @@ begin
|
|||||||
// #ToDo1 (MvR) 7-4-2008: check if an item with the "List" postfix
|
// #ToDo1 (MvR) 7-4-2008: check if an item with the "List" postfix
|
||||||
// exists in the schema, as it could cause
|
// exists in the schema, as it could cause
|
||||||
// conflicts.
|
// conflicts.
|
||||||
|
// #ToDo1 (MvR) 30-7-2008: temporary implementation; have to check
|
||||||
|
// for proper functioning later.
|
||||||
|
collectionItem := FindInterface(ASchema, propertyItem.TranslatedName + CollectionPostfix, ifElement);
|
||||||
|
if not Assigned(collectionItem) then
|
||||||
|
begin
|
||||||
case propertyItem.PropertyType of
|
case propertyItem.PropertyType of
|
||||||
ptSimple: collectionName := propertyItem.TranslatedName + CollectionPostfix;
|
ptSimple: collectionName := propertyItem.TranslatedName + CollectionPostfix;
|
||||||
ptItem: collectionName := propertyItem.TranslatedName + CollectionPostfix;
|
ptItem: collectionName := propertyItem.TranslatedName + CollectionPostfix;
|
||||||
@ -1248,6 +1256,7 @@ begin
|
|||||||
collectionItem := TXMLDataBindingInterface.Create(Self, propertyItem.SchemaItem, collectionName);
|
collectionItem := TXMLDataBindingInterface.Create(Self, propertyItem.SchemaItem, collectionName);
|
||||||
collectionItem.CollectionItem := propertyItem;
|
collectionItem.CollectionItem := propertyItem;
|
||||||
ASchema.InsertItem(collectionItem, interfaceItem);
|
ASchema.InsertItem(collectionItem, interfaceItem);
|
||||||
|
end;
|
||||||
|
|
||||||
propertyItem.Collection := collectionItem;
|
propertyItem.Collection := collectionItem;
|
||||||
end;
|
end;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
-$A8
|
-$A8
|
||||||
-$B-
|
-$B-
|
||||||
-$C+
|
-$C-
|
||||||
-$D+
|
-$D+
|
||||||
-$E-
|
-$E-
|
||||||
-$F-
|
-$F-
|
||||||
@ -12,7 +12,7 @@
|
|||||||
-$L+
|
-$L+
|
||||||
-$M-
|
-$M-
|
||||||
-$N+
|
-$N+
|
||||||
-$O+
|
-$O-
|
||||||
-$P+
|
-$P+
|
||||||
-$Q-
|
-$Q-
|
||||||
-$R-
|
-$R-
|
||||||
@ -22,7 +22,7 @@
|
|||||||
-$V+
|
-$V+
|
||||||
-$W-
|
-$W-
|
||||||
-$X+
|
-$X+
|
||||||
-$YD
|
-$Y+
|
||||||
-$Z1
|
-$Z1
|
||||||
-GD
|
-GD
|
||||||
-cg
|
-cg
|
||||||
@ -32,8 +32,13 @@
|
|||||||
-M
|
-M
|
||||||
-$M16384,1048576
|
-$M16384,1048576
|
||||||
-K$00400000
|
-K$00400000
|
||||||
-LE"C:\Documents and Settings\PsychoMark\My Documents\Borland Studio Projects\Bpl"
|
-N"lib"
|
||||||
-LN"C:\Documents and Settings\PsychoMark\My Documents\Borland Studio Projects\Bpl"
|
-LE"c:\program files\borland\delphi7\Projects\Bpl"
|
||||||
|
-LN"c:\program files\borland\delphi7\Projects\Bpl"
|
||||||
|
-U"c:\program files\borland\delphi7\Lib\Debug"
|
||||||
|
-O"c:\program files\borland\delphi7\Lib\Debug"
|
||||||
|
-I"c:\program files\borland\delphi7\Lib\Debug"
|
||||||
|
-R"c:\program files\borland\delphi7\Lib\Debug"
|
||||||
-w-UNSAFE_TYPE
|
-w-UNSAFE_TYPE
|
||||||
-w-UNSAFE_CODE
|
-w-UNSAFE_CODE
|
||||||
-w-UNSAFE_CAST
|
-w-UNSAFE_CAST
|
||||||
|
Loading…
Reference in New Issue
Block a user