[prev in list] [next in list] [prev in thread] [next in thread] 

List:       wsas-java-dev
Subject:    Re: [Dev] [Siddhi] Handling XML namespaces in map:createFromXML extension
From:       Mohanadarshan Vivekanandalingam <mohan () wso2 ! com>
Date:       2018-02-26 20:26:00
Message-ID: CAHf1eqQZSidOrn7zONqKFPODxW5p3YBzCsqAjeiihp5j++shzg () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


On Tue, Feb 27, 2018 at 1:43 AM, Mohanadarshan Vivekanandalingam <
mohan@wso2.com> wrote:

>
>
> On Sat, Feb 24, 2018 at 8:08 PM, Minudika Malshan <minudika@wso2.com>
> wrote:
>
>> Hi all,
>>
>> In Siddhi Map Extension, map:createFromXML will return a hashmap created
>> from the given XML payload.
>>
>> However, when this payload has a namespace, that namespace is propagated
>> to the child elements also. Therefore in such cases, in the generated hash
>> map will have the keys in the following format instead of having only the
>> element name.
>>
>> *{namespace}elementName*
>>
>> Therefore, when trying to retrieve values from that map, Instead of using
>> only the element name as the key, we have to provide the key in above
>> format.
>>
>> Eg :
>> We have to use,
>>
>> *map:get(map, '{namespace}key)*
>> instead of
>> *map:get(map, 'key')*
>>
>> In the documentation, this has not been mentioned. [1]
>>
>> Shall we add these info to the doc?
>> Or  Is it safe to change the implementation to drop the namespace and to
>> generate the map with element names as the keys?
>>
>
> When processing a XML element, we have to consider the namespace. If not,
> we will end up many issues. I am OK for using namespace with key. Let's
> document that.
> BTW, do we need to provide namespace inside curly brace ?
>
> Thanks,
> Mohan
>
>
>
>>
>> [1] https://docs.wso2.com/display/CEP420/Map+Extension
>>
>> Thanks and regards!
>> --
>> *Minudika Gammanpila*
>> Software Engineer - WSO2
>>
>> Email   :  minudika@wso2.com
>> Mobile :  +94715659887 <+94%2071%20565%209887>
>> Web     :  http://wso2.com
>>
>> <http://wso2.com> <http://wso2.com/signature>
>>
>
>
>
> --
> *V. Mohanadarshan*
> *Technical Lead,*
> *Data Technologies Team,*
> *WSO2, Inc. http://wso2.com <http://wso2.com> *
> *lean.enterprise.middleware.*
>
> email: mohan@wso2.com
> phone:(+94) 771117673 <+94%2077%20111%207673>
>



-- 
*V. Mohanadarshan*
*Technical Lead,*
*Data Technologies Team,*
*WSO2, Inc. http://wso2.com <http://wso2.com> *
*lean.enterprise.middleware.*

email: mohan@wso2.com
phone:(+94) 771117673

[Attachment #5 (text/html)]

<div dir="ltr"><br></div><div class="gmail_extra"><br><div class="gmail_quote">On \
Tue, Feb 27, 2018 at 1:43 AM, Mohanadarshan Vivekanandalingam <span dir="ltr">&lt;<a \
href="mailto:mohan@wso2.com" target="_blank">mohan@wso2.com</a>&gt;</span> \
wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px \
#ccc solid;padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><br><div \
class="gmail_quote"><span class="">On Sat, Feb 24, 2018 at 8:08 PM, Minudika Malshan \
<span dir="ltr">&lt;<a href="mailto:minudika@wso2.com" \
target="_blank">minudika@wso2.com</a>&gt;</span> wrote:<br><blockquote \
class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex"><div dir="ltr"><div><div><div>Hi all,<br><br></div>In Siddhi \
Map Extension, map:createFromXML will return a hashmap created from the given XML \
payload.<br><br></div>However, when this payload has a namespace, that namespace is \
propagated to the child elements also. Therefore in such cases, in the generated hash \
map will have the keys in the following format instead of having only the element \
name.<br><span style="font-family:monospace,monospace"><br></span></div><span \
style="font-family:monospace,monospace"><b>{namespace}elementName</b></span><br><div><div><div><br></div><div>Therefore, \
when trying to retrieve values from that map, Instead of using only the element name \
as the key, we have to provide the key in above format. <br><br></div><div>Eg : \
<br></div><div>We have to use, <br></div><div><b><span \
style="font-family:monospace,monospace">map:get(map, \
&#39;{namespace}key)<br></span></b><br></div><div>instead of<br></div><div><b><span \
style="font-family:monospace,monospace">map:get(map, \
&#39;key&#39;)</span></b><br></div><div><div><div class="gmail_quote"><br></div><div \
class="gmail_quote">In the documentation, this has not been mentioned. \
[1]<br><br></div><div class="gmail_quote">Shall we add these info to the \
doc?<br></div><div class="gmail_quote">Or    Is it safe to change the implementation \
to drop the namespace and to generate the  map with element names as the \
keys?<br></div></div></div></div></div></div></blockquote><div><br></div></span><div>When \
processing a XML element, we have to consider the namespace. If not, we will end up \
many issues. I am OK for using namespace with key. Let&#39;s document that.  \
</div><div>BTW, do we need to provide namespace inside curly brace \
?</div><div><br></div><div>Thanks,</div><div>Mohan</div><span \
class=""><div><br></div><div>  </div><blockquote class="gmail_quote" style="margin:0 \
0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div \
dir="ltr"><div><div><div><div><div class="gmail_quote"><br>[1] <a \
href="https://docs.wso2.com/display/CEP420/Map+Extension" \
target="_blank">https://docs.wso2.com/display/<wbr>CEP420/Map+Extension</a><br><br></div><div \
class="gmail_quote">Thanks and regards!<span \
class="m_2427439598422515283HOEnZb"><font \
color="#888888"><br></font></span></div></div></div></div></div><span \
class="m_2427439598422515283HOEnZb"><font color="#888888">-- <br><div \
class="m_2427439598422515283m_-6830209622700619836gmail_signature" \
data-smartmail="gmail_signature"><div dir="ltr"><div><div \
dir="ltr"><div><div><div><div><b>Minudika Gammanpila</b><br></div><span \
style="color:rgb(102,102,102)">Software Engineer - WSO2<br><br></span></div><span \
style="color:rgb(102,102,102)">Email     :   <a href="mailto:minudika@wso2.com" \
target="_blank">minudika@wso2.com</a><br></span></div><span \
style="color:rgb(102,102,102)">Mobile :   <a href="tel:+94%2071%20565%209887" \
value="+94715659887" target="_blank">+94715659887</a><br></span></div><span \
style="color:rgb(102,102,102)">Web         :   <a href="http://wso2.com" \
target="_blank">http://wso2.com<br><br></a></span></div><div dir="ltr"><span \
style="color:rgb(102,102,102)"><a href="http://wso2.com" target="_blank"></a><a \
href="http://wso2.com/signature" target="_blank"><img \
src="http://c.content.wso2.com/signatures/wso2-signature-general.png" \
alt=""></a></span><br></div></div></div></div> </font></span></div>
</blockquote></span></div><span class="HOEnZb"><font color="#888888"><br><br \
clear="all"><div><br></div>-- <br><div class="m_2427439598422515283gmail_signature" \
data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div \
dir="ltr"><div><div dir="ltr"><font color="#444444" face="georgia, serif" size="2"><b \
style="background-color:rgb(255,255,255)">V. Mohanadarshan</b></font><div><div><font \
color="#444444" face="times new roman, serif" size="1"><b \
style="background-color:rgb(255,255,255)">Technical Lead,</b></font></div><div><font \
color="#444444" face="times new roman, serif" size="1"><b \
style="background-color:rgb(255,255,255)">Data Technologies \
Team,</b></font></div><div><font color="#444444" face="times new roman, serif" \
size="1"><b style="background-color:rgb(255,255,255)">WSO2, Inc. <a \
href="http://wso2.com" target="_blank">http://wso2.com</a>  \
</b></font></div><div><font color="#444444" face="times new roman, serif" size="1"><b \
style="background-color:rgb(255,255,255)">lean.enterprise.middleware.</b></font></div></div><div><font \
color="#444444" face="georgia, serif" size="2"><b \
style="background-color:rgb(255,255,255)"><br></b></font></div><div><font \
style="background-color:rgb(255,255,255)" color="#444444" size="1">email: <a \
href="mailto:mohan@wso2.com" target="_blank">mohan@wso2.com</a>  \
</font></div><div><font style="background-color:rgb(255,255,255)" color="#444444" \
size="1">phone:<a href="tel:+94%2077%20111%207673" value="+94771117673" \
target="_blank">(+94) \
771117673</a></font></div></div></div></div></div></div></div></div></div> \
</font></span></div></div> </blockquote></div><br><br clear="all"><div><br></div>-- \
<br><div class="gmail_signature" data-smartmail="gmail_signature"><div \
dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><font \
color="#444444" face="georgia, serif" size="2"><b \
style="background-color:rgb(255,255,255)">V. Mohanadarshan</b></font><div><div><font \
color="#444444" face="times new roman, serif" size="1"><b \
style="background-color:rgb(255,255,255)">Technical Lead,</b></font></div><div><font \
color="#444444" face="times new roman, serif" size="1"><b \
style="background-color:rgb(255,255,255)">Data Technologies \
Team,</b></font></div><div><font color="#444444" face="times new roman, serif" \
size="1"><b style="background-color:rgb(255,255,255)">WSO2, Inc. <a \
href="http://wso2.com" target="_blank">http://wso2.com</a>  \
</b></font></div><div><font color="#444444" face="times new roman, serif" size="1"><b \
style="background-color:rgb(255,255,255)">lean.enterprise.middleware.</b></font></div></div><div><font \
color="#444444" face="georgia, serif" size="2"><b \
style="background-color:rgb(255,255,255)"><br></b></font></div><div><font \
style="background-color:rgb(255,255,255)" color="#444444" size="1">email: <a \
href="mailto:mohan@wso2.com" target="_blank">mohan@wso2.com</a>  \
</font></div><div><font style="background-color:rgb(255,255,255)" color="#444444" \
size="1">phone:(+94) \
771117673</font></div></div></div></div></div></div></div></div></div> </div>



_______________________________________________
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic