0

I am trying to parse xml file using MSXML , But I want to parse particular tags(nodes) not all nodes. Below two lines additional to the whole for xml parsing , gives output of all nodes. If I replace L" " to L"tag_name" ... I will get the results but I want to include more tags not just one. Please help.

//Variable with the name of node to find: BSTR strFindText = L" ";//" " means to output every node

May
  • 207
  • 2
  • 7
  • It's not clear from your description what you are trying to achieve, but look at `IXMLDOMDocument::selectNodes` method. It lets you select a set of nodes that satisfy an XPath expression. – Igor Tandetnik Oct 14 '13 at 22:40
  • I am using this pointer IXMLDOMNodeListPtr NodeListPtr; and I am //Collect all or selected nodes by tag name: NodeListPtr = docPtr->getElementsByTagName(strFindText); and my strFindText = L" " to select all nodes – May Oct 14 '13 at 22:45
  • 1
    So try `docPtr->selectNodes(L"tag1||tag2")` – Igor Tandetnik Oct 14 '13 at 22:48
  • Thank you, I tried but I am getting an exception. – May Oct 14 '13 at 23:16
  • Sorry, my bad. It should be a single pipe. I think the right incantation is "//tag1 | //tag2", but I must admit my XPath is rather rusty. – Igor Tandetnik Oct 15 '13 at 03:15
  • Finally, I got it. But I did not use selectNodes method , instead passed another parameter to the parsing function and tweaked few if statements. And worked like a Charm ! – May Oct 15 '13 at 17:24

0 Answers0