本文整理汇总了C++中CXmlNode::SetData方法的典型用法代码示例。如果您正苦于以下问题:C++ CXmlNode::SetData方法的具体用法?C++ CXmlNode::SetData怎么用?C++ CXmlNode::SetData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CXmlNode
的用法示例。
在下文中一共展示了CXmlNode::SetData方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetAttribute
void CXmlNode::SetAttribute(const CString& attributeName, const _variant_t value)
{
CXmlNode node;
node=m_pNode->attributes->_getNamedItem(_bstr_t(attributeName));
if(node.IsValid())
{
node.SetData(value);
}
else
{
CXmlDocument myDoc = this->GetOwnerDocument();
if(myDoc.IsValid())
{
CXmlNode attr = myDoc.CreateNode(attributeName,nodeAttribute);
attr.SetValue(value);
XmlNode attrNode;
m_pNode->attributes->setNamedItem(attr.GetNode(),&attrNode);
}
}
}
示例2: PopulateXmlNode
void CSite::PopulateXmlNode(CXmlTree& Tree, CTreeElement< CXmlNode > * pXmlNode) const {
CXmlNode ConfigNode;
ConfigNode.SetType(xmlnOpen);
CString RConfigPath(m_ConfigPath);
RConfigPath.Replace('/', '\\');
RConfigPath.Replace("\\", "%5C");
RConfigPath.Replace(":", "%3A");
ConfigNode.SetData(RConfigPath);
CTreeElement< CXmlNode > * NewXmlNodePtr = Tree.AddChildLast(pXmlNode, ConfigNode);
static CString SiteXml(
"<path></path>" \
"<vsize></vsize>" \
"<alias></alias>" \
"<processed>" \
" <size></size>" \
" <modified></modified>" \
" <words></words>" \
" <urls></urls>" \
" <last>N/A</last>" \
"</processed>" \
"<threads>" \
" <max></max>" \
" <rampup></rampup>" \
" <maxqueue></maxqueue>" \
" <maxidle></maxidle>" \
" <jobs></jobs>" \
" <threads></threads>" \
" <waiting></waiting>" \
"</threads>" \
"<cnf>" \
"</cnf>" \
"<search>" \
"</search>");
CXmlTree XmlTree;
XmlTree.SetXml(SiteXml);
m_IndexMutex.StartReading();
XmlTree.SetValue("/path", RConfigPath);
XmlTree.SetValue("/vsize", CString::IntToStr(m_SiteConfigs.GetSize()));
XmlTree.SetValue("/alias", m_Alias);
XmlTree.SetValue("/processed/size", CString::IntToStr(m_ProcessedFiles.Get()));
if (m_LastProcessedUrl.GetLength()) {
XmlTree.SetValue("/processed/last", m_LastProcessedUrl);
}
XmlTree.SetValue("/threads/max", CString::IntToStr(m_IndexPool.GetMaxThreads()));
XmlTree.SetValue("/threads/rampup", CString::IntToStr(m_IndexPool.GetRampupThreads()));
XmlTree.SetValue("/threads/maxqueue", CString::IntToStr(m_IndexPool.GetMaxQueueSize()));
XmlTree.SetValue("/threads/maxidle", CString::IntToStr(m_IndexPool.GetMaxThreadIdle()) + " seconds");
XmlTree.SetValue("/threads/jobs", CString::IntToStr(m_IndexPool.GetJobsList().GetSize()));
XmlTree.SetValue("/threads/threads", CString::IntToStr(m_IndexPool.GetThreads().GetSize()));
XmlTree.SetValue("/threads/waiting", CString::IntToStr(m_IndexPool.GetWaitingThreads().Get()));
CTreeElement< CXmlNode > * XmlCnfNodePtr = XmlTree.XmlFind("/cnf");
for (int i=0;i<(int) m_SiteConfigs.GetSize();i++) {
CXmlNode ConfigNode;
ConfigNode.SetType(xmlnOpen);
ConfigNode.SetData("vcnf-" + CString::IntToStr(i));
m_SiteConfigs[i].PopulateXmlNode(XmlTree, XmlTree.AddChildLast(XmlCnfNodePtr, ConfigNode));
ConfigNode.SetType(xmlnClose);
XmlTree.AddChildLast(XmlCnfNodePtr, ConfigNode);
}
m_SiteIndex.PopulateXmlNode(XmlTree, XmlTree.XmlFind("/search"));
// move the full tree
Tree.MoveAsChildLast(XmlTree, XmlTree.GetHead(), NewXmlNodePtr);
m_IndexMutex.StopReading();
ConfigNode.SetType(xmlnClose);
XmlTree.AddChildLast(pXmlNode, ConfigNode);
}