IXMLDomNode::selectSingleNode() returns null

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
Hello,
this function returns null on what seems to be a perfectly correct XML file.
heres my xml file:
<div style="color:black; background-color:white
<pre><span style="color:blue <?<span style="color:#a31515 xml <span style="color:red version<span style="color:blue =<span style="color:black "<span style="color:blue 1.0<span style="color:black " <span style="color:red encoding<span style="color:blue =<span style="color:black "<span style="color:blue ISO-8859-1<span style="color:black " <span style="color:blue ?>

<span style="color:blue <<span style="color:#a31515 rss <span style="color:red version<span style="color:blue =<span style="color:black "<span style="color:blue 2.0<span style="color:black "<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 channel<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 title<span style="color:blue >InvestMais :: A revista do investidor na bolsa <span style="color:blue </<span style="color:#a31515 title<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 link<span style="color:blue >http://www.revistainvestmais.com.br<span style="color:blue </<span style="color:#a31515 link<span style="color:blue >

<span style="color:blue <<span style="color:#a31515 language<span style="color:blue >pt-br<span style="color:blue </<span style="color:#a31515 language<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 copyright<span style="color:blue >2009 - InvestMais. Todos os direitos reservados.<span style="color:blue </<span style="color:#a31515 copyright<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 image<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 title<span style="color:blue >InvestMais :: A revista do investidor na bolsa<span style="color:blue </<span style="color:#a31515 title<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 url<span style="color:blue >http://www.revistainvestmais.com.br<span style="color:blue </<span style="color:#a31515 url<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 link<span style="color:blue >http://www.revistainvestmais.com.br<span style="color:blue </<span style="color:#a31515 link<span style="color:blue >
<span style="color:blue </<span style="color:#a31515 image<span style="color:blue >


<span style="color:blue <<span style="color:#a31515 item<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 title<span style="color:blue >(BHGR3) BHG: crescendo na onda brasileira<span style="color:blue </<span style="color:#a31515 title<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 link<span style="color:blue >http://www.revistainvestmais.com.br/artigo/775-(BHGR3)+BHG:+crescendo+na+onda+brasileira.html<span style="color:blue </<span style="color:#a31515 link<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 description<span style="color:blue >Copa do Mundo de Futebol em 2014 e Jogos OlÃmpicos em 2016. O Brasil à mesmo o paÃs do futuro, e a Brazil Hospitality Group (BHG), terceira maior administradora de hotÃis do PaÃs, quer tirar proveito disso. Saiba como e reÃna os argumentos necessÃrios para decidir se quer ter BHGR3 em sua carteira de investimentos<span style="color:blue </<span style="color:#a31515 description<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 datePosted<span style="color:blue >05/04/2011<span style="color:blue </<span style="color:#a31515 datePosted<span style="color:blue >
<span style="color:blue </<span style="color:#a31515 item<span style="color:blue >

<span style="color:blue <<span style="color:#a31515 item<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 title<span style="color:blue >Rota do Sucesso<span style="color:blue </<span style="color:#a31515 title<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 link<span style="color:blue >http://www.revistainvestmais.com.br/artigo/778-Rota+do+Sucesso.html<span style="color:blue </<span style="color:#a31515 link<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 description<span style="color:blue >Nova lista de milionÃrios mostra nova histÃria do Brasil<span style="color:blue </<span style="color:#a31515 description<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 datePosted<span style="color:blue >05/04/2011<span style="color:blue </<span style="color:#a31515 datePosted<span style="color:blue >
<span style="color:blue </<span style="color:#a31515 item<span style="color:blue >

<span style="color:blue <<span style="color:#a31515 item<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 title<span style="color:blue >Alessandro Helpa deve tudo à bolsa<span style="color:blue </<span style="color:#a31515 title<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 link<span style="color:blue >http://www.revistainvestmais.com.br/artigo/780-Alessandro+Helpa+deve+tudo+Ã+bolsa.html<span style="color:blue </<span style="color:#a31515 link<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 description<span style="color:blue >Para ele, os investimentos representam sua liberdade<span style="color:blue </<span style="color:#a31515 description<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 datePosted<span style="color:blue >05/04/2011<span style="color:blue </<span style="color:#a31515 datePosted<span style="color:blue >
<span style="color:blue </<span style="color:#a31515 item<span style="color:blue >

<span style="color:blue <<span style="color:#a31515 item<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 title<span style="color:blue >O MÃtodo dos Aportes Dobrados<span style="color:blue </<span style="color:#a31515 title<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 link<span style="color:blue >http://www.revistainvestmais.com.br/artigo/787-O+MÃtodo+dos+Aportes+Dobrados.html<span style="color:blue </<span style="color:#a31515 link<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 description<span style="color:blue >TÃcnicas para gestÃo de aportes em carteira prÃpria e em fundos de aÃÃes<span style="color:blue </<span style="color:#a31515 description<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 datePosted<span style="color:blue >05/04/2011<span style="color:blue </<span style="color:#a31515 datePosted<span style="color:blue >
<span style="color:blue </<span style="color:#a31515 item<span style="color:blue >

<span style="color:blue <<span style="color:#a31515 item<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 title<span style="color:blue >BanifInvest<span style="color:blue </<span style="color:#a31515 title<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 link<span style="color:blue >http://www.revistainvestmais.com.br/artigo/785-BanifInvest.html<span style="color:blue </<span style="color:#a31515 link<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 description<span style="color:blue >Acesso à bolsa em um clique<span style="color:blue </<span style="color:#a31515 description<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 datePosted<span style="color:blue >05/04/2011<span style="color:blue </<span style="color:#a31515 datePosted<span style="color:blue >
<span style="color:blue </<span style="color:#a31515 item<span style="color:blue >

