XSD parsing : metadata extraction bug fix and tests

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@579 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
inoussa
2008-09-29 12:37:11 +00:00
parent 4c4cc7041c
commit 122d94f289
4 changed files with 80 additions and 8 deletions

View File

@ -0,0 +1,36 @@
<?xml version="1.0"?>
<definitions name="wst_test"
xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:tns="uri:sample"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
targetNamespace="uri:sample">
<types>
<schema targetNamespace="uri:sample" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:tns="uri:sample" xmlns:sdo="commonj.sdo">
<xsd:complexType name="ProjectList">
<xsd:sequence>
<xsd:element name="Project" type="tns:ProjectType" minOccurs="0" maxOccurs="unbounded"/>
<xsd:element name="changeSummary" type="sdo:ChangeSummary" minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="ProjectType">
<xsd:sequence>
<xsd:element name="Member" type="tns:Person" minOccurs="0" maxOccurs="unbounded"/>
<xsd:element name="ProjectLeader" type="xsd:anyURI" minOccurs="0" sdo:propertyType="tns:Person"/>
<xsd:element name="ProjectLeaderArray" type="xsd:anyURI" minOccurs="0" maxOccurs="unbounded" sdo:propertyType="tns:Person"/>
</xsd:sequence>
<xsd:attribute name="ProjectName" type="xsd:string"/>
</xsd:complexType>
<xsd:complexType name="Person">
<xsd:sequence>
<xsd:element name="Manager" type="xsd:anyURI" minOccurs="0" sdo:propertyType="tns:Person"/>
</xsd:sequence>
<xsd:attribute name="Name" type="xsd:string"/>
<xsd:attribute name="IsManager" type="xsd:boolean"/>
</xsd:complexType>
</schema>
</types>
</definitions>

View File

@ -0,0 +1,23 @@
<schema targetNamespace="uri:sample" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:tns="uri:sample" xmlns:sdo="commonj.sdo">
<xsd:complexType name="ProjectList">
<xsd:sequence>
<xsd:element name="Project" type="tns:ProjectType" minOccurs="0" maxOccurs="unbounded"/>
<xsd:element name="changeSummary" type="sdo:ChangeSummary" minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="ProjectType">
<xsd:sequence>
<xsd:element name="Member" type="tns:Person" minOccurs="0" maxOccurs="unbounded"/>
<xsd:element name="ProjectLeader" type="xsd:anyURI" minOccurs="0" sdo:propertyType="tns:Person"/>
<xsd:element name="ProjectLeaderArray" type="xsd:anyURI" minOccurs="0" maxOccurs="unbounded" sdo:propertyType="tns:Person"/>
</xsd:sequence>
<xsd:attribute name="ProjectName" type="xsd:string"/>
</xsd:complexType>
<xsd:complexType name="Person">
<xsd:sequence>
<xsd:element name="Manager" type="xsd:anyURI" minOccurs="0" sdo:propertyType="tns:Person"/>
</xsd:sequence>
<xsd:attribute name="Name" type="xsd:string"/>
<xsd:attribute name="IsManager" type="xsd:boolean"/>
</xsd:complexType>
</schema>

View File

@ -1,12 +1,12 @@
<?xml version="1.0"?>
<CONFIG>
<ProjectOptions>
<PathDelim Value="/"/>
<PathDelim Value="\"/>
<Version Value="6"/>
<General>
<SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/>
<IconPath Value="./"/>
<IconPath Value=".\"/>
<TargetFileExt Value=".exe"/>
</General>
<VersionInfo>
@ -14,13 +14,14 @@
</VersionInfo>
<PublishOptions>
<Version Value="2"/>
<DestinationDirectory Value="$(TestDir)\publishedproject\"/>
<IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
<ExcludeFileFilter Value="*.(bak|ppu|ppw|o|so);*~;backup"/>
</PublishOptions>
<RunParams>
<local>
<FormatVersion Value="1"/>
<LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/>
<LaunchingApplication PathPlusParams="\usr\X11R6\bin\xterm -T 'Lazarus Run Output' -e $(LazarusDir)\tools\runwait.sh $(TargetCmdLine)"/>
</local>
</RunParams>
<RequiredPackages Count="3">
@ -96,12 +97,12 @@
<UnitName Value="test_rtti_filter"/>
</Unit11>
<Unit12>
<Filename Value="../../wst_rtti_filter/rtti_filters.pas"/>
<Filename Value="..\..\wst_rtti_filter\rtti_filters.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="rtti_filters"/>
</Unit12>
<Unit13>
<Filename Value="../../wst_rtti_filter/wst_cursors.pas"/>
<Filename Value="..\..\wst_rtti_filter\wst_cursors.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="wst_cursors"/>
</Unit13>
@ -129,12 +130,13 @@
</ProjectOptions>
<CompilerOptions>
<Version Value="8"/>
<PathDelim Value="\"/>
<Target>
<Filename Value="wst_test_suite_gui.exe"/>
</Target>
<SearchPaths>
<IncludeFiles Value="../../"/>
<OtherUnitFiles Value="../../;../../ws_helper/;../../wst_rtti_filter/;../../fcl-json/src/"/>
<IncludeFiles Value="..\..\"/>
<OtherUnitFiles Value="..\..\;..\..\ws_helper\;..\..\wst_rtti_filter\;..\..\fcl-json\src\"/>
<UnitOutputDirectory Value="obj"/>
</SearchPaths>
<Parsing>

View File

@ -943,6 +943,15 @@ var
end;
end;
procedure CopyExtendedMetaData(ASource,ADesc : TPasElement);
var
ls : TStrings;
begin
ls := FSymbols.Properties.FindList(ASource);
if ( ls <> nil ) then
FSymbols.Properties.GetList(ADesc).Assign(ls);
end;
var
eltCrs, eltAttCrs : IObjectCursor;
internalName : string;
@ -1029,6 +1038,7 @@ begin
tmpPropTyp.VarType.AddRef();
tmpPropTyp.StoredAccessorName := propTyp.StoredAccessorName;
FSymbols.RegisterExternalAlias(tmpPropTyp,FSymbols.GetExternalName(propTyp));
CopyExtendedMetaData(propTyp,tmpPropTyp);
classDef.Members.Add(tmpPropTyp);
end else begin
tmpPropTyp := TPasProperty(FSymbols.CreateElement(TPasProperty,propTyp.Name,classDef,visPublished,'',0));
@ -1036,6 +1046,7 @@ begin
tmpPropTyp.VarType := FSymbols.FindElement(Format('%s_%sArray',[internalName,propTyp.Name])) as TPasType;
tmpPropTyp.VarType.AddRef();
FSymbols.RegisterExternalAlias(tmpPropTyp,FSymbols.GetExternalName(propTyp));
CopyExtendedMetaData(propTyp,tmpPropTyp);
classDef.Members.Add(tmpPropTyp);
end;
end;