CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2007
    Posts
    39

    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

  2. #2
    Join Date
    Apr 2002
    Location
    PA, USA
    Posts
    1,658

    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.
    =--=--=--=--=--=--=--=--=--=--=--=--=--=
    Please rate this post to show your appreciation for those that helped you.

    Before You Post A Question, Please Read This: How & When To Ask Your Question
    =--=--=--=--=--=--=--=--=--=--=--=--=--=

    -eli
    http://www.toad-software.com
    http://www.dailymission.com - Do It Daily

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured