Re: Creating a DOM Document from HTTP Request of XML failing
Cris R <[email protected]> Tue, 6 Apr 2010 08:26:18 -0700
| Newsgroups | gmane.comp.mozilla.devel.dom |
|---|---|
| Message-ID | <[email protected]> |
On Apr 6, 2010, at 6:41 AM, Boris Zbarsky wrote: > On 4/6/10 12:54 AM, Cris R wrote: >> rv does not get an error. eg rv is set to NS_OK, but the raw pointer >> of document, ends up being null, and the NS_ENSURE_TRUE exits my >> routine, so the<rest of my code> does not execute. >> >> Why is this happening? Is my XML not proper? Any thoughts? > > Are you calling this GetResponseXML code _after_ the XHR completes? > Yes, The XML output posted earlier was from the same call, outputting the text of the inXMLHttpRequest->GetResponseText(text); eg full code is: nsAutoString response; rv = inXMLHttpRequest->GetResponseText(response); NS_ENSURE_SUCCESS(rv, rv); const char* debugOutput = NS_ConvertUTF16toUTF8(response ).get(); MyDebugLog(debugOutput ); nsCOMPtr<nsIDOMDocument> document; rv = inXMLHttpRequest->GetResponseXML(getter_AddRefs(document)); NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_TRUE(document, NS_ERROR_FAILURE); -cris