need little help with MSXML
Hi
I am using MSXML in my VC++ project.My problem is that I will be having some XML documents and in those documents I need to get the data inside the <title> tag and <link> tag.this two tags will be always inside <item> tag.But they will not be in any order.Previously the code I was using is:
if(NODE_ELEMENT==pChild->nodeType)
{
if(_bstr_t("item")==pChild->nodeName)
{
pChild=pChild->firstChild; //assumed that title tag is first tag
m_node.push_back(pChild->text);
pChild=pChild->nextSibling; //assumed link tag is second tag
m_link.push_back(pChild->text);
}
}
But I can not assume like this,title tag and link tag will not be the first and second tag always.So is there any other method or property of MSXML which can solve my problem.Plz help me with code.Thanks in advance
Re: need little help with MSXML
Look up xpath. Use xpath to search for "item/title" and "item/link" (or "/item/title" or just "title",etc. It really depends what scope you're at.)
Check out xpath and then get back to us.