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
ebase web service response name space problem
Moderators: Jon, Steve, Ian, Dave
-
xren
- Ebase User
- Posts: 272
- Joined: Fri Dec 14, 2012 2:55 pm
- Location: Ottawa
-
dan
- Ebase User
- Posts: 8
- Joined: Mon Jan 14, 2013 9:49 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.
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
Who is online
Users browsing this forum: No registered users and 39 guests