当前位置: 首页>>代码示例>>C++>>正文


C++ IXMLDOMElementPtr::getAttribute方法代码示例

本文整理汇总了C++中msxml::IXMLDOMElementPtr::getAttribute方法的典型用法代码示例。如果您正苦于以下问题:C++ IXMLDOMElementPtr::getAttribute方法的具体用法?C++ IXMLDOMElementPtr::getAttribute怎么用?C++ IXMLDOMElementPtr::getAttribute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在msxml::IXMLDOMElementPtr的用法示例。


在下文中一共展示了IXMLDOMElementPtr::getAttribute方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: OnShowWindow

void NewVersionDlg::OnShowWindow(BOOL bShow, UINT nStatus)
{
	CDialog::OnShowWindow(bShow, nStatus);

	int iTotalTextLength = ctlDetails.GetWindowTextLength();
	ctlDetails.SetSel(iTotalTextLength, iTotalTextLength);
	BeginWaitCursor();
	CString sResult;
	CWebAccess webAccess;
	webAccess.Get("www.milow.net/site/projects/parnrar/pnrVersions.xml", sResult);

	if (sResult != "")
		{
		MSXML::IXMLDOMDocumentPtr domVersions;	

		if (CoCreateInstance( MSXML::CLSID_DOMDocument, 0, CLSCTX_INPROC_SERVER, MSXML::IID_IXMLDOMDocument, (void**)&domVersions ) != S_OK)
		{
			ctlDetails.ReplaceSel("Error: Failed to create DOMDocument object");
			goto CLEANUP;
		}
		domVersions->loadXML(sResult.GetBuffer(0));
		CString sXml = static_cast<char *>(domVersions->xml);
		if (sXml == "")
		{
			ctlDetails.ReplaceSel("Error: Failed to download version information");
			goto CLEANUP;
		}
		MSXML::IXMLDOMElementPtr eVer = domVersions->selectSingleNode("/Versions/Version");
		CString sVer = static_cast<char *>(_bstr_t(eVer->getAttribute("number")));
		if (sVer == theApp.GetMyVersion())
		{
			ctlDetails.ReplaceSel("You are currently running the latest version of Par-N-Rar");
			goto CLEANUP;
		}

		//Get all info about later versions
		CString sText = "You are currently running v" + theApp.GetMyVersion();
		sText += "\n";
		sText += "The latest version is v" + sVer;
		sText += "\n\n";

		MSXML::IXMLDOMNodeListPtr nlVersions = domVersions->selectNodes( "/Versions/Version");	
		for (long l=0; l<nlVersions->length; l++)
		{
			eVer = nlVersions->Getitem(l);
			sVer = static_cast<char *>(_bstr_t(eVer->getAttribute("number")));
			if (sVer == theApp.GetMyVersion())
				break;
			sText += "****************************************************\nVersion " + sVer;
			sText += ": \n";
			sText += static_cast<char *>(eVer->text);
			sText += "\n\n";
		}
		ctlDetails.ReplaceSel(sText);
	}

CLEANUP:
	Resize();
	EndWaitCursor();
}
开发者ID:GDXN,项目名称:Par-N-Rar,代码行数:60,代码来源:NewVersionDlg.cpp

示例2: ElementToStruct

bool CHelpDB::ElementToStruct(CHelpMessage& info, MSXML::IXMLDOMElementPtr& El, bool bIncUsage)
{
    bool r = false;

    try
    {
        _variant_t vAlias = El->getAttribute(TAG_ALIAS);
        _variant_t vCreator = El->getAttribute(TAG_CREATOR);
        _variant_t vText = El->getAttribute(TAG_TEXT);
        _variant_t vCreated = El->getAttribute(TAG_TIME);
        _variant_t vUsage = El->getAttribute(TAG_USAGE);

        HW2T(info.Alias, vAlias.bstrVal);
        HW2T(info.Creator, vCreator.bstrVal);
        HW2T(info.Text, vText.bstrVal);

        TSTRING sTemp;

        HW2T(sTemp, vCreated.bstrVal);
        Str2Bin(sTemp, (PBYTE)&info.Created, sizeof(info.Created));

        HW2T(sTemp, vUsage.bstrVal);
        info.nUsage = _tcstoul(sTemp.c_str(), 0, 10);

        if(bIncUsage)
        {
            TCHAR tsz[500];
            info.nUsage++;
            _ultot(info.nUsage, tsz, 10);
            El->setAttribute(_bstr_t(TAG_USAGE), _variant_t(tsz));
        }

        r = true;
    }
    catch(_com_error& e)
    {
        sprintf(m_err, _T("COM Error: %08x"), e.Error(), (TCHAR*)e.Description());
        g_pLog->msg(_T("CHelpDB::ElementToStruct ERROR"));
    }

    return r;
}
开发者ID:thenfour,项目名称:_tWinMain,代码行数:42,代码来源:oldhelp.cpp

