1
0
mirror of synced 2024-11-23 22:13:49 +00:00

Fixed: TargetNamespace support for SimpleTypeAlias items

This commit is contained in:
Mark van Renswoude 2012-04-17 07:36:23 +00:00
parent abda6d92ba
commit d429226755

View File

@ -166,6 +166,7 @@ type
FSchema: TXMLDataBindingSchema; FSchema: TXMLDataBindingSchema;
FSchemaItem: IXMLSchemaItem; FSchemaItem: IXMLSchemaItem;
FTranslatedName: String; FTranslatedName: String;
FTargetNamespace: String;
function GetDocumentation: String; function GetDocumentation: String;
function GetHasDocumentation: Boolean; function GetHasDocumentation: Boolean;
@ -179,6 +180,7 @@ type
constructor Create(AOwner: TXMLDataBindingGenerator; ASchemaItem: IXMLSchemaItem; const AName: String); constructor Create(AOwner: TXMLDataBindingGenerator; ASchemaItem: IXMLSchemaItem; const AName: String);
property Schema: TXMLDataBindingSchema read FSchema write FSchema; property Schema: TXMLDataBindingSchema read FSchema write FSchema;
property TargetNamespace: String read FTargetNamespace write FTargetNamespace;
property DocumentElement: Boolean read FDocumentElement write FDocumentElement; property DocumentElement: Boolean read FDocumentElement write FDocumentElement;
property Documentation: String read GetDocumentation; property Documentation: String read GetDocumentation;
@ -258,7 +260,6 @@ type
TXMLDataBindingProperty = class(TXMLDataBindingItem) TXMLDataBindingProperty = class(TXMLDataBindingItem)
private private
FTargetNamespace: string;
FIsAttribute: Boolean; FIsAttribute: Boolean;
FIsOptional: Boolean; FIsOptional: Boolean;
FIsNillable: Boolean; FIsNillable: Boolean;
@ -272,7 +273,6 @@ type
function GetItemType: TXMLDataBindingItemType; override; function GetItemType: TXMLDataBindingItemType; override;
function GetPropertyType: TXMLDataBindingPropertyType; virtual; abstract; function GetPropertyType: TXMLDataBindingPropertyType; virtual; abstract;
public public
property TargetNamespace: string read FTargetNamespace write FTargetNamespace;
property IsAttribute: Boolean read FIsAttribute write FIsAttribute; property IsAttribute: Boolean read FIsAttribute write FIsAttribute;
property IsOptional: Boolean read FIsOptional write FIsOptional; property IsOptional: Boolean read FIsOptional write FIsOptional;
property IsNillable: Boolean read FIsNillable write FIsNillable; property IsNillable: Boolean read FIsNillable write FIsNillable;
@ -659,6 +659,8 @@ var
simpleType: IXMLSimpleTypeDef; simpleType: IXMLSimpleTypeDef;
enumerationObject: TXMLDataBindingEnumeration; enumerationObject: TXMLDataBindingEnumeration;
baseType: IXMLTypeDef; baseType: IXMLTypeDef;
namespace: String;
simpleTypeAlias: TXMLDataBindingSimpleTypeAliasItem;
begin begin
schemaDef := ASchema.SchemaDef; schemaDef := ASchema.SchemaDef;
@ -679,7 +681,15 @@ begin
baseType := baseType.BaseType; baseType := baseType.BaseType;
if not baseType.IsComplex then if not baseType.IsComplex then
ASchema.AddItem(TXMLDataBindingSimpleTypeAliasItem.Create(Self, baseType, simpleType.Name)); begin
namespace := simpleType.SchemaDef.TargetNamespace;
if namespace = Schemas[0].TargetNamespace then
namespace := '';
simpleTypeAlias := TXMLDataBindingSimpleTypeAliasItem.Create(Self, baseType, simpleType.Name);
simpleTypeAlias.TargetNamespace := namespace;
ASchema.AddItem(simpleTypeAlias);
end;
end; end;
end; end;
end; end;
@ -811,6 +821,7 @@ begin
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);
// #ToDo1 -oMvR: 17-4-2012: TargetNamespace!
simpleAliasItem.DataType := AElement.DataType; simpleAliasItem.DataType := AElement.DataType;
ASchema.AddItem(simpleAliasItem); ASchema.AddItem(simpleAliasItem);
@ -861,6 +872,7 @@ begin
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);
// #ToDo1 -oMvR: 17-4-2012: TargetNamespace!
simpleAliasItem.DataType := typeDef; simpleAliasItem.DataType := typeDef;
ASchema.AddItem(simpleAliasItem); ASchema.AddItem(simpleAliasItem);
@ -938,6 +950,7 @@ begin
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, AAttribute, AAttribute.Name); simpleAliasItem := TXMLDataBindingSimpleTypeAliasItem.Create(Self, AAttribute, AAttribute.Name);
// #ToDo1 -oMvR: 17-4-2012: TargetNamespace!
simpleAliasItem.DataType := AAttribute.DataType; simpleAliasItem.DataType := AAttribute.DataType;
ASchema.AddItem(simpleAliasItem); ASchema.AddItem(simpleAliasItem);
@ -977,6 +990,7 @@ begin
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, AAttribute, AAttribute.Name); simpleAliasItem := TXMLDataBindingSimpleTypeAliasItem.Create(Self, AAttribute, AAttribute.Name);
// #ToDo1 -oMvR: 17-4-2012: TargetNamespace!
simpleAliasItem.DataType := typeDef; simpleAliasItem.DataType := typeDef;
ASchema.AddItem(simpleAliasItem); ASchema.AddItem(simpleAliasItem);
@ -1941,7 +1955,8 @@ constructor TXMLDataBindingSimpleProperty.CreateFromAlias(AOwner: TXMLDataBindin
begin begin
Create(AOwner, AProperty.SchemaItem, AProperty.Name, ADataType); Create(AOwner, AProperty.SchemaItem, AProperty.Name, ADataType);
// #ToDo1 -oMvR: 6-4-2012: iets met TargetNamespace?? TargetNamespace := AProperty.TargetNamespace;
IsAttribute := AProperty.IsAttribute; IsAttribute := AProperty.IsAttribute;
IsOptional := AProperty.IsOptional; IsOptional := AProperty.IsOptional;
IsNillable := AProperty.IsNillable; IsNillable := AProperty.IsNillable;