You've already forked lazarus-ccr
parsing wsdl with schema, but xsd namespace not declared in top node
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@595 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -0,0 +1,50 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<definitions name="wst_test"
|
||||||
|
xmlns="http://schemas.xmlsoap.org/wsdl/"
|
||||||
|
xmlns:tns="urn:wst-test"
|
||||||
|
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
|
||||||
|
targetNamespace="urn:wst-test">
|
||||||
|
|
||||||
|
<types>
|
||||||
|
<xsd:schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:wst-test" xmlns:xsd="http://www.w3.org/2001/XMLSchema" >
|
||||||
|
|
||||||
|
<xsd:complexType name="TClassSampleType">
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="intField" type="xsd:int" />
|
||||||
|
</xsd:sequence>
|
||||||
|
</xsd:complexType>
|
||||||
|
|
||||||
|
</xsd:schema>
|
||||||
|
</types>
|
||||||
|
|
||||||
|
<message name="test_proc">
|
||||||
|
<part name="AConstParam" type="tns:TClassSampleType"/>
|
||||||
|
</message>
|
||||||
|
<message name="test_procResponse">
|
||||||
|
</message>
|
||||||
|
|
||||||
|
<portType name="TestService">
|
||||||
|
<operation name="test_proc">
|
||||||
|
<input message="tns:test_proc"/>
|
||||||
|
<output message="tns:test_procResponse"/>
|
||||||
|
</operation>
|
||||||
|
</portType>
|
||||||
|
<binding name="TestServiceBinding" type="tns:TestService">
|
||||||
|
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
|
||||||
|
<operation name="test_proc">
|
||||||
|
<soap:operation soapAction=""/>
|
||||||
|
<input>
|
||||||
|
<soap:body use="literal" namespace="library1"/>
|
||||||
|
</input>
|
||||||
|
<output>
|
||||||
|
<soap:body use="literal" namespace="library1"/>
|
||||||
|
</output>
|
||||||
|
</operation>
|
||||||
|
</binding>
|
||||||
|
<service name="TestService">
|
||||||
|
<port name="TestServicePort" binding="tns:TestServiceBinding">
|
||||||
|
<soap:address location=""/>
|
||||||
|
</port>
|
||||||
|
</service>
|
||||||
|
|
||||||
|
</definitions>
|
@ -0,0 +1,51 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<definitions name="wst_test"
|
||||||
|
xmlns="http://schemas.xmlsoap.org/wsdl/"
|
||||||
|
xmlns:tns="urn:wst-test"
|
||||||
|
xmlns:other="urn:wst-other"
|
||||||
|
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
|
||||||
|
targetNamespace="urn:wst-test">
|
||||||
|
|
||||||
|
<types>
|
||||||
|
<xsd:schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:wst-other" xmlns:xsd="http://www.w3.org/2001/XMLSchema" >
|
||||||
|
|
||||||
|
<xsd:complexType name="TClassSampleType">
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="intField" type="xsd:int" />
|
||||||
|
</xsd:sequence>
|
||||||
|
</xsd:complexType>
|
||||||
|
|
||||||
|
</xsd:schema>
|
||||||
|
</types>
|
||||||
|
|
||||||
|
<message name="test_proc">
|
||||||
|
<part name="AConstParam" type="other:TClassSampleType"/>
|
||||||
|
</message>
|
||||||
|
<message name="test_procResponse">
|
||||||
|
</message>
|
||||||
|
|
||||||
|
<portType name="TestService">
|
||||||
|
<operation name="test_proc">
|
||||||
|
<input message="tns:test_proc"/>
|
||||||
|
<output message="tns:test_procResponse"/>
|
||||||
|
</operation>
|
||||||
|
</portType>
|
||||||
|
<binding name="TestServiceBinding" type="tns:TestService">
|
||||||
|
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
|
||||||
|
<operation name="test_proc">
|
||||||
|
<soap:operation soapAction=""/>
|
||||||
|
<input>
|
||||||
|
<soap:body use="literal" namespace="library1"/>
|
||||||
|
</input>
|
||||||
|
<output>
|
||||||
|
<soap:body use="literal" namespace="library1"/>
|
||||||
|
</output>
|
||||||
|
</operation>
|
||||||
|
</binding>
|
||||||
|
<service name="TestService">
|
||||||
|
<port name="TestServicePort" binding="tns:TestServiceBinding">
|
||||||
|
<soap:address location=""/>
|
||||||
|
</port>
|
||||||
|
</service>
|
||||||
|
|
||||||
|
</definitions>
|
@ -157,6 +157,8 @@ type
|
|||||||
procedure signature_last();
|
procedure signature_last();
|
||||||
procedure signature_result();
|
procedure signature_result();
|
||||||
procedure signature_return();
|
procedure signature_return();
|
||||||
|
procedure xsd_not_declared_at_top_node();
|
||||||
|
procedure xsd_not_declared_at_top_node_2();
|
||||||
end;
|
end;
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
@ -1573,7 +1575,7 @@ begin
|
|||||||
Result := ParseDoc(x_complexType_class_properties_extended_metadata);
|
Result := ParseDoc(x_complexType_class_properties_extended_metadata);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TTest_XsdParser.LoadComplexType_Class_properties_extended_metadata2: TwstPasTreeContainer;
|
function TTest_XsdParser.LoadComplexType_Class_properties_extended_metadata2(): TwstPasTreeContainer;
|
||||||
begin
|
begin
|
||||||
Result := ParseDoc(x_complexType_class_properties_extended_metadata + '_2');
|
Result := ParseDoc(x_complexType_class_properties_extended_metadata + '_2');
|
||||||
end;
|
end;
|
||||||
@ -1926,6 +1928,16 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TTest_WsdlParser.xsd_not_declared_at_top_node();
|
||||||
|
begin
|
||||||
|
ParseDoc('xsd_not_declared_at_top_node').Free();
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TTest_WsdlParser.xsd_not_declared_at_top_node_2();
|
||||||
|
begin
|
||||||
|
ParseDoc('xsd_not_declared_at_top_node_2').Free();
|
||||||
|
end;
|
||||||
|
|
||||||
function TTest_WsdlParser.LoadComplexType_Class_default_values() : TwstPasTreeContainer;
|
function TTest_WsdlParser.LoadComplexType_Class_default_values() : TwstPasTreeContainer;
|
||||||
begin
|
begin
|
||||||
Result := ParseDoc(x_complexType_class_default);
|
Result := ParseDoc(x_complexType_class_default);
|
||||||
@ -1936,7 +1948,7 @@ begin
|
|||||||
Result := ParseDoc(x_complexType_class_properties_extended_metadata);
|
Result := ParseDoc(x_complexType_class_properties_extended_metadata);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TTest_WsdlParser.LoadComplexType_Class_properties_extended_metadata2: TwstPasTreeContainer;
|
function TTest_WsdlParser.LoadComplexType_Class_properties_extended_metadata2(): TwstPasTreeContainer;
|
||||||
begin
|
begin
|
||||||
Result := ParseDoc(x_complexType_class_properties_extended_metadata + '_2');
|
Result := ParseDoc(x_complexType_class_properties_extended_metadata + '_2');
|
||||||
end;
|
end;
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
<CONFIG>
|
<CONFIG>
|
||||||
<ProjectOptions>
|
<ProjectOptions>
|
||||||
<PathDelim Value="/"/>
|
<PathDelim Value="\"/>
|
||||||
<Version Value="6"/>
|
<Version Value="6"/>
|
||||||
<General>
|
<General>
|
||||||
<SessionStorage Value="InProjectDir"/>
|
<SessionStorage Value="InProjectDir"/>
|
||||||
<MainUnit Value="0"/>
|
<MainUnit Value="0"/>
|
||||||
<IconPath Value="./"/>
|
<IconPath Value=".\"/>
|
||||||
<TargetFileExt Value=".exe"/>
|
<TargetFileExt Value=".exe"/>
|
||||||
</General>
|
</General>
|
||||||
<VersionInfo>
|
<VersionInfo>
|
||||||
@ -14,13 +14,14 @@
|
|||||||
</VersionInfo>
|
</VersionInfo>
|
||||||
<PublishOptions>
|
<PublishOptions>
|
||||||
<Version Value="2"/>
|
<Version Value="2"/>
|
||||||
|
<DestinationDirectory Value="$(TestDir)\publishedproject\"/>
|
||||||
<IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
|
<IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
|
||||||
<ExcludeFileFilter Value="*.(bak|ppu|ppw|o|so);*~;backup"/>
|
<ExcludeFileFilter Value="*.(bak|ppu|ppw|o|so);*~;backup"/>
|
||||||
</PublishOptions>
|
</PublishOptions>
|
||||||
<RunParams>
|
<RunParams>
|
||||||
<local>
|
<local>
|
||||||
<FormatVersion Value="1"/>
|
<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>
|
</local>
|
||||||
</RunParams>
|
</RunParams>
|
||||||
<RequiredPackages Count="3">
|
<RequiredPackages Count="3">
|
||||||
@ -96,12 +97,12 @@
|
|||||||
<UnitName Value="test_rtti_filter"/>
|
<UnitName Value="test_rtti_filter"/>
|
||||||
</Unit11>
|
</Unit11>
|
||||||
<Unit12>
|
<Unit12>
|
||||||
<Filename Value="../../wst_rtti_filter/rtti_filters.pas"/>
|
<Filename Value="..\..\wst_rtti_filter\rtti_filters.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<UnitName Value="rtti_filters"/>
|
<UnitName Value="rtti_filters"/>
|
||||||
</Unit12>
|
</Unit12>
|
||||||
<Unit13>
|
<Unit13>
|
||||||
<Filename Value="../../wst_rtti_filter/wst_cursors.pas"/>
|
<Filename Value="..\..\wst_rtti_filter\wst_cursors.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<UnitName Value="wst_cursors"/>
|
<UnitName Value="wst_cursors"/>
|
||||||
</Unit13>
|
</Unit13>
|
||||||
@ -129,9 +130,10 @@
|
|||||||
</ProjectOptions>
|
</ProjectOptions>
|
||||||
<CompilerOptions>
|
<CompilerOptions>
|
||||||
<Version Value="8"/>
|
<Version Value="8"/>
|
||||||
|
<PathDelim Value="\"/>
|
||||||
<SearchPaths>
|
<SearchPaths>
|
||||||
<IncludeFiles Value="../../"/>
|
<IncludeFiles Value="..\..\"/>
|
||||||
<OtherUnitFiles Value="../../;../../ws_helper/;../../wst_rtti_filter/;../../fcl-json/src/"/>
|
<OtherUnitFiles Value="..\..\;..\..\ws_helper\;..\..\wst_rtti_filter\;..\..\fcl-json\src\"/>
|
||||||
<UnitOutputDirectory Value="obj"/>
|
<UnitOutputDirectory Value="obj"/>
|
||||||
</SearchPaths>
|
</SearchPaths>
|
||||||
<Parsing>
|
<Parsing>
|
||||||
|
@ -33,6 +33,20 @@ type
|
|||||||
const
|
const
|
||||||
sNEW_LINE = sLineBreak;
|
sNEW_LINE = sLineBreak;
|
||||||
|
|
||||||
|
type
|
||||||
|
|
||||||
|
{ TQualifiedNameObjectFilter }
|
||||||
|
|
||||||
|
TQualifiedNameObjectFilter = class(TInterfacedObject,IObjectFilter)
|
||||||
|
private
|
||||||
|
FNameSpace : string;
|
||||||
|
FName : string;
|
||||||
|
protected
|
||||||
|
function Evaluate(const AObject : TObject) : Boolean;
|
||||||
|
public
|
||||||
|
constructor Create(const AName,ANameSpace : string);
|
||||||
|
end;
|
||||||
|
|
||||||
function IsStrEmpty(Const AStr : String):Boolean;
|
function IsStrEmpty(Const AStr : String):Boolean;
|
||||||
function ExtractIdentifier(const AValue : string) : string ;
|
function ExtractIdentifier(const AValue : string) : string ;
|
||||||
{$IFDEF WST_HANDLE_DOC}
|
{$IFDEF WST_HANDLE_DOC}
|
||||||
@ -430,4 +444,45 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
{ TQualifiedNameObjectFilter }
|
||||||
|
|
||||||
|
function TQualifiedNameObjectFilter.Evaluate(const AObject: TObject): Boolean;
|
||||||
|
var
|
||||||
|
locObj : TDOMNodeRttiExposer;
|
||||||
|
startPos, i : PtrInt;
|
||||||
|
shortNameSpace : string;
|
||||||
|
locContinue : Boolean;
|
||||||
|
tmpNode : TDOMNode;
|
||||||
|
begin
|
||||||
|
Result := False;
|
||||||
|
if ( AObject <> nil ) then begin
|
||||||
|
locObj := TDOMNodeRttiExposer(AObject);
|
||||||
|
i := Length(FName);
|
||||||
|
startPos := ( Length(locObj.NodeName) - i + 1 );
|
||||||
|
if ( startPos > 0 ) and ( FName = Copy(locObj.NodeName,startPos,i) ) then begin
|
||||||
|
if ( startPos = 1 ) then begin
|
||||||
|
shortNameSpace := 'xmlns';
|
||||||
|
locContinue := True;
|
||||||
|
end else begin
|
||||||
|
locContinue := ( startPos > 2 ) and ( locObj.NodeName[startPos-1] = ':' );
|
||||||
|
if locContinue then
|
||||||
|
shortNameSpace := 'xmlns:' + Copy(locObj.NodeName,1,( startPos - 2 ));
|
||||||
|
end;
|
||||||
|
if locContinue then begin
|
||||||
|
if ( locObj.InnerObject.Attributes <> nil ) then begin
|
||||||
|
tmpNode := locObj.InnerObject.Attributes.GetNamedItem(shortNameSpace);
|
||||||
|
if ( tmpNode <> nil ) and ( tmpNode.NodeValue = FNameSpace ) then
|
||||||
|
Result := True;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
constructor TQualifiedNameObjectFilter.Create(const AName, ANameSpace: string);
|
||||||
|
begin
|
||||||
|
FName := AName;
|
||||||
|
FNameSpace := ANameSpace;;
|
||||||
|
end;
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
@ -19,7 +19,7 @@ uses
|
|||||||
{$IFNDEF FPC}xmldom, wst_delphi_xml{$ELSE}DOM, wst_fpc_xml{$ENDIF},
|
{$IFNDEF FPC}xmldom, wst_delphi_xml{$ELSE}DOM, wst_fpc_xml{$ENDIF},
|
||||||
cursor_intf, rtti_filters,
|
cursor_intf, rtti_filters,
|
||||||
pastree, pascal_parser_intf, logger_intf,
|
pastree, pascal_parser_intf, logger_intf,
|
||||||
xsd_parser;
|
xsd_parser, wst_types;
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
||||||
|
@ -1229,8 +1229,16 @@ begin
|
|||||||
FSchemaCursor.Reset();
|
FSchemaCursor.Reset();
|
||||||
FSchemaCursor := CreateCursorOn(
|
FSchemaCursor := CreateCursorOn(
|
||||||
FSchemaCursor,
|
FSchemaCursor,
|
||||||
ParseFilter(CreateQualifiedNameFilterStr(s_schema,FXSShortNames),TDOMNodeRttiExposer)
|
TAggregatedFilter.Create(
|
||||||
|
ParseFilter(CreateQualifiedNameFilterStr(s_schema,FXSShortNames),TDOMNodeRttiExposer),
|
||||||
|
TQualifiedNameObjectFilter.Create(s_schema,s_xs),
|
||||||
|
fcOr
|
||||||
|
)
|
||||||
);
|
);
|
||||||
|
{ FSchemaCursor := CreateCursorOn(
|
||||||
|
FSchemaCursor,
|
||||||
|
ParseFilter(CreateQualifiedNameFilterStr(s_schema,FXSShortNames),TDOMNodeRttiExposer)
|
||||||
|
);}
|
||||||
FSchemaCursor.Reset();
|
FSchemaCursor.Reset();
|
||||||
if FSchemaCursor.MoveNext() then begin
|
if FSchemaCursor.MoveNext() then begin
|
||||||
FSchemaCursor.Reset();
|
FSchemaCursor.Reset();
|
||||||
|
Reference in New Issue
Block a user