Fixed: reference to an enumeration is resolved as a simple type and turns into a Variant instead of a properly typed enumeration
This commit is contained in:
parent
66ce9ae1c9
commit
23d6e7e18e
@ -82,10 +82,6 @@ object MainForm: TMainForm
|
|||||||
TabOrder = 2
|
TabOrder = 2
|
||||||
object spFile: TTabSheet
|
object spFile: TTabSheet
|
||||||
TabVisible = False
|
TabVisible = False
|
||||||
ExplicitLeft = 0
|
|
||||||
ExplicitTop = 0
|
|
||||||
ExplicitWidth = 0
|
|
||||||
ExplicitHeight = 0
|
|
||||||
object lblFile: TLabel
|
object lblFile: TLabel
|
||||||
Left = 8
|
Left = 8
|
||||||
Top = 7
|
Top = 7
|
||||||
@ -200,10 +196,10 @@ object MainForm: TMainForm
|
|||||||
Style.HotTrack = False
|
Style.HotTrack = False
|
||||||
Left = 264
|
Left = 264
|
||||||
Top = 60
|
Top = 60
|
||||||
|
PixelsPerInch = 96
|
||||||
end
|
end
|
||||||
object LookAndFeel: TcxLookAndFeelController
|
object LookAndFeel: TcxLookAndFeelController
|
||||||
Kind = lfFlat
|
Kind = lfFlat
|
||||||
NativeStyle = True
|
|
||||||
Left = 368
|
Left = 368
|
||||||
Top = 60
|
Top = 60
|
||||||
end
|
end
|
||||||
|
@ -23,7 +23,7 @@ uses
|
|||||||
cxTextEdit,
|
cxTextEdit,
|
||||||
|
|
||||||
DataBindingHintsXML,
|
DataBindingHintsXML,
|
||||||
XMLDataBindingGenerator, cxGraphics, cxLookAndFeelPainters;
|
XMLDataBindingGenerator, cxGraphics, cxLookAndFeelPainters, cxClasses;
|
||||||
|
|
||||||
|
|
||||||
type
|
type
|
||||||
|
@ -812,46 +812,49 @@ begin
|
|||||||
enumerationObject := TXMLDataBindingEnumeration.Create(Self, AElement, AElement.DataType.Enumerations, AElement.Name, False);
|
enumerationObject := TXMLDataBindingEnumeration.Create(Self, AElement, AElement.DataType.Enumerations, AElement.Name, False);
|
||||||
ASchema.AddItem(enumerationObject);
|
ASchema.AddItem(enumerationObject);
|
||||||
Result := enumerationObject;
|
Result := enumerationObject;
|
||||||
end else if AElement.DataType.IsComplex then
|
end else
|
||||||
begin
|
begin
|
||||||
{ Interface }
|
if AElement.DataType.IsComplex then
|
||||||
interfaceObject := TXMLDataBindingInterface.Create(Self, AElement, AElement.Name);
|
|
||||||
if Assigned(AElement.DataType.BaseType) then
|
|
||||||
interfaceObject.BaseName := AElement.DataType.BaseTypeName;
|
|
||||||
|
|
||||||
ASchema.AddItem(interfaceObject);
|
|
||||||
Result := interfaceObject;
|
|
||||||
end;
|
|
||||||
|
|
||||||
if Assigned(interfaceObject) then
|
|
||||||
begin
|
|
||||||
for elementIndex := 0 to Pred(AElement.ChildElements.Count) do
|
|
||||||
ProcessChildElement(ASchema, AElement.ChildElements[elementIndex], interfaceObject);
|
|
||||||
|
|
||||||
for attributeIndex := 0 to Pred(AElement.AttributeDefs.Count) do
|
|
||||||
ProcessAttribute(ASchema, AElement.AttributeDefs[attributeIndex], interfaceObject);
|
|
||||||
end else if AElement.IsGlobal then
|
|
||||||
begin
|
|
||||||
{ Non-anonymous non-complex type. Assume somewhere in there is a
|
|
||||||
built-in type.
|
|
||||||
|
|
||||||
This code probably isn't correct, but it works for the files I got. }
|
|
||||||
typeDef := AElement.DataType;
|
|
||||||
|
|
||||||
while Assigned(typeDef) do
|
|
||||||
begin
|
begin
|
||||||
if Supports(typeDef, IXMLSimpleTypeDef, simpleTypeDef) and (simpleTypeDef.IsBuiltInType) then
|
{ Interface }
|
||||||
|
interfaceObject := TXMLDataBindingInterface.Create(Self, AElement, AElement.Name);
|
||||||
|
if Assigned(AElement.DataType.BaseType) then
|
||||||
|
interfaceObject.BaseName := AElement.DataType.BaseTypeName;
|
||||||
|
|
||||||
|
ASchema.AddItem(interfaceObject);
|
||||||
|
Result := interfaceObject;
|
||||||
|
end;
|
||||||
|
|
||||||
|
if Assigned(interfaceObject) then
|
||||||
|
begin
|
||||||
|
for elementIndex := 0 to Pred(AElement.ChildElements.Count) do
|
||||||
|
ProcessChildElement(ASchema, AElement.ChildElements[elementIndex], interfaceObject);
|
||||||
|
|
||||||
|
for attributeIndex := 0 to Pred(AElement.AttributeDefs.Count) do
|
||||||
|
ProcessAttribute(ASchema, AElement.AttributeDefs[attributeIndex], interfaceObject);
|
||||||
|
end else if AElement.IsGlobal then
|
||||||
|
begin
|
||||||
|
{ Non-anonymous non-complex type. Assume somewhere in there is a
|
||||||
|
built-in type.
|
||||||
|
|
||||||
|
This code probably isn't correct, but it works for the files I got. }
|
||||||
|
typeDef := AElement.DataType;
|
||||||
|
|
||||||
|
while Assigned(typeDef) do
|
||||||
begin
|
begin
|
||||||
{ The element is global, but only references a simple type. }
|
if Supports(typeDef, IXMLSimpleTypeDef, simpleTypeDef) and (simpleTypeDef.IsBuiltInType) then
|
||||||
simpleAliasItem := TXMLDataBindingSimpleTypeAliasItem.Create(Self, AElement, AElement.Name);
|
begin
|
||||||
simpleAliasItem.DataType := typeDef;
|
{ The element is global, but only references a simple type. }
|
||||||
ASchema.AddItem(simpleAliasItem);
|
simpleAliasItem := TXMLDataBindingSimpleTypeAliasItem.Create(Self, AElement, AElement.Name);
|
||||||
|
simpleAliasItem.DataType := typeDef;
|
||||||
|
ASchema.AddItem(simpleAliasItem);
|
||||||
|
|
||||||
Result := simpleAliasItem;
|
Result := simpleAliasItem;
|
||||||
Break;
|
Break;
|
||||||
|
end;
|
||||||
|
|
||||||
|
typeDef := typeDef.BaseType;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
typeDef := typeDef.BaseType;
|
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -1177,7 +1180,10 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
itUnresolved:
|
itUnresolved:
|
||||||
ResolveItem(ASchema, TXMLDataBindingUnresolvedItem(item));
|
begin
|
||||||
|
ResolveItem(ASchema, TXMLDataBindingUnresolvedItem(item));
|
||||||
|
FreeAndNil(item);
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user