ebase web service response name space problem

Post any questions you have about using the Verj.io Studio, including client and server-side programming with Javascript or FPL, and integration with databases, web services etc.

Moderators: Jon, Steve, Ian, Dave

xren
Ebase User
Posts: 272
Joined: Fri Dec 14, 2012 2:55 pm
Location: Ottawa

ebase web service response name space problem

#1

Postby xren » Wed Mar 06, 2013 4:05 pm

Hi,

I found my auto complete not working using the code from the web page.
The reason is that the returned xml has name space, then the xml find doesn't work with it.

How to solve this problem?

Can you provide an example using javascript (or cross browser and version jquery) to traverse node then build the response?

Thanks,
Xiaoli
0 x

dan
Ebase User
Posts: 8
Joined: Mon Jan 14, 2013 9:49 am

#2

Postby dan » Thu Mar 07, 2013 9:17 am

I've had a similar issue - I developed this following script to cope with this (heavily based on various google searches!). I use this to help process jquery ajax responses to Ebase Xi webservices.

Its a jquery plugin and can be included as a client script.

Its designed to handle finding namespaced xml nodes. The comments at the top of the script should give you an idea of how to use it (basically use this instead of .find() in the autocomplete example in the Resource Centre section of the http://www.ebasetech.com website).


Hope it helps.

Code: Select all

/*
    JQuery 1.7+ does not support namespaced XML parsing such as returned from Ebase Webservices.
    Certainly it does not support it consistantly amoungst browsers.
    
    An example of the previously correct syntax: $(xml).find("ebas\\:ROWS"); 
    
    This plug-in is a workaround for this (while performing consistantly better than the previous method across browsers).
    It should be compatible with all versions of jQuery as it only uses basic functions.
    
    Use: $(xml).findNameSpacedXMLNode('ebas:ROWS');
    
    Add (as a Client Script) after the jQuery library and before something uses it.
*/
;
(function( $ )
{
    $.fn.findNameSpacedXMLNode = function(nameSpacedName) 
    {
        return this.find("*").filter(function()
                                     {
                                         return this.nodeName === nameSpacedName;
                                     });
    };
})( jQuery ); 
0 x
Dan

xren
Ebase User
Posts: 272
Joined: Fri Dec 14, 2012 2:55 pm
Location: Ottawa

#3

Postby xren » Fri Mar 08, 2013 3:17 pm

Thank you. I will try this out.
0 x


Who is online

Users browsing this forum: No registered users and 50 guests