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


C++ xml_node::text方法代码示例

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


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

示例1: mergeNodes

void mergeNodes(pugi::xml_node toNode, pugi::xml_node& fromNode)
{
  // Base case = both nodes are text nodes
  pugi::xml_text fromNodeText = fromNode.text();
  pugi::xml_text toNodeText = toNode.text();
  if (fromNodeText && toNodeText) {
    SBLog::info() << "Overwriting template value of \"" << toNode.name() << "\" from \"" << toNodeText.get() << "\" to \"" << fromNodeText.get() << "\"." << std::endl;
    toNodeText.set(fromNodeText.get());
    return;
  }

  // Calculate number of children in toNode
  unsigned maxDistance = std::distance(toNode.begin(), toNode.end());

  // Merge children
  for (pugi::xml_node fromNodeChild = fromNode.first_child(); fromNodeChild; fromNodeChild = fromNodeChild.next_sibling()) {
    // Find appropriate merge point
    pugi::xml_node toNodeChild = findSimilarNode(fromNodeChild, toNode, maxDistance);
    if (toNodeChild) {
      mergeNodes(toNodeChild, fromNodeChild);
    } else {
      toNode.append_copy(fromNodeChild);
    }
  }

  // Erase fromNode
  removeNode(fromNode);
}
开发者ID:netroby,项目名称:WinObjC,代码行数:28,代码来源:vshelpers.cpp

示例2: AddTextElementRaw

void AddTextElementRaw(pugi::xml_node node, const char* value)
{
	wxASSERT(node);
	wxASSERT(value);

	if (*value)
		node.text().set(value);
	else {
		node.text().set("");
	}
}
开发者ID:aswinpj,项目名称:FileZilla,代码行数:11,代码来源:xmlfunctions.cpp

示例3: CopyXmlNode

void XmlTools::CopyXmlNode(const pugi::xml_node& srcNode, pugi::xml_node& dstNode)
{
    for (const pugi::xml_attribute& attr : srcNode.attributes())
    {
        auto attrCopy = dstNode.append_attribute(attr.name());
        attrCopy.set_value(attr.value());
    }
    for (const pugi::xml_node& node : srcNode.children())
    {
        auto nodeCopy = dstNode.append_child(node.name());
        CopyXmlNode(node, nodeCopy);
    }
    auto nodeText = srcNode.text();
    dstNode.text().set(nodeText.as_string());
}
开发者ID:mathgame,项目名称:MathGame,代码行数:15,代码来源:XmlTools.cpp

示例4: FromXml

static
void FromXml(const pugi::xml_node& xmlNode, DataSetElement& parent)
{
    // ignore non-named XML nodes
    //
    // pugi::xml separates XML parts into more node types than we use
    //
    const string& label = xmlNode.name();
    if (label.empty())
        return;

    // label & text
    DataSetElement e(xmlNode.name(), FromInputXml());
    e.Text(xmlNode.text().get());

    // iterate attributes
    auto attrIter = xmlNode.attributes_begin();
    auto attrEnd  = xmlNode.attributes_end();
    for ( ; attrIter != attrEnd; ++attrIter )
        e.Attribute(attrIter->name(), attrIter->value());

    // iterate children, recursively building up subtree
    auto childIter = xmlNode.begin();
    auto childEnd = xmlNode.end();
    for ( ; childIter != childEnd; ++childIter ) {
        pugi::xml_node childNode = *childIter;
        FromXml(childNode, e);
    }

    // add our element to its parent
    parent.AddChild(e);
}
开发者ID:Debian,项目名称:pbbam,代码行数:32,代码来源:XmlReader.cpp

示例5: LoadItemAttribute

