<tab>这个节点不是固定的以下是XML文件样本<tab name="新浪" type="browser" show="1" refreshmode="" owner="0" state="15" cx="0" cy="0">
<icon1>tabDefault-1.png</icon1>
<icon2>tabDefault-2.png</icon2>
<hint>新浪</hint>
<url>www.126.com</url>
</tab>
以下是XML文件样本
<?xml version="1.0" encoding="UTF-8"?>
<user_channel>
<tab name="0b96fcdde38326cf475abe3c2337832f" type="browser" show="1" refreshmode="" owner="1" state="8" cx="24" cy="24">
<icon1>0b96fcdde38326cf475abe3c2337832f-0.bmp</icon1>
<icon2>0b96fcdde38326cf475abe3c2337832f-0.bmp</icon2>
<hint>OA系统</hint>
<url>http://220.113.41.201:8080/ioas/dddl.asp?account=$Account&amp;gid=$Gid</url>
</tab>
<tab name="新浪" type="browser" show="1" refreshmode="" owner="0" state="15" cx="0" cy="0">
<icon1>tabDefault-1.png</icon1>
<icon2>tabDefault-2.png</icon2>
<hint>新浪</hint>
<url>www.126.com</url>
</tab>
<tab name="新浪2" type="browser" show="1" refreshmode="" owner="0" state="15" cx="0" cy="0">
<icon1>tabDefault-1.png</icon1>
<icon2>tabDefault-2.png</icon2>
<hint>新浪</hint>
<url>www.126.com</url>
</tab>
<tab name="57ac3f675257949a7f35a711207ee80c" type="dll" show="1" refreshmode="onactive" owner="1" state="8" cx="24" cy="24">
<icon1>57ac3f675257949a7f35a711207ee80c-0.png</icon1>
<icon2>57ac3f675257949a7f35a711207ee80c-0.png</icon2>
<hint>协作区</hint><url>TribeApp.dll</url>
</tab>
<tab name="126邮箱" type="browser" show="1" refreshmode="" owner="2" state="15" cx="0" cy="0">
<icon1>tabDefault-1.png</icon1>
<icon2>tabDefault-2.png</icon2>
<hint>126邮箱</hint><url>http://www.163.com</url>
</tab>
</user_channel>

解决方案 »

  1.   

    没有捷径。
    按文本文件读进来,一部分一部分的字符匹配,找到需要的内容。
    你要搜索超级链接,就先匹配<url>,再往后匹配</url>,然后截取中间部分。
    <url>http://www.163.com</url>
      

  2.   

    可以用CMarkup 或者msxml 组件来读取xml
      

  3.   

    这通常叫解析网页,你用下面做关键词,或许在网上能找到示例代码。
    ParseHtml
    找不到,我的代码要等方便时贴给你看。
      

  4.   

    .net的技术,如果应用复杂,只能找.net提供的相关组件如果简单,自己解下也行
      

  5.   

    MSXML跟.net没什么关系 .net库只是拿他包装了一下
    例子也很好找http://www.perfectxml.com/msxmlCPP.asp
      

  6.   

    http://www.360doc.com/relevant/07/0512/12/17598_495789.shtml
      

  7.   

    http://www.360doc.com/content/07/0512/12/17598_495820.shtml
      

  8.   

    已经 解决 呵呵
    int XMLRead(string strFileName)
    {
    string filename = strFileName; 
    iXmlUeserChannel = 0;
    iXmlIndex = 0;
    TiXmlDocument* doc = new TiXmlDocument(filename.c_str());
        if(!doc->LoadFile())
    {
    return 1;
    }
    const TiXmlElement* root = doc->RootElement();
    //循环获取该根节点下面的节点
    for(const TiXmlNode* childNum = root->FirstChild();childNum;childNum=childNum->NextSibling())
    {
    iXmlUeserChannel++;
    }
         
    //设置
    pXmlUserChannel = new UserChannel[iXmlUeserChannel];
        int i=0;
    for(const TiXmlNode* child = root->FirstChild();child;child=child->NextSibling())
    {

    //判断为元素类型并且是tab元素,Value()获取该标签的名称
    if((child->Type() == TiXmlNode::ELEMENT) && (!strcmp(child->Value(),"tab")))
    {
    const TiXmlElement *box = (const TiXmlElement*)child;      pXmlUserChannel[i].name = box->Attribute("name");
     pXmlUserChannel[i].type = box->Attribute("type");
     pXmlUserChannel[i].show = box->Attribute("show");
     pXmlUserChannel[i].refreshmode = box->Attribute("refreshmode");
     pXmlUserChannel[i].owner = box->Attribute("owner");
     pXmlUserChannel[i].state = box->Attribute("state");
     pXmlUserChannel[i].cx = box->Attribute("cx");
     pXmlUserChannel[i].cy = box->Attribute("cy");



    //继续循环获取子节点相关数据
    for(const TiXmlNode *sub_tag = box->FirstChild();sub_tag; sub_tag = sub_tag->NextSibling() )
    {
    if(sub_tag->Type() == TiXmlNode::ELEMENT)
    {
    const TiXmlElement *sub_element = (const TiXmlElement*)sub_tag;
        if(!strcmp(sub_tag->Value(),"icon1"))
    {
    pXmlUserChannel[i].icon1 = sub_tag->FirstChild()->Value();
    }//if(!strcmp(sub_tag->Value(),"position"))
    else if(!strcmp(sub_tag->Value(),"icon2"))
    {
    pXmlUserChannel[i].icon2 = sub_tag->FirstChild()->Value();
    }
    else if(!strcmp(sub_tag->Value(),"hint"))
    {
    pXmlUserChannel[i].hint = sub_tag->FirstChild()->Value();
    }
    else if(!strcmp(sub_tag->Value(),"url"))
    {
    pXmlUserChannel[i].url = sub_tag->FirstChild()->Value();
    }// if(sub_tag->Type() == TiXmlNode::ELEMENT)


    }//if(sub_tag->Type() == TiXmlNode::ELEMENT)
    }//for(const TiXmlNode *sub_tag = box->FirstChild(); sub_tag; sub_tag = sub_tag->NextSibling() )
     i++;
    }
    }
    delete doc;
        return 0;
    }