Type Hint handling record, alias, array ( WideString, AnsiString, UnicodeString handling ). Parsers and generators.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@772 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
inoussa
2009-04-07 16:28:22 +00:00
parent 8650ae4029
commit f267faed72
14 changed files with 330 additions and 85 deletions

View File

@ -3,7 +3,8 @@
xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:tns="library1"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:wst="urn:wst_base"
targetNamespace="urn:wst-test">
<types>
@ -13,6 +14,7 @@
<xsd:element name="AliasString" type="xsd:string"/>
<xsd:element name="AliasInt" type="xsd:int"/>
<xsd:element name="AliasWideString" type="xsd:string" wst:TypeHint="WideString"/>
</xsd:schema>
</types>

View File

@ -1,9 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:n="urn:wst-test"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:wst="urn:wst_base"
targetNamespace="urn:wst-test">
<xsd:element name="AliasString" type="xsd:string"/>
<xsd:element name="AliasInt" type="xsd:int"/>
<xsd:element name="AliasWideString" type="xsd:string" wst:TypeHint="WideString"/>
</xsd:schema>

View File

@ -0,0 +1,4 @@
<?xml version="1.0"?>
<schema xmlns:tns="urn:wst-test" xmlns:wst="urn:wst_base" xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:wst-test">
<xsd:element name="AliasedType" type="xsd:string" wst:TypeHint="WideString"/>
</schema>

View File

@ -0,0 +1,16 @@
<?xml version="1.0"?>
<schema xmlns:tns="urn:wst-test"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:wst="urn:wst_base"
targetNamespace="urn:wst-test">
<xsd:complexType name="AliasedType">
<xsd:sequence>
<xsd:element name="item" type="xsd:string" wst:TypeHint="WideString" maxOccurs="unbounded" minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="EmbeddedAliasedType">
<xsd:sequence>
<xsd:element name="item" type="xsd:string" wst:TypeHint="WideString" maxOccurs="unbounded" minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>
</schema>

View File

@ -0,0 +1,12 @@
<?xml version="1.0"?>
<schema xmlns:tns="type_hint_record_item"
xmlns:wst="urn:wst_base"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="type_hint_record_item">
<xsd:complexType name="TSampleRecord" wst:wst_record="true">
<xsd:sequence>
<xsd:element name="elementProp" type="xsd:string" wst:TypeHint="WideString"/>
</xsd:sequence>
<xsd:attribute name="elementAtt" type="xsd:string" wst:TypeHint="WideString"/>
</xsd:complexType>
</schema>

View File

