开发者

How do i parse the XML document in the callback?

开发者 https://www.devze.com 2023-01-05 08:46 出处:网络
I get back the responseXml as a javascript object XMLdocument. How do i parse it to just return the body?

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.se开发者_如何转开发tTextContent(parent, responseXml.body); /** This returns 
                                              undefined rather than the body itself! */

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


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消