<span style="color:blue <<span style="color:#a31515 item<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 title<span style="color:blue >Portal da CVM ajuda a investir â em conhecimento<span style="color:blue </<span style="color:#a31515 title<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 link<span style="color:blue >http://www.revistainvestmais.com.br/artigo/784-Portal+da+CVM+ajuda+a+investir+â+em+conhecimento.html<span style="color:blue </<span style="color:#a31515 link<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 description<span style="color:blue >A ComissÃo de Valores MobiliÃrios (CVM) Ã um ÃrgÃo governamental que regula o mercado de aÃÃes e defende o interesse dos investidores, especialmente dos acionistas minoritÃrios, e que tambÃm atua na conscientizaÃÃo, orientaÃÃo e informaÃÃo desse pÃblico. Como outras CVMs espalhadas pelo mundo, a entidade brasileira mantÃm uma Ãrea especÃfica de educaÃÃo, chamada Portal do Investidor.<span style="color:blue </<span style="color:#a31515 description<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 datePosted<span style="color:blue >05/04/2011<span style="color:blue </<span style="color:#a31515 datePosted<span style="color:blue >
<span style="color:blue </<span style="color:#a31515 item<span style="color:blue >

<span style="color:blue <<span style="color:#a31515 item<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 title<span style="color:blue >Paulo Campos<span style="color:blue </<span style="color:#a31515 title<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 link<span style="color:blue >http://www.revistainvestmais.com.br/artigo/781-Paulo+Campos.html<span style="color:blue </<span style="color:#a31515 link<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 description<span style="color:blue >Saiba o que o INI e o RI podem fazer pelos investidores<span style="color:blue </<span style="color:#a31515 description<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 datePosted<span style="color:blue >05/04/2011<span style="color:blue </<span style="color:#a31515 datePosted<span style="color:blue >
<span style="color:blue </<span style="color:#a31515 item<span style="color:blue >

<span style="color:blue <<span style="color:#a31515 item<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 title<span style="color:blue >ADVFN Responde<span style="color:blue </<span style="color:#a31515 title<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 link<span style="color:blue >http://www.revistainvestmais.com.br/artigo/776-ADVFN+Responde.html<span style="color:blue </<span style="color:#a31515 link<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 description<span style="color:blue >IPOs â Vale a pena entrar?<span style="color:blue </<span style="color:#a31515 description<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 datePosted<span style="color:blue >05/04/2011<span style="color:blue </<span style="color:#a31515 datePosted<span style="color:blue >
<span style="color:blue </<span style="color:#a31515 item<span style="color:blue >

<span style="color:blue <<span style="color:#a31515 item<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 title<span style="color:blue >Investidor anjo, vocà conhece algum?<span style="color:blue </<span style="color:#a31515 title<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 link<span style="color:blue >http://www.revistainvestmais.com.br/artigo/790-Investidor+anjo+vocÃ+conhece+algum.html<span style="color:blue </<span style="color:#a31515 link<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 description<span style="color:blue >Pequenas empresas e empreendedores com ideias inovadoras e que precisam de investimentos para colocÃ-las em prÃtica podem contar com a ajuda dos investidores anjo<span style="color:blue </<span style="color:#a31515 description<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 datePosted<span style="color:blue >05/04/2011<span style="color:blue </<span style="color:#a31515 datePosted<span style="color:blue >
<span style="color:blue </<span style="color:#a31515 item<span style="color:blue >

<span style="color:blue </<span style="color:#a31515 channel<span style="color:blue >
<span style="color:blue </<span style="color:#a31515 rss<span style="color:blue >

[/code]



heres my code:

<div style="color:black; background-color:white
<pre>MSXML2::IXMLDOMDocumentPtr pXMLDoc;
hResult = pXMLDoc.CreateInstance(__uuidof(DOMDocument60), NULL, CLSCTX_INPROC_SERVER);

hResult = pIXMLHTTPRequest->get_responseXML((IDispatch **) &pXMLDoc);

<span style="color:blue if ( FAILED(hResult) )
{
pIXMLHTTPRequest->abort();
<span style="color:blue return NULL;
}

MSXML2::IXMLDOMParseErrorPtr pIParseError;
hResult = pXMLDoc->get_parseError(&pIParseError);
SUCCEEDED(hResult) ? 0 : <span style="color:blue throw hResult;

<span style="color:blue if(pIParseError )
{
CString strOutput;
<span style="color:blue long <span style="color:blue value;
hResult = pIParseError->get_errorCode(&<span style="color:blue value);
<span style="color:blue if(SUCCEEDED(hResult))
{
strOutput = (<span style="color:blue value != 0) ? _T(<span style="color:#a31515 "Load Error") : _T(<span style="color:#a31515 "Load Succeeded");
}
}

MSXML2::IXMLDOMNodePtr XMLRootRssNode = pXMLDoc->selectSingleNode(<span style="color:#a31515 "rss");[/code]

Im using the HTTP request object to get the XML file, and the url is <span style="font-family:Calibri,sans-serif; font-size:15px http://www.revistainvestmais.com.br/rss/?action=rss http://www.revistainvestmais.com.br/rss/?action=rss
This code works fine for most RSS feed urls, but for some reason it doesnt work with this one.
<span style="font-family:Calibri,sans-serif; font-size:15px The xml file gets loaded correctly in the HTTP request object and there is no parse error, but when I try to load the rss node it returns null. Anyone have any idea what Im doing wrong here?

<span style="font-family:Calibri,sans-serif; font-size:15px Thanks,
<span style="font-family:Calibri,sans-serif; font-size:15px Alex
<br/>
<br/>
<br/>

View the full article
 
Back
Top