示例3: XMLGetAttribute

Result XMLGetAttribute(_variant_t& out, MSXML::IXMLDOMElementPtr pEl, const string& sAttribute)
{
	Result r;
	try
	{
    out = pEl->getAttribute(sAttribute.c_str());
		if(out.vt == VT_NULL)
		{
			r.Fail(Format("Attribute '%' not found, or VT_NULL").s(sAttribute).Str());
		}
		else
		{
			r.Succeed();
		}
	}
	catch(_com_error& e)
	{
		r.Fail(Format("Error reading the %s attribute from xml. % %").s(sAttribute).s(e.ErrorMessage()).s(e.Description()).Str());
	}
	return r;
}
开发者ID:thenfour,项目名称:VerEdit,代码行数:21,代码来源:xmlutil.cpp

示例4: Load

void CMeta::Load(MSXML::IXMLDOMElementPtr pGO)
{
    MSXML::IXMLDOMElementPtr pStatic;
    MSXML::IXMLDOMElementPtr pDynamic;
	MSXML::IXMLDOMElementPtr pAttr;
    _variant_t val;

    pStatic=pGO->selectSingleNode(L"./static");
    //position
    pAttr=pStatic->selectSingleNode(L"./position");
    //x1
    val=pAttr->getAttribute(L"x1");
    val.ChangeType(VT_I4);
    m_lx1=val.lVal;
	m_lox1=m_lx1;
    //y1
    val=pAttr->getAttribute(L"y1");
    val.ChangeType(VT_I4);
    m_ly1=val.lVal;
	m_loy1=m_ly1;
    //x2
    val=pAttr->getAttribute(L"x2");
    val.ChangeType(VT_I4);
    m_lx2=val.lVal;
	m_lox2=m_lx2;
    //y2
    val=pAttr->getAttribute(L"y2");
    val.ChangeType(VT_I4);
    m_ly2=val.lVal;
	m_loy2=m_ly2;
    //file
    pAttr=pStatic->selectSingleNode(L"./file");
    //path
    val=pAttr->getAttribute(L"path");
    m_sPicFile=val.bstrVal;

    //load dynamic attribution if have
    pDynamic=pGO->selectSingleNode(L"./dynamic");
    val=pDynamic->getAttribute(L"linked");
    val.ChangeType(VT_BOOL);
    if(val.boolVal){
        m_DnyAttr.Load(pDynamic);
        m_DnyAttr.m_Linked=true;
    }else{
        m_DnyAttr.m_Linked=false;
    }
}
开发者ID:george-kuo,项目名称:GoSysWare,代码行数:47,代码来源:Meta.cpp

示例5: Load

void CArc::Load(MSXML::IXMLDOMElementPtr pGO)
{
    MSXML::IXMLDOMElementPtr pStatic;
    MSXML::IXMLDOMElementPtr pDynamic;
	MSXML::IXMLDOMElementPtr pAttr;
    _variant_t val;

    pStatic=pGO->selectSingleNode(L"./static");
    //position
    pAttr=pStatic->selectSingleNode(L"./position");
    //x1
    val=pAttr->getAttribute(L"x1");
    val.ChangeType(VT_I4);
    m_lx1=val.lVal;
    //y1
    val=pAttr->getAttribute(L"y1");
    val.ChangeType(VT_I4);
    m_ly1=val.lVal;
    //x2
    val=pAttr->getAttribute(L"x2");
    val.ChangeType(VT_I4);
    m_lx2=val.lVal;
    //y2
    val=pAttr->getAttribute(L"y2");
    val.ChangeType(VT_I4);
    m_ly2=val.lVal;
    //x3
    val=pAttr->getAttribute(L"x3");
    val.ChangeType(VT_I4);
    m_lx3=val.lVal;
    //y3
    val=pAttr->getAttribute(L"y3");
    val.ChangeType(VT_I4);
    m_ly3=val.lVal;
    //x4
    val=pAttr->getAttribute(L"x4");
    val.ChangeType(VT_I4);
    m_lx4=val.lVal;
    //y4
    val=pAttr->getAttribute(L"y4");
    val.ChangeType(VT_I4);
    m_ly4=val.lVal;

    //pen
    pAttr=pStatic->selectSingleNode(L"./pen");
    //style
    val=pAttr->getAttribute(L"s");
    val.ChangeType(VT_UI4);
    m_pen.lopnStyle=val.ulVal;
    //width
    val=pAttr->getAttribute(L"w");
    val.ChangeType(VT_I4);
    m_pen.lopnWidth.x=val.lVal;
    //color
    val=pAttr->getAttribute(L"c");
    val.ChangeType(VT_UI4);
    m_pen.lopnColor=val.ulVal;

    //load dynamic attribution if have
    pDynamic=pGO->selectSingleNode(L"./dynamic");
    val=pDynamic->getAttribute(L"linked");
    val.ChangeType(VT_BOOL);
    if(val.boolVal){
        m_DnyAttr.Load(pDynamic);
        m_DnyAttr.m_Linked=true;
    }else{
        m_DnyAttr.m_Linked=false;
    }
}
开发者ID:george-kuo,项目名称:GoSysWare,代码行数:69,代码来源:Arc.cpp

