<Graph>
<CPoly Points="5" Point0_X="217" Point0_Y="103" Point1_X="78" Point1_Y="317" Point2_X="311" Point2_Y="338" Point3_X="367" Point3_Y="142" Point4_X="255" Point4_Y="216">CPoly</CPoly>
<CDot Point_X="574" Point_Y="73">CDot</CDot>
<CLine TopLeft_X="788" TopLeft_Y="131" BottomRight_X="507" BottomRight_Y="336">CLine</CLine>
</Graph>写入了这样一段数据用于保存图形的信息,但是不知道怎么取出每个Point的值

解决方案 »

  1.   

    最简单的直接在数据中查找Point0_X等等进行字符串截取
      

  2.   

    公司都在用这个msxml  没办法啊   
      

  3.   

    已经自己解决spDoc->load(strFilePatch.AllocSysString());   // 载入XML文件
        spDoc->get_documentElement(&spRoot);   // 获取根节点    spRoot->get_childNodes(&spNodeList);   // 获取子节点列表
        long nNodeCount;
        spNodeList->get_length(&nNodeCount);   // 获取子节点列表长度
        for (long i=0; i!=nNodeCount; ++i)
        {
            spNodeList->get_item(i, &spNode);        CString strName = (TCHAR*)(_bstr_t)spNode->nodeName;
            
            spNode->get_attributes(&spAttribList);
            long nAttribCount;
            spAttribList->get_length(&nAttribCount);
            for (long j=0; j!=nAttribCount; ++j)
            {
                spAttribList->get_item(j, &spAttrib);
                CString strVal = (TCHAR*)(_bstr_t)spAttrib->nodeValue;
                AfxMessageBox(strVal);         ///   此处的strVal 就是point的值
            }
        }
      

  4.   

    嗯,刚写了一个 ::CoInitialize(NULL);
    MSXML2::IXMLDOMDocumentPtr pDoc;
    HRESULT hr;
    hr=pDoc.CreateInstance(__uuidof(MSXML2::DOMDocument40));
    if(FAILED(hr))

    MessageBox("无法创建DOMDocument对象,请检查是否安装了MS XML Parser 运行库!"); 
    return ;
    }  //加载文件 
    pDoc->load("e:\\a.xml");  MSXML2::IXMLDOMNodePtr pNode; //在树中查找名为Book的节点,"//"表示在任意一层查找 
    pNode=pDoc->selectSingleNode("//CPoly"); MSXML2::DOMNodeType nodeType;  //得到节点类型 
    pNode->get_nodeType(&nodeType);  //节点名称 
    CString strName;
    strName=(char *)pNode->GetnodeName(); //节点属性,放在链表中 
    MSXML2::IXMLDOMNamedNodeMapPtr pAttrMap=NULL;
    MSXML2::IXMLDOMNodePtr pAttrItem;
    _variant_t variantvalue;
    pNode->get_attributes(&pAttrMap); // 获取熟悉个数
    long count;
    pAttrMap->get_length(&count);
    for(int i=0;i<count;i++)
    {
    pAttrMap->get_item(i,&pAttrItem);
    //取得节点的值
    pAttrItem->get_nodeTypedValue(&variantvalue); CString str2 =(char *)(_bstr_t)variantvalue;
    strName=(char *)pAttrItem->GetnodeName();
    AfxMessageBox("属性名:"+strName);
    AfxMessageBox("属性值:"+str2);
    }
      

  5.   

    @yanjing_mail   感谢你的乐于助人  分就给你了