Cris R
2010-04-06 04:54:29 UTC
Hi,
I send an HTTP Request, which returns the following XML.
<?xml version="1.0" encoding="UTF-8"?>
<users_getInfo_response xmlns="http://api.facebook.com/1.0/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://api.facebook.com/1.0/
http://api.facebook.com/1.0/facebook.xsd" list="true">
<user>
<about_me xsi:nil="true"/>
<first_name>Chewy</first_name>
<last_name>Cat</last_name>
<uid>100000495237103</uid>
<pic_square>http://profile.ak.fbcdn.net/v22944/850/83/q10000049523710
3_4003.jpg</pic_square>
</user>
</users_getInfo_response>
To parse the XML, my understanding is I should create a document. (Is
such correct?)
So to create a DOMDocument, I have the following C++ code:
nsCOMPtr<nsIDOMDocument> document;
rv = inXMLHttpRequest->GetResponseXML(getter_AddRefs(document));
NS_ENSURE_SUCCESS(rv, rv);
NS_ENSURE_TRUE(document, NS_ERROR_FAILURE);
<rest of my code>
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?
Thanks in advance,
-cris
I send an HTTP Request, which returns the following XML.
<?xml version="1.0" encoding="UTF-8"?>
<users_getInfo_response xmlns="http://api.facebook.com/1.0/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://api.facebook.com/1.0/
http://api.facebook.com/1.0/facebook.xsd" list="true">
<user>
<about_me xsi:nil="true"/>
<first_name>Chewy</first_name>
<last_name>Cat</last_name>
<uid>100000495237103</uid>
<pic_square>http://profile.ak.fbcdn.net/v22944/850/83/q10000049523710
3_4003.jpg</pic_square>
</user>
</users_getInfo_response>
To parse the XML, my understanding is I should create a document. (Is
such correct?)
So to create a DOMDocument, I have the following C++ code:
nsCOMPtr<nsIDOMDocument> document;
rv = inXMLHttpRequest->GetResponseXML(getter_AddRefs(document));
NS_ENSURE_SUCCESS(rv, rv);
NS_ENSURE_TRUE(document, NS_ERROR_FAILURE);
<rest of my code>
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?
Thanks in advance,
-cris