@ -49,6 +49,10 @@ type
procedure class_sequence_open_type_any();
procedure class_sequence_open_type_any_attribute();
procedure class_sequence_open_type_any_any_attribute();
procedure type_alias_widestring();
procedure type_hint_array_item();
procedure type_hint_record_item();
end;
TTest_XsdGenerator = class(TTest_CustomXsdGenerator)
@ -853,6 +857,136 @@ begin
end;
end;
procedure TTest_CustomXsdGenerator.type_alias_widestring();
var
tr : TwstPasTreeContainer;
mdl : TPasModule;
aliasType : TPasAliasType;
g : IGenerator;
locDoc, locExistDoc : TXMLDocument;
arrayTyp : TPasArrayType;
begin
locDoc := nil;
locExistDoc := nil;
tr := TwstPasTreeContainer.Create();
try
CreateWstInterfaceSymbolTable(tr);
mdl := TPasModule(tr.CreateElement(TPasModule,'type_alias_widestring',tr.Package,visDefault,'',0));
tr.RegisterExternalAlias(mdl,'urn:wst-test');
tr.Package.Modules.Add(mdl);
mdl.InterfaceSection := TPasSection(tr.CreateElement(TPasSection,'',mdl,visDefault,'',0));
aliasType := TPasAliasType(tr.CreateElement(TPasAliasType,'AliasedType',mdl.InterfaceSection,visDefault,'',0));
aliasType.DestType := tr.FindElementNS('WideString',s_xs) as TPasType;
aliasType.DestType.AddRef();
mdl.InterfaceSection.Declarations.Add(aliasType);
mdl.InterfaceSection.Types.Add(aliasType);
locDoc := CreateDoc();
g := CreateGenerator(locDoc);
g.Execute(tr,mdl.Name);
//WriteXMLFile(locDoc,wstExpandLocalFileName('type_alias_widestring.xsd'));
locExistDoc := LoadXmlFromFilesList('type_alias_widestring.xsd');
Check(CompareNodes(locExistDoc.DocumentElement,locDoc.DocumentElement),'generated document differs from the existent one.');
finally
ReleaseDomNode(locExistDoc);
ReleaseDomNode(locDoc);
FreeAndNil(tr);
end;
end;
procedure TTest_CustomXsdGenerator.type_hint_array_item();
var
tr : TwstPasTreeContainer;
mdl : TPasModule;
aliasType : TPasArrayType;
g : IGenerator;
locDoc, locExistDoc : TXMLDocument;
arrayTyp : TPasArrayType;
begin
locDoc := nil;
locExistDoc := nil;
tr := TwstPasTreeContainer.Create();
try
CreateWstInterfaceSymbolTable(tr);
mdl := TPasModule(tr.CreateElement(TPasModule,'type_hint_array_item',tr.Package,visDefault,'',0));
tr.RegisterExternalAlias(mdl,'urn:wst-test');
tr.Package.Modules.Add(mdl);
mdl.InterfaceSection := TPasSection(tr.CreateElement(TPasSection,'',mdl,visDefault,'',0));
aliasType := tr.CreateArray('AliasedType',tr.FindElementNS('WideString',s_xs) as TPasType,'Item','Item',asScoped);
mdl.InterfaceSection.Declarations.Add(aliasType);
mdl.InterfaceSection.Types.Add(aliasType);
aliasType := tr.CreateArray('EmbeddedAliasedType',tr.FindElementNS('WideString',s_xs) as TPasType,'EmbeddedItem','EmbeddedItem',asScoped);
mdl.InterfaceSection.Declarations.Add(aliasType);
mdl.InterfaceSection.Types.Add(aliasType);
locDoc := CreateDoc();
g := CreateGenerator(locDoc);
g.Execute(tr,mdl.Name);
//WriteXMLFile(locDoc,wstExpandLocalFileName('type_hint_array_item.xsd'));
locExistDoc := LoadXmlFromFilesList('type_hint_array_item.xsd');
Check(CompareNodes(locExistDoc.DocumentElement,locDoc.DocumentElement),'generated document differs from the existent one.');
finally
ReleaseDomNode(locExistDoc);
ReleaseDomNode(locDoc);
FreeAndNil(tr);
end;
end;
procedure TTest_CustomXsdGenerator.type_hint_record_item();
var
tr : TwstPasTreeContainer;
mdl : TPasModule;
cltyp : TPasRecordType;
procedure AddProperty(
const AName,
ATypeName : string;
const AKind : TPropertyType
);
var
p : TPasVariable;
begin
p := TPasVariable(tr.CreateElement(TPasVariable,AName,cltyp,visDefault,'',0));
cltyp.Members.Add(p);
p.Name := AName;
p.VarType := tr.FindElement(ATypeName) as TPasType;
Check( (p.VarType <> nil), Format('Type not found : "%s".',[ATypeName]));
p.VarType.AddRef();
if ( AKind = ptAttribute ) then
tr.SetPropertyAsAttribute(p,True);
end;
var
g : IGenerator;
locDoc, locExistDoc : TXMLDocument;
begin
locDoc := nil;
locExistDoc := nil;
tr := TwstPasTreeContainer.Create();
try
CreateWstInterfaceSymbolTable(tr);
mdl := TPasModule(tr.CreateElement(TPasModule,'type_hint_record_item',tr.Package,visDefault,'',0));
tr.Package.Modules.Add(mdl);
mdl.InterfaceSection := TPasSection(tr.CreateElement(TPasSection,'',mdl,visDefault,'',0));
cltyp := TPasRecordType(tr.CreateElement(TPasRecordType,'TSampleRecord',mdl.InterfaceSection,visDefault,'',0));
mdl.InterfaceSection.Declarations.Add(cltyp);
mdl.InterfaceSection.Types.Add(cltyp);
AddProperty('elementProp','WideString',ptField);
AddProperty('elementAtt','WideString',ptAttribute);
locDoc := CreateDoc();
g := CreateGenerator(locDoc);
g.Execute(tr,mdl.Name);
WriteXMLFile(locDoc,wstExpandLocalFileName('type_hint_record_item.xsd'));
locExistDoc := LoadXmlFromFilesList('type_hint_record_item.xsd');
Check(CompareNodes(locExistDoc.DocumentElement,locDoc.DocumentElement),'generated document differs from the existent one.');
finally
ReleaseDomNode(locExistDoc);
ReleaseDomNode(locDoc);
FreeAndNil(tr);
end;
end;
function TTest_CustomXsdGenerator.LoadXmlFromFilesList(const AFileName: string): TXMLDocument;
begin
ReadXMLFile(Result,wstExpandLocalFileName(TestFilesPath + AFileName));

View File

@ -207,7 +207,7 @@ begin
RegisterFondamentalTypesHandler(handlerReg);
locDoc := CreateDoc();
GenerateWSDL(locRep,locDoc,typeReg,handlerReg);
WriteXML(locDoc,wstExpandLocalFileName('wsdl_gen_generate_array.wsdl'));
//WriteXML(locDoc,wstExpandLocalFileName('wsdl_gen_generate_array.wsdl'));
ReadXMLFile(locExistDoc,wstExpandLocalFileName(TestFilesPath + 'wsdl_gen_generate_array.wsdl'));
Check(CompareNodes(locExistDoc.DocumentElement,locDoc.DocumentElement),'generated document differs from the existent one.');
finally

View File

@ -220,6 +220,7 @@ const
x_enumSampleLIST : array[0..( x_enumSampleLIST_COUNT - 1 )] of string = ( 'esOne', 'esTwo', 'esThree', 'begin', 'finally', 'True', 'False' );
x_simpleTypeAliasString = 'AliasString';
x_simpleTypeAliasInt = 'AliasInt';
x_simpleTypeAliasWideString = 'AliasWideString';
x_simpleType = 'simpletype';
x_simpleTypeEmbedded = 'simpletype_embedded';
x_simpletypeNativeAlias = 'simpletypeNativeAlias';
@ -362,7 +363,7 @@ begin
CheckEquals(x_simpletypeNativeAlias,mdl.Name);
CheckEquals(x_targetNamespace,tr.GetExternalName(mdl));
ls := mdl.InterfaceSection.Declarations;
CheckEquals(2,ls.Count);
CheckEquals(3,ls.Count);
elt := tr.FindElement(x_simpleTypeAliasString);
CheckNotNull(elt,x_simpleTypeAliasString);
CheckEquals(x_simpleTypeAliasString,elt.Name);
@ -380,6 +381,16 @@ begin
aliasType := elt as TPasAliasType;
CheckNotNull(aliasType.DestType);
Check(tr.SameName(aliasType.DestType,'int'));
elt := tr.FindElement(x_simpleTypeAliasWideString);
CheckNotNull(elt,x_simpleTypeAliasWideString);
CheckEquals(x_simpleTypeAliasWideString,elt.Name);
CheckEquals(x_simpleTypeAliasWideString,tr.GetExternalName(elt));
CheckIs(elt,TPasAliasType);
aliasType := elt as TPasAliasType;
CheckNotNull(aliasType.DestType);
CheckIs(aliasType.DestType,TPasNativeSimpleType);
CheckEquals('WideString',aliasType.DestType.Name);
end;
type