示例6: Load

void CText::Load(MSXML::IXMLDOMElementPtr pGO)
{
    MSXML::IXMLDOMElementPtr pStatic;
    MSXML::IXMLDOMElementPtr pDynamic;
    MSXML::IXMLDOMElementPtr pAttr;
    _variant_t val;

    pStatic=pGO->selectSingleNode(L"./static");
    //position
    pAttr=pStatic->selectSingleNode(L"./position");
    //x1
    val=pAttr->getAttribute(L"x1");
    val.ChangeType(VT_I4);
    m_lx1=val.lVal;
    m_lox1=m_lx1;
    //y1
    val=pAttr->getAttribute(L"y1");
    val.ChangeType(VT_I4);
    m_ly1=val.lVal;
    m_loy1=m_ly1;
    //x2
    val=pAttr->getAttribute(L"x2");
    val.ChangeType(VT_I4);
    m_lx2=val.lVal;
    m_lox2=m_lx2;
    //y2
    val=pAttr->getAttribute(L"y2");
    val.ChangeType(VT_I4);
    m_ly2=val.lVal;
    m_loy2=m_ly2;

    //face color
    pAttr=pStatic->selectSingleNode(L"./color");
    //color
    val=pAttr->getAttribute(L"c");
    val.ChangeType(VT_UI4);
    m_FaceColor=val.ulVal;
    m_oFaceColor=m_FaceColor;

    //font
    pAttr=pStatic->selectSingleNode(L"./font");
    //lfHeight
    val=pAttr->getAttribute(L"h");
    val.ChangeType(VT_I4);
    m_font.lfHeight=val.ulVal;
    //lfWidth
    val=pAttr->getAttribute(L"wd");
    val.ChangeType(VT_I4);
    m_font.lfWidth=val.ulVal;
    //lfEscapement
    val=pAttr->getAttribute(L"e");
    val.ChangeType(VT_I4);
    m_font.lfEscapement=val.ulVal;
    //lfOrientation
    val=pAttr->getAttribute(L"o");
    val.ChangeType(VT_I4);
    m_font.lfOrientation=val.ulVal;
    //lfWeight
    val=pAttr->getAttribute(L"wg");
    val.ChangeType(VT_I4);
    m_font.lfWeight=val.ulVal;
    //lfItalic
    val=pAttr->getAttribute(L"i");
    val.ChangeType(VT_UI1);
    m_font.lfItalic=val.ulVal;
    //lfUnderline
    val=pAttr->getAttribute(L"u");
    val.ChangeType(VT_UI1);
    m_font.lfUnderline=val.ulVal;
    //lfStrikeOut
    val=pAttr->getAttribute(L"so");
    val.ChangeType(VT_UI1);
    m_font.lfStrikeOut=val.ulVal;
    //lfCharSet
    val=pAttr->getAttribute(L"cs");
    val.ChangeType(VT_UI1);
    m_font.lfCharSet=val.ulVal;
    //lfOutPrecision
    val=pAttr->getAttribute(L"op");
    val.ChangeType(VT_UI1);
    m_font.lfOutPrecision=val.ulVal;
    //lfClipPrecision
    val=pAttr->getAttribute(L"cp");
    val.ChangeType(VT_UI1);
    m_font.lfClipPrecision=val.ulVal;
    //lfQuality
    val=pAttr->getAttribute(L"q");
    val.ChangeType(VT_UI1);
    m_font.lfQuality=val.ulVal;
    //lfPitchAndFamily
    val=pAttr->getAttribute(L"paf");
    val.ChangeType(VT_UI1);
    m_font.lfPitchAndFamily=val.ulVal;
    //lfFaceName
    val=pAttr->getAttribute(L"fn");
    CString strFaceName=val.bstrVal;
    sprintf(m_font.lfFaceName,"%s",(LPCTSTR)strFaceName);

    //text
    pAttr=pStatic->selectSingleNode(L"./text");
//.........这里部分代码省略.........
开发者ID:george-kuo,项目名称:GoSysWare,代码行数:101,代码来源:Text.cpp

示例7: get_attribute

/*
 * elementからattribute_nameなるアトリビュート値を取り出す
 */
inline string get_attribute(MSXML::IXMLDOMElementPtr element, const char* attribute_name) {
	return (const char*)_bstr_t(element->getAttribute(attribute_name));
}
开发者ID:gamepattisiere,项目名称:laboratory,代码行数:6,代码来源:XMLDefine.cpp


注:本文中的msxml::IXMLDOMElementPtr::getAttribute方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。