void CDuiListBox::LoadItemAttribute(pugi::xml_node xmlNode, LPLBITEM pItem)
{
	pItem->nImage=xmlNode.attribute("img").as_int(pItem->nImage);
	pItem->lParam=xmlNode.attribute("data").as_uint(pItem->lParam);

    pItem->strText =  DUI_CA2T(xmlNode.text().get(), CP_UTF8);
    DuiStringPool::getSingleton().BuildString(pItem->strText);
}
开发者ID:Johnny-Martin,项目名称:ComBase,代码行数:8,代码来源:duilistbox.cpp

示例6: InitFromXml

BOOL RichEditText::InitFromXml(pugi::xml_node xmlNode)
{
    m_strText = xmlNode.text().get();

    // 计算行数
    for (int nlf = m_strText.Find(0x0a); nlf >= 0; ++m_nLineCount)
    {
        nlf = m_strText.Find(0x0a, nlf+1);
    }

    return __super::InitFromXml(xmlNode);
}
开发者ID:435420057,项目名称:soui,代码行数:12,代码来源:RichEditObj.cpp

示例7: readData

bool GraphMLParser::readData(
	GraphAttributes &GA,
	const edge &e,
	const pugi::xml_node edgeData)
{
	pugi::xml_attribute keyId = edgeData.attribute("key");
	if (!keyId) {
		GraphIO::logger.lout() << "Edge data does not have a key." << endl;
		return false;
	}

	const long attrs = GA.attributes();
	pugi::xml_text text = edgeData.text();

	switch(graphml::toAttribute(m_attrName[keyId.value()])) {
	case graphml::a_edgeLabel:
		if(attrs & GraphAttributes::edgeLabel) {
			GA.label(e) = text.get();
		}
		break;
	case graphml::a_edgeWeight:
		if(attrs & GraphAttributes::edgeIntWeight) {
			GA.intWeight(e) = text.as_int();
		} else if(attrs & GraphAttributes::edgeDoubleWeight) {
			GA.doubleWeight(e) = text.as_double();
		}
		break;
	case graphml::a_edgeType:
		if(attrs & GraphAttributes::edgeType) {
			GA.type(e) = graphml::toEdgeType(text.get());
		}
		break;
	case graphml::a_edgeArrow:
		if(attrs & GraphAttributes::edgeArrow) {
			GA.arrowType(e) = graphml::toArrow(text.get());
		}
		break;
	case graphml::a_edgeStroke:
		if(attrs & GraphAttributes::edgeStyle) {
			GA.strokeColor(e) = text.get();
		}
		break;
	default:
		GraphIO::logger.lout(Logger::LL_MINOR) << "Unknown edge attribute with \""
		             << keyId.value()
		             << "\"." << endl;
	}

	return true;
}
开发者ID:marvin2k,项目名称:ogdf,代码行数:50,代码来源:GraphMLParser.cpp

示例8: AddTextElementUtf8

void AddTextElementUtf8(pugi::xml_node node, std::string const& value)
{
	assert(node);
	node.text().set(value.c_str());
}
开发者ID:zedfoxus,项目名称:filezilla-client,代码行数:5,代码来源:xmlfunctions.cpp

示例9: AddTextElement

void AddTextElement(pugi::xml_node node, int64_t value)
{
	assert(node);
	node.text().set(static_cast<long long>(value));
}
开发者ID:zedfoxus,项目名称:filezilla-client,代码行数:5,代码来源:xmlfunctions.cpp

示例10: for_each

    virtual bool for_each(pugi::xml_node& node) {

        Log::log(logModule, level, "XML node type = [%s], name = [%s], value = [%s]",
                node_types[node.type()], node.name(), 
                node.type() == pugi::node_cdata || node.type() == pugi::node_pcdata ? node.text().get() : node.value());
        for (pugi::xml_attribute_iterator ait = node.attributes_begin(); ait != node.attributes_end(); ++ait) {
            Log::log(logModule, level, "  attribute name = [%s], value = [%s]",
                    ait->name(), ait->value());
        }
        return true;
    }
开发者ID:JonathanFu,项目名称:OpenAM-1,代码行数:11,代码来源:xml_element.cpp


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