It seems you have a misunderstanding here. $(data).text() will get you the innerText/textContent of all the nodes in your XML, it's not converting the whole response back to text.
Are you sending the response as 'text/xml' from the server? add complete: function(xhr){ console.log(xhr); } and check if you have the responseXML property (you can try to use it's documentElement directly also). - ricardo On Feb 20, 3:59 am, "s.ross" <cwdi...@gmail.com> wrote: > Thanks for the reply. Here are a few results from the callback > function: > > data => [object Document] > data.find('category') => TypeError: Value undefined does not allow > function calls. > $(data).find('category') => [object Object] > $(data).find('category').length => 0 > $(data).text() => [text of whole xml document] > > As you can see, the data passed into the function is a first-class > object, but as the second line illustrates, we can't traverse its DOM > yet. So, I promote it to a jQuery object using $(data). Doing a find > ('category') on that produces an object, but the length (I've > confirmed that it's pretty extensive) still shows up as zero. Noting > that $(data).text() "demotes" the object to its textual XML > representation, I found I could wrap that as: > > $( > $(data).text() > ) > > which means (to me), forget what you knew about the data object passed > in and strip it back to bare text, then parse it as an xml document. > > I'm sure I'm making some dumb mistake here, but I just don't see it. > There's just no reason a library as capable as jQuery shouldn't be > able to wrap this little problem around its little finger. I'm > perplexed. But I am also completely sold on jQuery for all my Web > projects where debugging is at least slightly more sane :) > > On Feb 19, 10:27 pm, mkmanning <michaell...@gmail.com> wrote: > > > I suspect it's the dance you're having to do. Quickly testing in a > > browser, If you use > > > xmlObjectTree = $(data) > > > then you can iterate through the animal tags. > > Doing the dance in a browser yields an unrecognized expression syntax > > exception. How did you come to use $($(data).text()); and what happens > > if you use the other method? > > > On Feb 19, 8:29 pm, "s.ross" <cwdi...@gmail.com> wrote: > > > > I'm trying to get Adobe(TM)(R) AIR to work with jQuery kinda friendly- > > > like. I'm sending off an xml-rpc request as follows: > > > > this.packageRequest = function(method, > > > secure, params, callback) { > > > var msg = new > > > XMLRPCMessage(method); > > > msg.addParameter(params); > > > > urn = (secure) ? this.SecureUrn : > > > this.Urn; > > > urn += this.istockEndPoint; > > > $.ajax({ > > > url: urn, > > > data: msg.xml(), > > > dataType: 'xml', > > > type: 'POST', > > > contentType: 'text/xml', > > > success: callback > > > }); > > > } > > > > All well and good, and for simple response groups, this works great. > > > The callback function is invoked and the xml sanitized. I'm not > > > certain why, but I have to do this dance in the callback: > > > > function myFineCallback(data) { > > > xmlObjectTree = $($(data).text()); > > > > } > > > > The problem I'm really bumping up against is the case where the XML > > > looks like: > > > > <root> > > > <animals> > > > <category name="reptiles" /> > > > <category name="mammals" /> > > > <category name="marsupials" /> > > > </animals> > > > </root> > > > > You get the picture. The tags have no content. One would expect that: > > > > xmlObjectTree.find('animals category').each( ... ) > > > > would iterate the animals tags, allowing me to pull the name attribute > > > out, but I'm getting a zero-length result. Same for xmlObjectTree.find > > > ('category'). > > > > Any thoughts>