If you want to do a namespace aware query, then use [1], else use [2]. You
should use proper E4X queries[3].

/Ruchira

[1]
var ns = "http://www.wso2.org/governance/metadata";;
print(x.*::application.*::key.text());

[2]
print(x.ns::application.ns::key.text());

[3] http://wso2.org/project/mashup/2.3.2/docs/e4xquickstart.html

On Thu, Jul 19, 2012 at 6:30 PM, Dilshan Edirisuriya <[email protected]>wrote:

> Hi,
>
> Tried to parse the following xml chunk.
>
> <%
>
> var x= <metadata xmlns="http://www.wso2.org/governance/metadata";>
>               <application>
>                   <key>test1</key>
>                   <description>test1</description>
>                   <name>test1</name>
>               </application>
>               <serviceLifecycle>
>                   <lifecycleName>ApplicationLifecycle</lifecycleName>
>                </serviceLifecycle>
>            </metadata>;
>
> print(x.application.key);
>
> %>
>
> The objective of this is to print the key. But when testing this on try
> it, it prints an empty string. The issue is with the "xmlns" attribute
> NAME. It will work for any other attribute other than xmlns. Is there any
> other way to read the key?
>
>
> Regards,
>
> Dilshan
>
>
>
> _______________________________________________
> Dev mailing list
> [email protected]
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>


-- 
*Ruchira Wageesha
Senior Software Engineer & Member, Management Committee, Development
Technologies*
*WSO2 Inc. - lean . enterprise . middleware |  wso2.com*
*
email: [email protected],   blog: ruchirawageesha.blogspot.com,   mobile:
+94 77 5493444*
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to