Mercurial > pub > Impl
changeset 220:5c82c15b25b1
sync, updated schema
author | sergey |
---|---|
date | Thu, 23 Aug 2012 17:44:31 +0400 |
parents | c477f24f1980 |
children | e997e6fbac0b |
files | _test/Resources/resources.xsd _test/Resources/sample.xml _test/temp.pl |
diffstat | 3 files changed, 34 insertions(+), 43 deletions(-) [+] |
line wrap: on
line diff
--- a/_test/Resources/resources.xsd Tue Aug 21 17:13:47 2012 +0400 +++ b/_test/Resources/resources.xsd Thu Aug 23 17:44:31 2012 +0400 @@ -20,7 +20,8 @@ </complexContent> </complexType></element> </sequence> - </complexType></element> + </complexType> + </element> </sequence> </complexType> </element> @@ -32,64 +33,49 @@ <complexType name="restResource"> <sequence> - <element name="get" type="tns:restOperation" minOccurs="0"> - </element> - <element name="post" type="tns:restOperation" minOccurs="0"> - </element> - <element name="put" type="tns:restOperation" minOccurs="0"> - </element> - <element name="delete" type="tns:restOperation" minOccurs="0"> - </element> - <element name="resource" type="string" maxOccurs="unbounded" minOccurs="0"></element> + <element name="get" type="tns:restOperation" minOccurs="0"/> + <element name="post" type="tns:restOperation" minOccurs="0"/> + <element name="put" type="tns:restOperation" minOccurs="0"/> + <element name="delete" type="tns:restOperation" minOccurs="0"/> + <element name="resource" type="string" maxOccurs="unbounded" minOccurs="0"/> </sequence> </complexType> <complexType name="restOperation"> <sequence> - <element ref="tns:abstractBinding"/> - <element name="parameters" type="string"></element> - <element ref="tns:abstractResult"/> + <element name="bind" type="tns:methodBinding"/> + <element name="parameters" type="tns:transformation" minOccurs="0"/> + <element name="result" type="tns:abstractResult" minOccurs="0"/> </sequence> </complexType> <complexType name="methodBinding" > + <sequence> + <element name="var" type="tns:bindingVariable" minOccurs="0" maxOccurs="unbounded"/> + </sequence> + <attribute name="text" type="string" use="required" /> + </complexType> + + <complexType name="bindingVariable"> <complexContent> - <extension base="tns:abstractBinding"> - <attribute name="target" type="string" /> - <attribute name="invoke" type="string" use="required" /> + <extension base="tns:methodBinding"> + <attribute name="name" type="string"/> </extension> </complexContent> </complexType> + <complexType name="transformation"> <attribute name="class" type="string" /> </complexType> <complexType name="resourceLocator"> <sequence> - <element ref="tns:abstractBinding" /> + <element name="var" type="tns:bindingVariable" minOccurs="0" maxOccurs="unbounded"/> <element name="template" type="string" /> </sequence> </complexType> - - - - <!-- substitutions --> - - <!-- abstract --> - <element name="abstractBinding" type="tns:abstractBinding" abstract="true"/> - <element name="abstractTransfomation" type="tns:abstractTransformation" /> - <element name="abstractResult" type="tns:abstractResult" abstract="true" /> - - <!-- specific --> - - <!-- bindings --> - <element name="bind" type="tns:methodBinding" substitutionGroup="tns:abstractBinding"/> - - <!-- transformation --> - - <!-- result handlers --> <simpleType name="redirectCodes"> <restriction base="string"> <enumeration value="moved-permanently"/> @@ -108,7 +94,5 @@ </extension> </complexContent> </complexType> - - <element name="redirect" type="tns:redirectResult" substitutionGroup="tns:abstractResult" /> </schema> \ No newline at end of file
--- a/_test/Resources/sample.xml Tue Aug 21 17:13:47 2012 +0400 +++ b/_test/Resources/sample.xml Thu Aug 23 17:44:31 2012 +0400 @@ -2,18 +2,20 @@ <resources xmlns="http://implab.org/schemas/resources" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://implab.org/schemas/resources resources.xsd "> <root> <get> - <bind invoke="."/> - <parameters></parameters> - <redirect> + <bind text="model"/> + <result xsi:type="redirectResult"> <locator> - <bind invoke="id"/> + <var name="id" text="model.id"/> + <var name="parent" text="parent.location"/> <template>$parent/$id</template> </locator> - </redirect> + </result> </get> </root> <typeMap> <item></item> <item></item> </typeMap> + <locators> + </locators> </resources> \ No newline at end of file
--- a/_test/temp.pl Tue Aug 21 17:13:47 2012 +0400 +++ b/_test/temp.pl Thu Aug 23 17:44:31 2012 +0400 @@ -11,7 +11,12 @@ $schema->printIndex(); my $type = pack_type 'http://implab.org/schemas/resources', 'resources'; -my $reader = $schema->compile(READER => $type); +my $reader = $schema->compile( + READER => $type, + xsi_type => { + pack_type('http://implab.org/schemas/resources','abstractResult') => 'AUTO' + } +); my $t = [gettimeofday];