You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@synapse.apache.org by Udayanga Wickramasinghe <ud...@wso2.com> on 2011/03/01 11:51:36 UTC
Including Predefined namespaces for Xpath in Synapse
Hi devs,
Currently synapse expressions (expression="xpath" OR value={xpath} ) with
xpath needs to have namespaces declared within the element. We think it is
better to include namespaces construct at synapse.xml that any xpath
construct would be able to refer to .For example we can define ;
<namespaces>
<namespace name="m0">http://org.sample.services</namespace>
<namespace name="m1">http://org.sample.services</namespace>
.......
....
</namespaces>
This way any expression can correspond to declared a namespace without
actually defining them in their local element;
ie:-
<callout serviceURL="https://api.sample.enp/2.0">
<source xpath="m0:Body/child::*[fn:position()=1] |
m1:Body/child::*[fn:position()=1]" />
<target key="key" />
</callout>
IMO this implementation will greatly improve readability of the
configuration. WDYT?
Regards,
Udayanga
--
*Udayanga Wickramasinghe*
Software Engineer; WSO2 Inc.; http://wso2.com,
*email: **udayanga@wso2.com* <ud...@wso2.com>* cell: +94 (77) 983-4365
blog: **http://udayangawiki.blogspot.com*<http://udayangawiki.blogspot.com/>
*
twitter: **http://twitter.com/udayanga_wick*<http://twitter.com/udayanga_wick>
*
*
Re: Including Predefined namespaces for Xpath in Synapse
Posted by Udayanga Wickramasinghe <ud...@wso2.com>.
Hi Sanjiva,
On Tue, Mar 1, 2011 at 7:30 PM, Sanjiva Weerawarana
<sa...@opensource.lk>wrote:
> The namespace element should be:
>
> <namespace prefix="m0" name="uri"/>
>
> See: http://www.w3.org/TR/REC-xml-names/. IMO is better to simply use two
> attributes rather than text content of the element as both values are
> straight strings.
>
+1
Regards,
Udayanga--
Re: Including Predefined namespaces for Xpath in Synapse
Posted by Sanjiva Weerawarana <sa...@opensource.lk>.
The namespace element should be:
<namespace prefix="m0" name="uri"/>
See: http://www.w3.org/TR/REC-xml-names/. IMO is better to simply use two
attributes rather than text content of the element as both values are
straight strings.
Sanjiva.
On Tue, Mar 1, 2011 at 4:21 PM, Udayanga Wickramasinghe
<ud...@wso2.com>wrote:
> Hi devs,
> Currently synapse expressions (expression="xpath" OR value={xpath} ) with
> xpath needs to have namespaces declared within the element. We think it is
> better to include namespaces construct at synapse.xml that any xpath
> construct would be able to refer to .For example we can define ;
> <namespaces>
> <namespace name="m0">http://org.sample.services</namespace>
> <namespace name="m1">http://org.sample.services</namespace>
> .......
> ....
> </namespaces>
>
> This way any expression can correspond to declared a namespace without
> actually defining them in their local element;
> ie:-
>
> <callout serviceURL="https://api.sample.enp/2.0">
> <source xpath="m0:Body/child::*[fn:position()=1] |
> m1:Body/child::*[fn:position()=1]" />
> <target key="key" />
> </callout>
>
> IMO this implementation will greatly improve readability of the
> configuration. WDYT?
>
> Regards,
> Udayanga
>
> --
> *Udayanga Wickramasinghe*
> Software Engineer; WSO2 Inc.; http://wso2.com,
> *email: **udayanga@wso2.com* <ud...@wso2.com>* cell: +94 (77) 983-4365
> blog: **http://udayangawiki.blogspot.com*<http://udayangawiki.blogspot.com/>
> *
> twitter: **http://twitter.com/udayanga_wick*<http://twitter.com/udayanga_wick>
> *
> *
>
--
Sanjiva Weerawarana, Ph.D.
Founder, Director & Chief Scientist; Lanka Software Foundation;
http://www.opensource.lk/
Founder, Chairman & CEO; WSO2; http://wso2.com/
Founder & Director; Thinkcube Systems; http://www.thinkcube.com/
Member; Apache Software Foundation; http://www.apache.org/
Member; Sahana Software Foundation; http://www.sahanafoundation.org/
Visiting Lecturer; University of Moratuwa; http://www.cse.mrt.ac.lk/
Blog: http://sanjiva.weerawarana.org/
Re: Including Predefined namespaces for Xpath in Synapse
Posted by indika kumara <in...@gmail.com>.
Following is what I think. Hope be useful. If not, sorry
An import can be dynamic or static. Import construct may need to define that
fact. For static imports, we can use an API based on a pull model, and for
dynamic imports, we can use an API based on a push model(event or
notification). There would be an Import Resolver. It may be capable of
handling both types of imports or a single type. Axis2 hot-deployment
approach is a just implemetaion for resolving Dynamic imports. But, It
should not be global but fine-grain. For instance, you can say that all the
proxy services located in the given URL are dynamic, or a single proxy is
dynamic, etc. That would allow a user to enable hot deployment (dynamic)
only for the selected artifacts. It is important to optimize the tasks that
should be done by any compoent irrespective of it is a foreground task or a
background task.
An import construct should be able to define a single import as well as
multiple imports. From Java ... packagename.ClasaName Vs packagename.*
=> directory/file Vs directory/* or just the directory.
We may need to consider how resources in our registry can be imported. It
may be another Import Resolver. In that case, they may be multiple Import
Resolvers. An import tag can be namespace qualified and the namespace can be
used to select the correct Resolver.
Thanks,
Indika
On Fri, Mar 4, 2011 at 12:00 PM, Udayanga Wickramasinghe
<ud...@wso2.com>wrote:
> Hi,
>
> On Fri, Mar 4, 2011 at 11:21 AM, indika kumara <in...@gmail.com>wrote:
>
>> Udayanga, I have not studied how 'import' in existing XML based languages
>> such as WSDL, works. But, I think the problem you pointed out may have been
>> already solved by those languages. If so, introducing <import> construct (in
>> multi-conf scenario) would solve the problem in a standard way. BTW, I
>> could be wrong.
>>
>> i'll look into this and the possiblilty of applying this to synapse
> config :)
>
> Regards,
> Udayanga--
>
> *Udayanga Wickramasinghe*
> Software Engineer; WSO2 Inc.; http://wso2.com,
> *email: **udayanga@wso2.com* <ud...@wso2.com>* cell: +94 (77) 983-4365
> blog: **http://udayangawiki.blogspot.com*<http://udayangawiki.blogspot.com/>
> *
> twitter: **http://twitter.com/udayanga_wick*<http://twitter.com/udayanga_wick>
> *
> *
>
Re: Including Predefined namespaces for Xpath in Synapse
Posted by Udayanga Wickramasinghe <ud...@wso2.com>.
Hi,
On Fri, Mar 4, 2011 at 11:21 AM, indika kumara <in...@gmail.com>wrote:
> Udayanga, I have not studied how 'import' in existing XML based languages
> such as WSDL, works. But, I think the problem you pointed out may have been
> already solved by those languages. If so, introducing <import> construct (in
> multi-conf scenario) would solve the problem in a standard way. BTW, I
> could be wrong.
>
> i'll look into this and the possiblilty of applying this to synapse config
:)
Regards,
Udayanga--
*Udayanga Wickramasinghe*
Software Engineer; WSO2 Inc.; http://wso2.com,
*email: **udayanga@wso2.com* <ud...@wso2.com>* cell: +94 (77) 983-4365
blog: **http://udayangawiki.blogspot.com*<http://udayangawiki.blogspot.com/>
*
twitter: **http://twitter.com/udayanga_wick*<http://twitter.com/udayanga_wick>
*
*
Re: Including Predefined namespaces for Xpath in Synapse
Posted by indika kumara <in...@gmail.com>.
Udayanga, I have not studied how 'import' in existing XML based languages
such as WSDL, works. But, I think the problem you pointed out may have been
already solved by those languages. If so, introducing <import> construct (in
multi-conf scenario) would solve the problem in a standard way. BTW, I
could be wrong.
~ Indika
On Fri, Mar 4, 2011 at 11:36 AM, Udayanga Wickramasinghe
<ud...@wso2.com>wrote:
> Hi Indika,
>
> On Thu, Mar 3, 2011 at 8:55 PM, indika kumara <in...@gmail.com>wrote:
>
>> Udayanga, Could please show some examples that demonstrate the the problem
>> in the synapse multiple xml configurations with the standard way of defining
>> namespaces?.
>>
>> In multiple xml configurations we load synapse artifacts from different
> locations. Therefore problem is, if we define namespaces in Synapse.xml
> these wont be visible to other artifacts loaded from multiple locations.
> ie:- namespace xmlns:m0 defined in synapse-config/synapse.xml wont be
> visible to a sequence 'foo' defined in synapse-config/sequences/foo.xml
>
> Regards,
> Udayanga--
>
> *Udayanga Wickramasinghe*
> Software Engineer; WSO2 Inc.; http://wso2.com,
> *email: **udayanga@wso2.com* <ud...@wso2.com>* cell: +94 (77) 983-4365
> blog: **http://udayangawiki.blogspot.com*<http://udayangawiki.blogspot.com/>
> *
> twitter: **http://twitter.com/udayanga_wick*<http://twitter.com/udayanga_wick>
> *
> *
>
Re: Including Predefined namespaces for Xpath in Synapse
Posted by Udayanga Wickramasinghe <ud...@wso2.com>.
Hi Indika,
On Thu, Mar 3, 2011 at 8:55 PM, indika kumara <in...@gmail.com> wrote:
> Udayanga, Could please show some examples that demonstrate the the problem
> in the synapse multiple xml configurations with the standard way of defining
> namespaces?.
>
> In multiple xml configurations we load synapse artifacts from different
locations. Therefore problem is, if we define namespaces in Synapse.xml
these wont be visible to other artifacts loaded from multiple locations.
ie:- namespace xmlns:m0 defined in synapse-config/synapse.xml wont be
visible to a sequence 'foo' defined in synapse-config/sequences/foo.xml
Regards,
Udayanga--
*Udayanga Wickramasinghe*
Software Engineer; WSO2 Inc.; http://wso2.com,
*email: **udayanga@wso2.com* <ud...@wso2.com>* cell: +94 (77) 983-4365
blog: **http://udayangawiki.blogspot.com*<http://udayangawiki.blogspot.com/>
*
twitter: **http://twitter.com/udayanga_wick*<http://twitter.com/udayanga_wick>
*
*
Re: Including Predefined namespaces for Xpath in Synapse
Posted by Udayanga Wickramasinghe <ud...@wso2.com>.
Hi Indika,
On Thu, Mar 3, 2011 at 9:16 PM, indika kumara <in...@gmail.com> wrote:
> And, also In the multiple XML configurations, do we use the 'import' in the
> synapse XML - import sequence definitions, proxy definitions, etc.? The Use
> of 'import' construct prevails in almost every language.
>
AFAIK we dont have an <import> construct..
Regards,
Udayanga--
*Udayanga Wickramasinghe*
Software Engineer; WSO2 Inc.; http://wso2.com,
*email: **udayanga@wso2.com* <ud...@wso2.com>* cell: +94 (77) 983-4365
blog: **http://udayangawiki.blogspot.com*<http://udayangawiki.blogspot.com/>
*
twitter: **http://twitter.com/udayanga_wick*<http://twitter.com/udayanga_wick>
*
*
Re: Including Predefined namespaces for Xpath in Synapse
Posted by indika kumara <in...@gmail.com>.
And, also In the multiple XML configurations, do we use the 'import' in the
synapse XML - import sequence definitions, proxy definitions, etc.? The Use
of 'import' construct prevails in almost every language.
~ Indika
On Thu, Mar 3, 2011 at 9:25 PM, indika kumara <in...@gmail.com> wrote:
> Udayanga, Could please show some examples that demonstrate the the problem
> in the synapse multiple xml configurations with the standard way of defining
> namespaces?.
>
> Personally, I would prepare for a standard method if it does not make a
> negative impact on Usability. As the synapse language is based on XML, we
> may expect the users having good knowledge about the XML related
> technologies (XML, XPath, XSLT, etc) may find it is easy to understand and
> memorize the language by intuition.
>
> Thanks,
>
> Indika
>
>
> On Wed, Mar 2, 2011 at 3:50 PM, Udayanga Wickramasinghe <udayanga@wso2.com
> > wrote:
>
>> Hi,
>>
>> On Tue, Mar 1, 2011 at 8:31 PM, Andreas Veithen <
>> andreas.veithen@gmail.com> wrote:
>>
>>> You can already achieve that in a standard way by adding
>>> xmlns:m0="http://org.sample.services" to the _root_ element of the
>>> synapse.xml file. Why would one want to introduce a non standard way
>>> of doing things?
>>>
>>
>> yes true..but we have a problem to use this strategy in synapse multiple
>> xml configurations..
>>
>> Regards,
>> Udayanga
>>
>>
>>>
>>> Andreas
>>>
>>> On Tue, Mar 1, 2011 at 11:51, Udayanga Wickramasinghe <ud...@wso2.com>
>>> wrote:
>>> > Hi devs,
>>> > Currently synapse expressions (expression="xpath" OR value={xpath} )
>>> with
>>> > xpath needs to have namespaces declared within the element. We think it
>>> is
>>> > better to include namespaces construct at synapse.xml that any xpath
>>> > construct would be able to refer to .For example we can define ;
>>> > <namespaces>
>>> > <namespace name="m0">http://org.sample.services</namespace>
>>> > <namespace name="m1">http://org.sample.services</namespace>
>>> > .......
>>> > ....
>>> > </namespaces>
>>> >
>>> > This way any expression can correspond to declared a namespace without
>>> > actually defining them in their local element;
>>> > ie:-
>>> >
>>> > <callout serviceURL="https://api.sample.enp/2.0">
>>> > <source xpath="m0:Body/child::*[fn:position()=1] |
>>> > m1:Body/child::*[fn:position()=1]" />
>>> > <target key="key" />
>>> > </callout>
>>> >
>>> > IMO this implementation will greatly improve readability of the
>>> > configuration. WDYT?
>>> >
>>> > Regards,
>>> > Udayanga
>>> >
>>> > --
>>> > Udayanga Wickramasinghe
>>> > Software Engineer; WSO2 Inc.; http://wso2.com,
>>> > email: udayanga@wso2.com cell: +94 (77) 983-4365
>>> > blog: http://udayangawiki.blogspot.com
>>> > twitter: http://twitter.com/udayanga_wick
>>> >
>>> >
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: dev-unsubscribe@synapse.apache.org
>>> For additional commands, e-mail: dev-help@synapse.apache.org
>>>
>>>
>>
>>
>> --
>> *Udayanga Wickramasinghe*
>> Software Engineer; WSO2 Inc.; http://wso2.com,
>> *email: **udayanga@wso2.com* <ud...@wso2.com>* cell: +94 (77)
>> 983-4365
>> blog: **http://udayangawiki.blogspot.com*<http://udayangawiki.blogspot.com/>
>> *
>> twitter: **http://twitter.com/udayanga_wick*<http://twitter.com/udayanga_wick>
>> *
>> *
>>
>
>
Re: Including Predefined namespaces for Xpath in Synapse
Posted by indika kumara <in...@gmail.com>.
Udayanga, Could please show some examples that demonstrate the the problem
in the synapse multiple xml configurations with the standard way of defining
namespaces?.
Personally, I would prepare for a standard method if it does not make a
negative impact on Usability. As the synapse language is based on XML, we
may expect the users having good knowledge about the XML related
technologies (XML, XPath, XSLT, etc) may find it is easy to understand and
memorize the language by intuition.
Thanks,
Indika
On Wed, Mar 2, 2011 at 3:50 PM, Udayanga Wickramasinghe
<ud...@wso2.com>wrote:
> Hi,
>
> On Tue, Mar 1, 2011 at 8:31 PM, Andreas Veithen <andreas.veithen@gmail.com
> > wrote:
>
>> You can already achieve that in a standard way by adding
>> xmlns:m0="http://org.sample.services" to the _root_ element of the
>> synapse.xml file. Why would one want to introduce a non standard way
>> of doing things?
>>
>
> yes true..but we have a problem to use this strategy in synapse multiple
> xml configurations..
>
> Regards,
> Udayanga
>
>
>>
>> Andreas
>>
>> On Tue, Mar 1, 2011 at 11:51, Udayanga Wickramasinghe <ud...@wso2.com>
>> wrote:
>> > Hi devs,
>> > Currently synapse expressions (expression="xpath" OR value={xpath} )
>> with
>> > xpath needs to have namespaces declared within the element. We think it
>> is
>> > better to include namespaces construct at synapse.xml that any xpath
>> > construct would be able to refer to .For example we can define ;
>> > <namespaces>
>> > <namespace name="m0">http://org.sample.services</namespace>
>> > <namespace name="m1">http://org.sample.services</namespace>
>> > .......
>> > ....
>> > </namespaces>
>> >
>> > This way any expression can correspond to declared a namespace without
>> > actually defining them in their local element;
>> > ie:-
>> >
>> > <callout serviceURL="https://api.sample.enp/2.0">
>> > <source xpath="m0:Body/child::*[fn:position()=1] |
>> > m1:Body/child::*[fn:position()=1]" />
>> > <target key="key" />
>> > </callout>
>> >
>> > IMO this implementation will greatly improve readability of the
>> > configuration. WDYT?
>> >
>> > Regards,
>> > Udayanga
>> >
>> > --
>> > Udayanga Wickramasinghe
>> > Software Engineer; WSO2 Inc.; http://wso2.com,
>> > email: udayanga@wso2.com cell: +94 (77) 983-4365
>> > blog: http://udayangawiki.blogspot.com
>> > twitter: http://twitter.com/udayanga_wick
>> >
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@synapse.apache.org
>> For additional commands, e-mail: dev-help@synapse.apache.org
>>
>>
>
>
> --
> *Udayanga Wickramasinghe*
> Software Engineer; WSO2 Inc.; http://wso2.com,
> *email: **udayanga@wso2.com* <ud...@wso2.com>* cell: +94 (77) 983-4365
> blog: **http://udayangawiki.blogspot.com*<http://udayangawiki.blogspot.com/>
> *
> twitter: **http://twitter.com/udayanga_wick*<http://twitter.com/udayanga_wick>
> *
> *
>
Re: Including Predefined namespaces for Xpath in Synapse
Posted by Udayanga Wickramasinghe <ud...@wso2.com>.
Hi,
On Tue, Mar 1, 2011 at 8:31 PM, Andreas Veithen
<an...@gmail.com>wrote:
> You can already achieve that in a standard way by adding
> xmlns:m0="http://org.sample.services" to the _root_ element of the
> synapse.xml file. Why would one want to introduce a non standard way
> of doing things?
>
yes true..but we have a problem to use this strategy in synapse multiple
xml configurations..
Regards,
Udayanga
>
> Andreas
>
> On Tue, Mar 1, 2011 at 11:51, Udayanga Wickramasinghe <ud...@wso2.com>
> wrote:
> > Hi devs,
> > Currently synapse expressions (expression="xpath" OR value={xpath} ) with
> > xpath needs to have namespaces declared within the element. We think it
> is
> > better to include namespaces construct at synapse.xml that any xpath
> > construct would be able to refer to .For example we can define ;
> > <namespaces>
> > <namespace name="m0">http://org.sample.services</namespace>
> > <namespace name="m1">http://org.sample.services</namespace>
> > .......
> > ....
> > </namespaces>
> >
> > This way any expression can correspond to declared a namespace without
> > actually defining them in their local element;
> > ie:-
> >
> > <callout serviceURL="https://api.sample.enp/2.0">
> > <source xpath="m0:Body/child::*[fn:position()=1] |
> > m1:Body/child::*[fn:position()=1]" />
> > <target key="key" />
> > </callout>
> >
> > IMO this implementation will greatly improve readability of the
> > configuration. WDYT?
> >
> > Regards,
> > Udayanga
> >
> > --
> > Udayanga Wickramasinghe
> > Software Engineer; WSO2 Inc.; http://wso2.com,
> > email: udayanga@wso2.com cell: +94 (77) 983-4365
> > blog: http://udayangawiki.blogspot.com
> > twitter: http://twitter.com/udayanga_wick
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@synapse.apache.org
> For additional commands, e-mail: dev-help@synapse.apache.org
>
>
--
*Udayanga Wickramasinghe*
Software Engineer; WSO2 Inc.; http://wso2.com,
*email: **udayanga@wso2.com* <ud...@wso2.com>* cell: +94 (77) 983-4365
blog: **http://udayangawiki.blogspot.com*<http://udayangawiki.blogspot.com/>
*
twitter: **http://twitter.com/udayanga_wick*<http://twitter.com/udayanga_wick>
*
*
Re: Including Predefined namespaces for Xpath in Synapse
Posted by Andreas Veithen <an...@gmail.com>.
You can already achieve that in a standard way by adding
xmlns:m0="http://org.sample.services" to the _root_ element of the
synapse.xml file. Why would one want to introduce a non standard way
of doing things?
Andreas
On Tue, Mar 1, 2011 at 11:51, Udayanga Wickramasinghe <ud...@wso2.com> wrote:
> Hi devs,
> Currently synapse expressions (expression="xpath" OR value={xpath} ) with
> xpath needs to have namespaces declared within the element. We think it is
> better to include namespaces construct at synapse.xml that any xpath
> construct would be able to refer to .For example we can define ;
> <namespaces>
> <namespace name="m0">http://org.sample.services</namespace>
> <namespace name="m1">http://org.sample.services</namespace>
> .......
> ....
> </namespaces>
>
> This way any expression can correspond to declared a namespace without
> actually defining them in their local element;
> ie:-
>
> <callout serviceURL="https://api.sample.enp/2.0">
> <source xpath="m0:Body/child::*[fn:position()=1] |
> m1:Body/child::*[fn:position()=1]" />
> <target key="key" />
> </callout>
>
> IMO this implementation will greatly improve readability of the
> configuration. WDYT?
>
> Regards,
> Udayanga
>
> --
> Udayanga Wickramasinghe
> Software Engineer; WSO2 Inc.; http://wso2.com,
> email: udayanga@wso2.com cell: +94 (77) 983-4365
> blog: http://udayangawiki.blogspot.com
> twitter: http://twitter.com/udayanga_wick
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@synapse.apache.org
For additional commands, e-mail: dev-help@synapse.apache.org