View File

@ -714,7 +714,7 @@ begin
locStream := TMemoryStream.Create();
try
ser.SaveToStream(locStream);
locStream.SaveToFile(wstExpandLocalFileName('write_header_proxy_header_block.xml'));
//locStream.SaveToFile(wstExpandLocalFileName('write_header_proxy_header_block.xml'));
locStream.Position := 0;
ReadXMLFile(locDoc,locStream);
ReadXMLFile(locExistDoc,wstExpandLocalFileName(TestFilesPath + 'write_header_proxy_header_block.xml'));
@ -747,7 +747,7 @@ begin
locStream := TMemoryStream.Create();
try
ser.SaveToStream(locStream);
locStream.SaveToFile(wstExpandLocalFileName('write_header_proxy_header_block_name.xml'));
//locStream.SaveToFile(wstExpandLocalFileName('write_header_proxy_header_block_name.xml'));
locStream.Position := 0;
ReadXMLFile(locDoc,locStream);
ReadXMLFile(locExistDoc,wstExpandLocalFileName(TestFilesPath + 'write_header_proxy_header_block_name.xml'));

View File

@ -9,7 +9,7 @@ object fArrayEdit: TfArrayEdit
ClientHeight = 375
ClientWidth = 392
Position = poMainFormCenter
LCLVersion = '0.9.25'
LCLVersion = '0.9.26.2'
object Panel1: TPanel
Height = 50
Top = 325
@ -107,9 +107,9 @@ object fArrayEdit: TfArrayEdit
end
object edtEmbedded: TCheckBox
Left = 20
Height = 19
Height = 17
Top = 226
Width = 344
Width = 329
Caption = 'Embedded ( items are expanded directly in the enclosing element )'
TabOrder = 3
end
@ -124,9 +124,9 @@ object fArrayEdit: TfArrayEdit
end
object edtCollection: TCheckBox
Left = 20
Height = 19
Height = 17
Top = 258
Width = 357
Width = 344
Caption = 'Collection ( Pascal type will derive from TObjectCollectionRemotable )'
TabOrder = 4
end
@ -144,13 +144,19 @@ object fArrayEdit: TfArrayEdit
Font.Height = -20
Font.Name = 'courier'
Font.Pitch = fpFixed
Font.Quality = fqNonAntialiased
ParentColor = False
ParentFont = False
TabOrder = 0
BookMarkOptions.Xoffset = 42
Gutter.DigitCount = 2
Gutter.ShowLineNumbers = True
BookMarkOptions.OnChange = nil
Gutter.RightOffset = 0
Gutter.Width = 10
Gutter.LeftOffset = 0
Gutter.ShowCodeFolding = True
Gutter.CodeFoldingWidth = 10
Gutter.ShowChanges = True
Gutter.ShowLineNumbers = True
Highlighter = SynXMLSyn1
Keystrokes = <
item
@ -474,6 +480,8 @@ object fArrayEdit: TfArrayEdit
ShortCut = 24642
end>
ReadOnly = True
SelectedColor.OnChange = nil
BracketHighlightStyle = sbhsBoth
end
end
object tsDependencies: TTabSheet
@ -528,6 +536,19 @@ object fArrayEdit: TfArrayEdit
object SynXMLSyn1: TSynXMLSyn
DefaultFilter = 'Documents XML (*.xml,*.xsd,*.xsl,*.xslt,*.dtd)|*.xml;*.xsd;*.xsl;*.xslt;*.dtd'
Enabled = False
ElementAttri.FrameColor = clNone
AttributeAttri.FrameColor = clNone
NamespaceAttributeAttri.FrameColor = clNone
AttributeValueAttri.FrameColor = clNone
NamespaceAttributeValueAttri.FrameColor = clNone
TextAttri.FrameColor = clNone
CDATAAttri.FrameColor = clNone
EntityRefAttri.FrameColor = clNone
ProcessingInstructionAttri.FrameColor = clNone
CommentAttri.FrameColor = clNone
DocTypeAttri.FrameColor = clNone
SpaceAttri.FrameColor = clNone
SymbolAttri.FrameColor = clNone
WantBracesParsed = False
left = 266
top = 227

View File

