本文整理汇总了C++中CXmlNode::GetAttribute方法的典型用法代码示例。如果您正苦于以下问题:C++ CXmlNode::GetAttribute方法的具体用法?C++ CXmlNode::GetAttribute怎么用?C++ CXmlNode::GetAttribute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CXmlNode
的用法示例。
在下文中一共展示了CXmlNode::GetAttribute方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LoadMiscConfig
// 加载杂项配置
BOOL LoadMiscConfig(LPCTSTR lpszFileName)
{
CXmlDocument xmlDoc;
CXmlNode xmlNode;
BOOL bRet = xmlDoc.Load(lpszFileName);
if (!bRet)
return FALSE;
bRet = xmlDoc.SelectSingleNode(_T("/Misc/FontInfo"), xmlNode);
if (bRet)
{
g_fontInfo.m_strName = xmlNode.GetAttribute(_T("Name"));
g_fontInfo.m_nSize = xmlNode.GetAttributeInt(_T("Size"));
tstring strColor = xmlNode.GetAttribute(_T("Color"));
g_fontInfo.m_clrText = HexStrToRGB(strColor.c_str());
g_fontInfo.m_bBold = xmlNode.GetAttributeInt(_T("Bold"));
g_fontInfo.m_bItalic = xmlNode.GetAttributeInt(_T("Italic"));
g_fontInfo.m_bUnderLine = xmlNode.GetAttributeInt(_T("UnderLine"));
}
bRet = xmlDoc.SelectSingleNode(_T("/Misc/HotKey"), xmlNode);
if (bRet)
{
tstring strHotKey = xmlNode.GetText();
g_cHotKey = toupper(strHotKey.at(0));
}
xmlNode.Release();
xmlDoc.Release();
return TRUE;
}
示例2: Init
void CQuotes::Init(const CString& strXml)
{
try
{
CXmlDocument doc;
doc.LoadXml(strXml);
CXmlNodeList secList = doc.Select(_T("/buddy/s"));
for (int i = 0; i < secList.GetLength(); i++)
{
CXmlNode ndSec = secList.GetItem(i);
m_strId = ndSec.GetAttribute(_T("code"));
m_eMarket = (MarketType)ndSec.GetAttributeLong(_T("market"));
QuoteType eType = (QuoteType)ndSec.GetAttributeLong(_T("type"));
CXmlNodeList quoteList = ndSec.Select(_T("q"));
for (int j = 0; j < quoteList.GetLength(); j++)
{
Quote quote;
CXmlNode ndQuote = quoteList.GetItem(i);
CString strDate = ndQuote.GetAttribute(_T("t"));
quote.dtTime.ParseDateTime((LPCTSTR)strDate.GetBuffer());
quote.eQuote = eType;
quote.dOpen = ndQuote.GetAttributeDouble(_T("o"));
quote.dHigh = ndQuote.GetAttributeDouble(_T("h"));
quote.dLow = ndQuote.GetAttributeDouble(_T("l"));
quote.dClose = ndQuote.GetAttributeDouble(_T("c"));
quote.dVolumn = ndQuote.GetAttributeDouble(_T("v"));
quote.dAmount = ndQuote.GetAttributeDouble(_T("a"));
m_vecQuote.push_back(quote);
}
}
}
catch( ... )
{
OutputDebugString(_T("parse quote failed."));
}
return;
}
示例3: GetNodeAttribute
CString CXmlNode::GetNodeAttribute(LPCTSTR xpath,LPCTSTR attrname)
{
CXmlNode node = this->Find(xpath);
if(node.IsNull())
{
return _T("");
}
else
{
return node.GetAttribute(attrname);
}
}
示例4: GetNodeValueEx
CString CXmlDocument::GetNodeValueEx(const CString& strPath, const CString& attributeName,bool bGetXML)
{
if (m_pNode == NULL)
return _T("");
CXmlNode node = this->Find(strPath);
if (!node.IsValid())
return _T("");
if (!attributeName.IsEmpty())
{
return node.GetAttribute(attributeName);
}
else
{
if( bGetXML )
{
return CString(node.GetXml());
}
else
return node.GetValue();
}
}