views:

32

answers:

1

I get back the responseXml as a javascript object XMLdocument. How do i parse it to just return the body? here is my code snippet:

goog.net.XhrIo.send("/blogs/create?authenticity_token="+
       goog.string.urlEncode(authtoken), function(e) {
           var xhr = /** @type {goog.net.XhrIo} */ (e.target);
           var responseXml = xhr.getResponseXml();

           var parent = goog.dom.getElement('response');
           goog.dom.setTextContent(parent, responseXml.body); /** This returns 
                                              undefined rather than the body itself! */

           }, 'POST', "&body="+goog.string.urlEncode(someHTMLContent), {
              'Accept' : 'text/xml'
}); 
+1  A: 

Yeah, you shouldn't need to do any parsing. The responseXml object you get back is a Document object (API docs), so your syntax of responseXml.body should work. I'm not sure what the problem is, here. If you post a live example we can debug further.

Eric Nguyen
Yes you are absolutely right. I had resolved this issue long ago. However, i am accepting your answer as it is right! :)
Shripad K