@ -4,9 +4,9 @@ LazarusResources.Add('TfArrayEdit','FORMDATA',[
'TPF0'#11'TfArrayEdit'#10'fArrayEdit'#4'Left'#3'#'#2#6'Height'#3'w'#1#3'Top'#2
+'q'#5'Width'#3#136#1#13'ActiveControl'#7#2'PC'#11'BorderStyle'#7#13'bsSizeTo'
+'olWin'#7'Caption'#6#10'fArrayEdit'#12'ClientHeight'#3'w'#1#11'ClientWidth'#3
+#136#1#8'Position'#7#16'poMainFormCenter'#10'LCLVersion'#6#6'0.9.25'#0#6'TPa'
+'nel'#6'Panel1'#6'Height'#2'2'#3'Top'#3'E'#1#5'Width'#3#136#1#5'Align'#7#8'a'
+'lBottom'#12'ClientHeight'#2'2'#11'ClientWidth'#3#136#1#8'TabOrder'#2#0#0#7
+#136#1#8'Position'#7#16'poMainFormCenter'#10'LCLVersion'#6#8'0.9.26.2'#0#6'T'
+'Panel'#6'Panel1'#6'Height'#2'2'#3'Top'#3'E'#1#5'Width'#3#136#1#5'Align'#7#8
+'alBottom'#12'ClientHeight'#2'2'#11'ClientWidth'#3#136#1#8'TabOrder'#2#0#0#7
+'TButton'#7'Button1'#4'Left'#3#129#0#6'Height'#2#25#3'Top'#2#9#5'Width'#2'K'
+#6'Action'#7#5'actOK'#7'Anchors'#11#5'akTop'#7'akRight'#0#25'BorderSpacing.I'
+'nnerBorder'#2#4#8'TabOrder'#2#0#0#0#7'TButton'#7'Button2'#4'Left'#3#214#0#6
@ -28,80 +28,90 @@ LazarusResources.Add('TfArrayEdit','FORMDATA',[
+'akRight'#0#8'TabOrder'#2#0#0#0#9'TComboBox'#14'edtElementType'#4'Left'#2#20
+#6'Height'#2#21#3'Top'#2'z'#5'Width'#3'Q'#1#7'Anchors'#11#5'akTop'#6'akLeft'
+#7'akRight'#0#10'ItemHeight'#2#13#5'Style'#7#14'csDropDownList'#8'TabOrder'#2
+#1#0#0#9'TCheckBox'#11'edtEmbedded'#4'Left'#2#20#6'Height'#2#19#3'Top'#3#226
+#0#5'Width'#3'X'#1#7'Caption'#6'AEmbedded ( items are expanded directly in t'
+#1#0#0#9'TCheckBox'#11'edtEmbedded'#4'Left'#2#20#6'Height'#2#17#3'Top'#3#226
+#0#5'Width'#3'I'#1#7'Caption'#6'AEmbedded ( items are expanded directly in t'
+'he enclosing element )'#8'TabOrder'#2#3#0#0#5'TEdit'#14'edtElementName'#4'L'
+'eft'#2#20#6'Height'#2#23#3'Top'#3#186#0#5'Width'#3'Q'#1#7'Anchors'#11#5'akT'
+'op'#6'akLeft'#7'akRight'#0#8'TabOrder'#2#2#4'Text'#6#4'Item'#0#0#9'TCheckBo'
+'x'#13'edtCollection'#4'Left'#2#20#6'Height'#2#19#3'Top'#3#2#1#5'Width'#3'e'
+'x'#13'edtCollection'#4'Left'#2#20#6'Height'#2#17#3'Top'#3#2#1#5'Width'#3'X'
+#1#7'Caption'#6'FCollection ( Pascal type will derive from TObjectCollection'
+'Remotable )'#8'TabOrder'#2#4#0#0#0#9'TTabSheet'#11'tsSourceXSD'#7'Caption'#6
+#3'XSD'#12'ClientHeight'#3'+'#1#11'ClientWidth'#3#128#1#0#8'TSynEdit'#12'edt'
+'SourceXSD'#4'Left'#2#13#6'Height'#3#16#1#3'Top'#2#10#5'Width'#3'`'#1#7'Anch'
+'ors'#11#5'akTop'#6'akLeft'#7'akRight'#8'akBottom'#0#11'Font.Height'#2#236#9
+'Font.Name'#6#7'courier'#10'Font.Pitch'#7#7'fpFixed'#11'ParentColor'#8#8'Tab'
+'Order'#2#0#23'BookMarkOptions.Xoffset'#2'*'#17'Gutter.DigitCount'#2#2#22'Gu'
+'tter.ShowLineNumbers'#9#12'Gutter.Width'#2#10#22'Gutter.ShowCodeFolding'#9
+#11'Highlighter'#7#10'SynXMLSyn1'#10'Keystrokes'#14#1#7'Command'#2#3#8'Short'
+'Cut'#2'&'#0#1#7'Command'#2'g'#8'ShortCut'#3'& '#0#1#7'Command'#3#211#0#8'Sh'
+'ortCut'#3'&@'#0#1#7'Command'#2#4#8'ShortCut'#2'('#0#1#7'Command'#2'h'#8'Sho'
+'rtCut'#3'( '#0#1#7'Command'#3#212#0#8'ShortCut'#3'(@'#0#1#7'Command'#2#1#8
+'ShortCut'#2'%'#0#1#7'Command'#2'e'#8'ShortCut'#3'% '#0#1#7'Command'#2#5#8'S'
+'hortCut'#3'%@'#0#1#7'Command'#2'i'#8'ShortCut'#3'%`'#0#1#7'Command'#2#2#8'S'
+'hortCut'#2''''#0#1#7'Command'#2'f'#8'ShortCut'#3''' '#0#1#7'Command'#2#6#8
+'ShortCut'#3'''@'#0#1#7'Command'#2'j'#8'ShortCut'#3'''`'#0#1#7'Command'#2#10
+#8'ShortCut'#2'"'#0#1#7'Command'#2'n'#8'ShortCut'#3'" '#0#1#7'Command'#2#14#8
+'ShortCut'#3'"@'#0#1#7'Command'#2'r'#8'ShortCut'#3'"`'#0#1#7'Command'#2#9#8
+'ShortCut'#2'!'#0#1#7'Command'#2'm'#8'ShortCut'#3'! '#0#1#7'Command'#2#13#8
+'ShortCut'#3'!@'#0#1#7'Command'#2'q'#8'ShortCut'#3'!`'#0#1#7'Command'#2#7#8
+'ShortCut'#2'$'#0#1#7'Command'#2'k'#8'ShortCut'#3'$ '#0#1#7'Command'#2#15#8
+'ShortCut'#3'$@'#0#1#7'Command'#2's'#8'ShortCut'#3'$`'#0#1#7'Command'#2#8#8
+'ShortCut'#2'#'#0#1#7'Command'#2'l'#8'ShortCut'#3'# '#0#1#7'Command'#2#16#8
+'ShortCut'#3'#@'#0#1#7'Command'#2't'#8'ShortCut'#3'#`'#0#1#7'Command'#3#223#0
+#8'ShortCut'#2'-'#0#1#7'Command'#3#201#0#8'ShortCut'#3'-@'#0#1#7'Command'#3
+'\'#2#8'ShortCut'#3'- '#0#1#7'Command'#3#246#1#8'ShortCut'#2'.'#0#1#7'Comman'
+'d'#3'['#2#8'ShortCut'#3'. '#0#1#7'Command'#3#245#1#8'ShortCut'#2#8#0#1#7'Co'
+'mmand'#3#245#1#8'ShortCut'#3#8' '#0#1#7'Command'#3#248#1#8'ShortCut'#3#8'@'
+#0#1#7'Command'#3'Y'#2#8'ShortCut'#4#8#128#0#0#0#1#7'Command'#3'Z'#2#8'Short'
+'Cut'#4#8#160#0#0#0#1#7'Command'#3#253#1#8'ShortCut'#2#13#0#1#7'Command'#3
+#199#0#8'ShortCut'#3'A@'#0#1#7'Command'#3#201#0#8'ShortCut'#3'C@'#0#1#7'Comm'
,'and'#3'b'#2#8'ShortCut'#3'I`'#0#1#7'Command'#3#253#1#8'ShortCut'#3'M@'#0#1#7
+'Command'#3#254#1#8'ShortCut'#3'N@'#0#1#7'Command'#3#247#1#8'ShortCut'#3'T@'
+#0#1#7'Command'#3'c'#2#8'ShortCut'#3'U`'#0#1#7'Command'#3'\'#2#8'ShortCut'#3
+'V@'#0#1#7'Command'#3'['#2#8'ShortCut'#3'X@'#0#1#7'Command'#3#251#1#8'ShortC'
+'ut'#3'Y@'#0#1#7'Command'#3#250#1#8'ShortCut'#3'Y`'#0#1#7'Command'#3'Y'#2#8
+'ShortCut'#3'Z@'#0#1#7'Command'#3'Z'#2#8'ShortCut'#3'Z`'#0#1#7'Command'#3'-'
+#1#8'ShortCut'#3'0@'#0#1#7'Command'#3'.'#1#8'ShortCut'#3'1@'#0#1#7'Command'#3
+'/'#1#8'ShortCut'#3'2@'#0#1#7'Command'#3'0'#1#8'ShortCut'#3'3@'#0#1#7'Comman'
+'d'#3'1'#1#8'ShortCut'#3'4@'#0#1#7'Command'#3'2'#1#8'ShortCut'#3'5@'#0#1#7'C'
+'ommand'#3'3'#1#8'ShortCut'#3'6@'#0#1#7'Command'#3'4'#1#8'ShortCut'#3'7@'#0#1
+#7'Command'#3'5'#1#8'ShortCut'#3'8@'#0#1#7'Command'#3'6'#1#8'ShortCut'#3'9@'
+#0#1#7'Command'#3'_'#1#8'ShortCut'#3'0`'#0#1#7'Command'#3'`'#1#8'ShortCut'#3
+'1`'#0#1#7'Command'#3'a'#1#8'ShortCut'#3'2`'#0#1#7'Command'#3'b'#1#8'ShortCu'
+'t'#3'3`'#0#1#7'Command'#3'c'#1#8'ShortCut'#3'4`'#0#1#7'Command'#3'd'#1#8'Sh'
+'ortCut'#3'5`'#0#1#7'Command'#3'e'#1#8'ShortCut'#3'6`'#0#1#7'Command'#3'f'#1
+#8'ShortCut'#3'7`'#0#1#7'Command'#3'g'#1#8'ShortCut'#3'8`'#0#1#7'Command'#3
+'h'#1#8'ShortCut'#3'9`'#0#1#7'Command'#3#231#0#8'ShortCut'#3'N`'#0#1#7'Comma'
+'nd'#3#232#0#8'ShortCut'#3'C`'#0#1#7'Command'#3#233#0#8'ShortCut'#3'L`'#0#1#7
+'Command'#3'd'#2#8'ShortCut'#2#9#0#1#7'Command'#3'e'#2#8'ShortCut'#3#9' '#0#1
+#7'Command'#3#250#0#8'ShortCut'#3'B`'#0#0#8'ReadOnly'#9#0#0#0#9'TTabSheet'#14
+'tsDependencies'#7'Caption'#6#7'Used by'#12'ClientHeight'#3'+'#1#11'ClientWi'
+'dth'#3#128#1#0#9'TTreeView'#12'tvDependency'#4'Left'#2#12#6'Height'#3#16#1#3
+'Top'#2#10#5'Width'#3'`'#1#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#8'akB'
+'ottom'#0#17'DefaultItemHeight'#2#15#8'ReadOnly'#9#16'RightClickSelect'#9#8
+'TabOrder'#2#0#7'Options'#11#17'tvoAutoItemHeight'#16'tvoHideSelection'#21't'
+'voKeepCollapsedNodes'#11'tvoReadOnly'#19'tvoRightClickSelect'#14'tvoShowBut'
+'tons'#12'tvoShowLines'#11'tvoShowRoot'#11'tvoToolTips'#0#0#0#0#9'TTabSheet'
+#15'tsDocumentation'#7'Caption'#6#13'Documentation'#12'ClientHeight'#3'+'#1
+#11'ClientWidth'#3#128#1#0#5'TMemo'#16'edtDocumentation'#4'Left'#2#12#6'Heig'
+'ht'#3#10#1#3'Top'#2#18#5'Width'#3'`'#1#7'Anchors'#11#5'akTop'#6'akLeft'#7'a'
+'kRight'#8'akBottom'#0#10'ScrollBars'#7#10'ssAutoBoth'#8'TabOrder'#2#0#8'Wor'
+'dWrap'#8#0#0#0#0#11'TActionList'#2'AL'#4'left'#3#215#0#3'top'#3#185#0#0#7'T'
+'Action'#5'actOK'#7'Caption'#6#2'OK'#18'DisableIfNoHandler'#9#9'OnExecute'#7
+#12'actOKExecute'#8'OnUpdate'#7#11'actOKUpdate'#0#0#7'TAction'#8'actApply'#7
+'Caption'#6#5'Apply'#18'DisableIfNoHandler'#9#9'OnExecute'#7#15'actApplyExec'
+'ute'#8'OnUpdate'#7#11'actOKUpdate'#0#0#0#10'TSynXMLSyn'#10'SynXMLSyn1'#13'D'
+'efaultFilter'#6'MDocuments XML (*.xml,*.xsd,*.xsl,*.xslt,*.dtd)|*.xml;*.xsd'
+';*.xsl;*.xslt;*.dtd'#7'Enabled'#8#16'WantBracesParsed'#8#4'left'#3#10#1#3't'
+'op'#3#227#0#0#0#0
+'Font.Name'#6#7'courier'#10'Font.Pitch'#7#7'fpFixed'#12'Font.Quality'#7#16'f'
+'qNonAntialiased'#11'ParentColor'#8#10'ParentFont'#8#8'TabOrder'#2#0#23'Book'
+'MarkOptions.Xoffset'#2'*'#24'BookMarkOptions.OnChange'#13#18'Gutter.RightOf'
+'fset'#2#0#12'Gutter.Width'#2#10#17'Gutter.LeftOffset'#2#0#22'Gutter.ShowCod'
+'eFolding'#9#23'Gutter.CodeFoldingWidth'#2#10#18'Gutter.ShowChanges'#9#22'Gu'
+'tter.ShowLineNumbers'#9#11'Highlighter'#7#10'SynXMLSyn1'#10'Keystrokes'#14#1
+#7'Command'#2#3#8'ShortCut'#2'&'#0#1#7'Command'#2'g'#8'ShortCut'#3'& '#0#1#7
+'Command'#3#211#0#8'ShortCut'#3'&@'#0#1#7'Command'#2#4#8'ShortCut'#2'('#0#1#7
+'Command'#2'h'#8'ShortCut'#3'( '#0#1#7'Command'#3#212#0#8'ShortCut'#3'(@'#0#1
+#7'Command'#2#1#8'ShortCut'#2'%'#0#1#7'Command'#2'e'#8'ShortCut'#3'% '#0#1#7
+'Command'#2#5#8'ShortCut'#3'%@'#0#1#7'Command'#2'i'#8'ShortCut'#3'%`'#0#1#7
+'Command'#2#2#8'ShortCut'#2''''#0#1#7'Command'#2'f'#8'ShortCut'#3''' '#0#1#7
+'Command'#2#6#8'ShortCut'#3'''@'#0#1#7'Command'#2'j'#8'ShortCut'#3'''`'#0#1#7
+'Command'#2#10#8'ShortCut'#2'"'#0#1#7'Command'#2'n'#8'ShortCut'#3'" '#0#1#7
+'Command'#2#14#8'ShortCut'#3'"@'#0#1#7'Command'#2'r'#8'ShortCut'#3'"`'#0#1#7
+'Command'#2#9#8'ShortCut'#2'!'#0#1#7'Command'#2'm'#8'ShortCut'#3'! '#0#1#7'C'
+'ommand'#2#13#8'ShortCut'#3'!@'#0#1#7'Command'#2'q'#8'ShortCut'#3'!`'#0#1#7
+'Command'#2#7#8'ShortCut'#2'$'#0#1#7'Command'#2'k'#8'ShortCut'#3'$ '#0#1#7'C'
+'ommand'#2#15#8'ShortCut'#3'$@'#0#1#7'Command'#2's'#8'ShortCut'#3'$`'#0#1#7
+'Command'#2#8#8'ShortCut'#2'#'#0#1#7'Command'#2'l'#8'ShortCut'#3'# '#0#1#7'C'
+'ommand'#2#16#8'ShortCut'#3'#@'#0#1#7'Command'#2't'#8'ShortCut'#3'#`'#0#1#7
+'Command'#3#223#0#8'ShortCut'#2'-'#0#1#7'Command'#3#201#0#8'ShortCut'#3'-@'#0
+#1#7'Command'#3'\'#2#8'ShortCut'#3'- '#0#1#7'Command'#3#246#1#8'ShortCut'#2
+'.'#0#1#7'Command'#3'['#2#8'ShortCut'#3'. '#0#1#7'Command'#3#245#1#8'ShortCu'
+'t'#2#8#0#1#7'Command'#3#245#1#8'ShortCut'#3#8' '#0#1#7'Command'#3#248#1#8'S'
+'hortCut'#3#8'@'#0#1#7'Command'#3'Y'#2#8'ShortCut'#4#8#128#0#0#0#1#7'Command'
,#3'Z'#2#8'ShortCut'#4#8#160#0#0#0#1#7'Command'#3#253#1#8'ShortCut'#2#13#0#1#7
+'Command'#3#199#0#8'ShortCut'#3'A@'#0#1#7'Command'#3#201#0#8'ShortCut'#3'C@'
+#0#1#7'Command'#3'b'#2#8'ShortCut'#3'I`'#0#1#7'Command'#3#253#1#8'ShortCut'#3
+'M@'#0#1#7'Command'#3#254#1#8'ShortCut'#3'N@'#0#1#7'Command'#3#247#1#8'Short'
+'Cut'#3'T@'#0#1#7'Command'#3'c'#2#8'ShortCut'#3'U`'#0#1#7'Command'#3'\'#2#8
+'ShortCut'#3'V@'#0#1#7'Command'#3'['#2#8'ShortCut'#3'X@'#0#1#7'Command'#3#251
+#1#8'ShortCut'#3'Y@'#0#1#7'Command'#3#250#1#8'ShortCut'#3'Y`'#0#1#7'Command'
+#3'Y'#2#8'ShortCut'#3'Z@'#0#1#7'Command'#3'Z'#2#8'ShortCut'#3'Z`'#0#1#7'Comm'
+'and'#3'-'#1#8'ShortCut'#3'0@'#0#1#7'Command'#3'.'#1#8'ShortCut'#3'1@'#0#1#7
+'Command'#3'/'#1#8'ShortCut'#3'2@'#0#1#7'Command'#3'0'#1#8'ShortCut'#3'3@'#0
+#1#7'Command'#3'1'#1#8'ShortCut'#3'4@'#0#1#7'Command'#3'2'#1#8'ShortCut'#3'5'
+'@'#0#1#7'Command'#3'3'#1#8'ShortCut'#3'6@'#0#1#7'Command'#3'4'#1#8'ShortCut'
+#3'7@'#0#1#7'Command'#3'5'#1#8'ShortCut'#3'8@'#0#1#7'Command'#3'6'#1#8'Short'
+'Cut'#3'9@'#0#1#7'Command'#3'_'#1#8'ShortCut'#3'0`'#0#1#7'Command'#3'`'#1#8
+'ShortCut'#3'1`'#0#1#7'Command'#3'a'#1#8'ShortCut'#3'2`'#0#1#7'Command'#3'b'
+#1#8'ShortCut'#3'3`'#0#1#7'Command'#3'c'#1#8'ShortCut'#3'4`'#0#1#7'Command'#3
+'d'#1#8'ShortCut'#3'5`'#0#1#7'Command'#3'e'#1#8'ShortCut'#3'6`'#0#1#7'Comman'
+'d'#3'f'#1#8'ShortCut'#3'7`'#0#1#7'Command'#3'g'#1#8'ShortCut'#3'8`'#0#1#7'C'
+'ommand'#3'h'#1#8'ShortCut'#3'9`'#0#1#7'Command'#3#231#0#8'ShortCut'#3'N`'#0
+#1#7'Command'#3#232#0#8'ShortCut'#3'C`'#0#1#7'Command'#3#233#0#8'ShortCut'#3
+'L`'#0#1#7'Command'#3'd'#2#8'ShortCut'#2#9#0#1#7'Command'#3'e'#2#8'ShortCut'
+#3#9' '#0#1#7'Command'#3#250#0#8'ShortCut'#3'B`'#0#0#8'ReadOnly'#9#22'Select'
+'edColor.OnChange'#13#21'BracketHighlightStyle'#7#8'sbhsBoth'#0#0#0#9'TTabSh'
+'eet'#14'tsDependencies'#7'Caption'#6#7'Used by'#12'ClientHeight'#3'+'#1#11
+'ClientWidth'#3#128#1#0#9'TTreeView'#12'tvDependency'#4'Left'#2#12#6'Height'
+#3#16#1#3'Top'#2#10#5'Width'#3'`'#1#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRig'
+'ht'#8'akBottom'#0#17'DefaultItemHeight'#2#15#8'ReadOnly'#9#16'RightClickSel'
+'ect'#9#8'TabOrder'#2#0#7'Options'#11#17'tvoAutoItemHeight'#16'tvoHideSelect'
+'ion'#21'tvoKeepCollapsedNodes'#11'tvoReadOnly'#19'tvoRightClickSelect'#14't'
+'voShowButtons'#12'tvoShowLines'#11'tvoShowRoot'#11'tvoToolTips'#0#0#0#0#9'T'
+'TabSheet'#15'tsDocumentation'#7'Caption'#6#13'Documentation'#12'ClientHeigh'
+'t'#3'+'#1#11'ClientWidth'#3#128#1#0#5'TMemo'#16'edtDocumentation'#4'Left'#2
+#12#6'Height'#3#10#1#3'Top'#2#18#5'Width'#3'`'#1#7'Anchors'#11#5'akTop'#6'ak'
+'Left'#7'akRight'#8'akBottom'#0#10'ScrollBars'#7#10'ssAutoBoth'#8'TabOrder'#2
+#0#8'WordWrap'#8#0#0#0#0#11'TActionList'#2'AL'#4'left'#3#215#0#3'top'#3#185#0
+#0#7'TAction'#5'actOK'#7'Caption'#6#2'OK'#18'DisableIfNoHandler'#9#9'OnExecu'
+'te'#7#12'actOKExecute'#8'OnUpdate'#7#11'actOKUpdate'#0#0#7'TAction'#8'actAp'
+'ply'#7'Caption'#6#5'Apply'#18'DisableIfNoHandler'#9#9'OnExecute'#7#15'actAp'
+'plyExecute'#8'OnUpdate'#7#11'actOKUpdate'#0#0#0#10'TSynXMLSyn'#10'SynXMLSyn'
+'1'#13'DefaultFilter'#6'MDocuments XML (*.xml,*.xsd,*.xsl,*.xslt,*.dtd)|*.xm'
+'l;*.xsd;*.xsl;*.xslt;*.dtd'#7'Enabled'#8#23'ElementAttri.FrameColor'#7#6'cl'
+'None'#25'AttributeAttri.FrameColor'#7#6'clNone"NamespaceAttributeAttri.Fram'
+'eColor'#7#6'clNone'#30'AttributeValueAttri.FrameColor'#7#6'clNone''Namespac'
+'eAttributeValueAttri.FrameColor'#7#6'clNone'#20'TextAttri.FrameColor'#7#6'c'
+'lNone'#21'CDATAAttri.FrameColor'#7#6'clNone'#25'EntityRefAttri.FrameColor'#7
+#6'clNone%ProcessingInstructionAttri.FrameColor'#7#6'clNone'#23'CommentAttri'
+'.FrameColor'#7#6'clNone'#23'DocTypeAttri.FrameColor'#7#6'clNone'#21'SpaceAt'
+'tri.FrameColor'#7#6'clNone'#22'SymbolAttri.FrameColor'#7#6'clNone'#16'WantB'
+'racesParsed'#8#4'left'#3#10#1#3'top'#3#227#0#0#0#0
]);

View File

@ -139,7 +139,10 @@ begin
Self.Caption := FSymbolTable.GetExternalName(FObject);
edtName.Text := FSymbolTable.GetExternalName(FObject);
edtElementName.Text := FSymbolTable.GetArrayItemExternalName(FObject);
edtElementType.ItemIndex := edtElementType.Items.IndexOf(FSymbolTable.GetExternalName(FObject.ElType));
if ( FObject.ElType <> nil ) and ( not FObject.ElType.InheritsFrom(TPasUnresolvedTypeRef) ) then
edtElementType.ItemIndex := edtElementType.Items.IndexOfObject(FObject.ElType);
if ( edtElementType.ItemIndex < 0 ) then
edtElementType.ItemIndex := edtElementType.Items.IndexOf(FSymbolTable.GetExternalName(FObject.ElType));
edtEmbedded.Checked := ( FSymbolTable.GetArrayStyle(FObject) = asEmbeded );
edtCollection.Checked:= FSymbolTable.IsCollection(FObject);
end else begin

View File

@ -654,6 +654,7 @@ var
defSchemaNode, resNode : TDOMElement;
unitExternalName, baseUnitExternalName : string;
trueDestType : TPasType;
typeHelper : IXsdSpecialTypeHelper;
{$IFDEF WST_HANDLE_DOC}
i : PtrInt;
ls : TStrings;
@ -686,6 +687,10 @@ begin
s := GetNameSpaceShortName(baseUnitExternalName,ADocument,GetOwner().GetPreferedShortNames());
s := Format('%s:%s',[s,AContainer.GetExternalName(trueDestType)]);
resNode.SetAttribute(s_type,s) ;
if trueDestType.InheritsFrom(TPasNativeSpecialSimpleType) then begin
if GetRegistry().FindHelper(trueDestType,typeHelper) then
typeHelper.HandleTypeUsage(resNode,defSchemaNode);
end;
end;
end;
@ -1059,6 +1064,7 @@ var
p : TPasVariable;
hasSequence : Boolean;
storeOption : string;
typeHelper : IXsdSpecialTypeHelper;
{$IFDEF WST_HANDLE_DOC}
ls : TStrings;
{$ENDIF WST_HANDLE_DOC}
@ -1118,6 +1124,10 @@ begin
propTypItm := AContainer.FindElement(AContainer.GetExternalName(propTypItm)) as TPasType;
prop_ns_shortName := GetNameSpaceShortName(GetTypeNameSpace(AContainer,propTypItm),ADocument,GetOwner().GetPreferedShortNames());
propNode.SetAttribute(s_type,Format('%s:%s',[prop_ns_shortName,AContainer.GetExternalName(propTypItm)]));
if propTypItm.InheritsFrom(TPasNativeSpecialSimpleType) then begin
if GetRegistry().FindHelper(propTypItm,typeHelper) then
typeHelper.HandleTypeUsage(propNode,defSchemaNode);
end;
storeOption := Trim(AContainer.Properties.GetValue(p,s_WST_storeType));
if AContainer.IsAttributeProperty(p) then begin
if ( Length(storeOption) > 0 ) then begin
@ -1171,6 +1181,7 @@ var
s, prop_ns_shortName : string;
defSchemaNode, cplxNode, sqcNode, propNode : TDOMElement;
unitExternalName : string;
typeHelper : IXsdSpecialTypeHelper;
{$IFDEF WST_HANDLE_DOC}
i : PtrInt;
ls : TStrings;
@ -1210,6 +1221,10 @@ begin
if Assigned(propTypItm) then begin
prop_ns_shortName := GetNameSpaceShortName(GetTypeNameSpace(AContainer,propTypItm));// AContainer.GetExternalName(propTypItm.Parent.Parent));
propNode.SetAttribute(s_type,Format('%s:%s',[prop_ns_shortName,AContainer.GetExternalName(propTypItm)]));
if propTypItm.InheritsFrom(TPasNativeSpecialSimpleType) then begin
if GetRegistry().FindHelper(propTypItm,typeHelper) then
typeHelper.HandleTypeUsage(propNode,defSchemaNode);
end;
propNode.SetAttribute(s_minOccurs,'0');
propNode.SetAttribute(s_maxOccurs,s_unbounded);
end;

View File

@ -309,11 +309,18 @@ var
crsSchemaChild := FChildCursor.Clone() as IObjectCursor;
end;
function ExtractTypeHint(AElement: TDOMNode): string;
begin
if not wst_findCustomAttributeXsd(FXSShortNames,AElement,s_WST_typeHint,Result) then
Result := '';
end;
function FindTypeNode(out ASimpleTypeAlias : TPasType) : Boolean;
var
nd, oldTypeNode : TDOMNode;
crs : IObjectCursor;
locStrFilter : string;
locStrFilter, locTypeHint : string;
locHintedType : TPasType;
begin
ASimpleTypeAlias := nil;
Result := True;
@ -327,6 +334,14 @@ var
nd := (crs.GetCurrent() as TDOMNodeRttiExposer).InnerObject;
ASimpleTypeAlias := FindElement(ExtractNameFromQName(nd.NodeValue)) as TPasType;
if Assigned(ASimpleTypeAlias) then begin
if ASimpleTypeAlias.InheritsFrom(TPasNativeSimpleType) then begin
locTypeHint := ExtractTypeHint(typNd);
if not IsStrEmpty(locTypeHint) then begin
locHintedType := FindElement(locTypeHint) as TPasType;
if ( locHintedType <> nil ) then
ASimpleTypeAlias := locHintedType;
end;
end;
Result := False;
end else begin
oldTypeNode := typNd;