• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ xml_node类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: name_ex

void gdipp_setting::load_gdimm_process(const xpath_node_set &process_nodes)
{
	// backward iterate so that first-coming process settings overwrites last-coming ones

	xpath_node_set::const_iterator node_iter = process_nodes.end();
	node_iter--;

	for (size_t i = 0; i < process_nodes.size(); i++, node_iter--)
	{
		// only store the setting items which match the current process name

		const xml_node curr_proc = node_iter->node();
		const xml_attribute name_attr = curr_proc.attribute(L"name");

		bool process_matched = name_attr.empty();
		if (!process_matched)
		{
			const wregex name_ex(name_attr.value(), regex_flags);
			process_matched = regex_match(_process_name, name_ex);
		}

		if (process_matched)
		{
			for (xml_node::iterator set_iter = node_iter->node().begin(); set_iter != node_iter->node().end(); set_iter++)
				parse_gdimm_setting_node(*set_iter, _process_setting);
		}
	}
}
开发者ID:Carye,项目名称:gdipp,代码行数:28,代码来源:setting.cpp


示例2: insert_setting

BOOL gdipp_setting::insert_setting(const wchar_t *node_name, const wchar_t *node_text, const wchar_t *parent_xpath, const wchar_t *ref_node_xpath, wstring &new_node_xpath)
{
	// insert the new node as a child node before the reference node, and output its XPath

	bool b_ret;

	xml_node parent_node = _xml_doc->select_single_node(parent_xpath).node();
	if (parent_node.empty())
		return FALSE;

	const xml_node ref_node = _xml_doc->select_single_node(ref_node_xpath).node();
	if (ref_node.empty())
		return FALSE;

	xml_node new_node = parent_node.insert_child_before(node_element, ref_node);
	if (new_node.empty())
		return FALSE;

	xml_node text_node = new_node.append_child(node_pcdata);
	if (text_node.empty())
		return FALSE;

	b_ret = new_node.set_name(node_name);
	if (!b_ret)
		return FALSE;

	text_node.set_value(node_text);
	if (!b_ret)
		return FALSE;

	new_node_xpath = new_node.path();
	return TRUE;
}
开发者ID:Carye,项目名称:gdipp,代码行数:33,代码来源:setting.cpp


示例3: returnHashString

string XMLProcessor::returnHashString(xml_node node)
{
	if (node.parent().name() == "")
		return DBStringProcessor::getOriginalTrueTableName(node.name());
	else
		return returnHashString(node.parent()) + "->" + DBStringProcessor::getOriginalTrueTableName(node.name());
}
开发者ID:gaozheyuan,项目名称:xmltodb,代码行数:7,代码来源:XMLProcessor.cpp


示例4: text_properties_from_xml

void text_symbolizer_properties::text_properties_from_xml(xml_node const& node)
{
    // The options 'margin' and 'repeat-distance' replace 'minimum-distance'.
    // Only allow one or the other to be defined here.
    if (node.has_attribute("margin") || node.has_attribute("repeat-distance"))
    {
        if (node.has_attribute("minimum-distance"))
        {
            throw config_error(std::string("Cannot use deprecated option minimum-distance with "
                                           "new options margin and repeat-distance."));
        }
        set_property_from_xml<value_double>(expressions.margin, "margin", node);
        set_property_from_xml<value_double>(expressions.repeat_distance, "repeat-distance", node);
    }
    else
    {
        set_property_from_xml<value_double>(expressions.minimum_distance, "minimum-distance", node);
    }
    set_property_from_xml<label_placement_e>(expressions.label_placement, "placement", node);
    set_property_from_xml<value_double>(expressions.label_spacing, "spacing", node);
    set_property_from_xml<value_double>(expressions.label_position_tolerance, "label-position-tolerance", node);
    set_property_from_xml<value_double>(expressions.minimum_padding, "minimum-padding", node);
    set_property_from_xml<value_double>(expressions.minimum_path_length, "minimum-path-length", node);
    set_property_from_xml<boolean_type>(expressions.avoid_edges, "avoid-edges", node);
    set_property_from_xml<boolean_type>(expressions.allow_overlap, "allow-overlap", node);
    set_property_from_xml<boolean_type>(expressions.largest_bbox_only, "largest-bbox-only", node);
    set_property_from_xml<value_double>(expressions.max_char_angle_delta, "max-char-angle-delta", node);
    set_property_from_xml<text_upright_e>(expressions.upright, "upright", node);
}
开发者ID:jakhaf,项目名称:mapnik,代码行数:29,代码来源:text_properties.cpp


示例5: populate_tree

    void populate_tree(xmlNode *cur_node, xml_node &node)
    {
        for (; cur_node; cur_node = cur_node->next )
        {
            switch (cur_node->type)
            {
            case XML_ELEMENT_NODE:
            {

                xml_node &new_node = node.add_child((const char *)cur_node->name, cur_node->line, false);
                append_attributes(cur_node->properties, new_node);
                populate_tree(cur_node->children, new_node);
            }
            break;
            case XML_TEXT_NODE:
            {
                std::string trimmed((const char*)cur_node->content);
                mapnik::util::trim(trimmed);
                if (trimmed.empty()) break; //Don't add empty text nodes
                node.add_child(trimmed, cur_node->line, true);
            }
            break;
            case XML_COMMENT_NODE:
                break;
            default:
                break;

            }
        }
    }
开发者ID:mayfourth,项目名称:mapnik,代码行数:30,代码来源:libxml2_loader.cpp


示例6: populate_tree

    void populate_tree(rapidxml::xml_node<char> *cur_node, xml_node &node)
    {
        switch (cur_node->type())
        {
        case rapidxml::node_element:
        {
            xml_node &new_node = node.add_child((char *)cur_node->name(), 0, false);
            // Copy attributes
            for (rapidxml::xml_attribute<char> *attr = cur_node->first_attribute();
                 attr; attr = attr->next_attribute())
            {
                new_node.add_attribute(attr->name(), attr->value());
            }

            // Copy children
            for (rapidxml::xml_node<char> *child = cur_node->first_node();
                 child; child = child->next_sibling())
            {
                populate_tree(child, new_node);
            }
        }
        break;

        // Data nodes
        case rapidxml::node_data:
        case rapidxml::node_cdata:
        {
            node.add_child(cur_node->value(), 0, true);
        }
        break;
        default:
            break;
        }
    }
开发者ID:FlavioFalcao,项目名称:mapnik,代码行数:34,代码来源:rapidxml_loader.cpp


示例7: switch

void Editor_Html2Usfm::processNode (xml_node node)
{
  switch (node.type ()) {
    case node_element:
    {
      openElementNode (node);
      for (xml_node child : node.children()) {
        processNode (child);
      }
      closeElementNode (node);
      break;
    }
    case node_pcdata:
    {
      // Add the text to the current USFM line.
      string text = node.text ().get ();
      currentLine += text;
      break;
    }
    default:
    {
      string nodename = node.name ();
      Database_Logs::log ("Unknown XML node " + nodename + " while saving editor text");
      break;
    }
  }
}
开发者ID:alerque,项目名称:bibledit,代码行数:27,代码来源:html2usfm.cpp


示例8: _configure

            /**
            * @brief Configures the block: defines the input file.
            * @param n The configuration parameters
            */
            virtual void _configure(const xml_node& n)
            {
                xml_node source = n.child("source");
                xml_node gates_node = n.child("gates");
                if( (!source)  || (!gates_node) )
                    throw std::runtime_error("TweetReader: missing parameter");
                std::string gates_s = gates_node.attribute("number").value();
                std::string type = source.attribute("type").value();
                std::string ip = source.attribute("ip").value();
                file_name = source.attribute("name").value();
                if(!type.length() || !file_name.length() || !gates_s.length())
                    throw std::runtime_error("TweetReader: missing attribute");
                if(type.compare("offline") != 0)
                    throw std::runtime_error("TweetReader: invalid type parameter");

                num_gates = atoi(gates_s.c_str());

                file.open(file_name);
                if(!file.is_open()) {
                    throw std::runtime_error("TweetReader: cannot open source file");
                }

                // Create and register the output gates
                m_outgate_ids = new int[num_gates];
                for(int i=0; i<num_gates; i++){
                    std::string ogate = outgate_basename + boost::lexical_cast<std::string>(i);
                    m_outgate_ids[i] = register_output_gate(ogate.c_str());
                }
            }
开发者ID:cnplab,项目名称:blockmon,代码行数:33,代码来源:TweetReader.cpp


示例9: from_xml

node_ptr registry::from_xml(xml_node const& xml, fontset_map const& fontsets)
{
    std::map<std::string, from_xml_function_ptr>::const_iterator itr = map_.find(xml.name());
    if (itr == map_.end())  throw config_error("Unknown element '" + xml.name() + "'", xml);
    xml.set_processed(true);
    return itr->second(xml, fontsets);
}
开发者ID:HogwartsRico,项目名称:mapnik,代码行数:7,代码来源:registry.cpp


示例10: handler

	ProcessResult MsgTypeIqProcessHandler::handler(SessionPtr sessionPtr, const xml_node& node){
		ProcessResult result;
		ostringstream os;
		sessionPtr->delAllSupportType();
		for(xml_node msgType = node.first_child(); msgType; msgType = msgType.next_sibling()){
			if(strcmp(msgType.name(), "msgType") != 0){
				continue;
			}
			string msgTypeStr = msgType.child_value();
			boost::trim(msgTypeStr);
			if(msgTypeStr == "chat"){
				sessionPtr->addSupportType(MessageType::CHAT);
			} else if (msgTypeStr == "feed"){
				sessionPtr->addSupportType(MessageType::FEED);
			} else if (msgTypeStr == "notify"){
				sessionPtr->addSupportType(MessageType::NOTIFY);
			}
		}

		string id = node.attribute("id").value();
		string from = node.attribute("from").value();

		result.setCode(ProcessResult::HAS_RESPONSE);
		os << "<iq id='" << id << "' to='" << from << "' type='result'>"
			<< "<success/></iq>";
		result.setMsg(os.str());
		return result;
	}
开发者ID:xiaoyu-real,项目名称:Test,代码行数:28,代码来源:MsgTypeIqProcessHandler.cpp


示例11: WidgetInfo

WidgetInfo::WidgetInfo(xml_node& nodes, WidgetInfo* parent):
	_w(nodes),_btree(nodes.attribute("behaviour").as_string()),_parent(parent)
{
	auto i = nodes.children();
	for (auto node : nodes)
	{
		_nextNode.push_back(new WidgetInfo(node, this));
	}
}
开发者ID:blacklensama,项目名称:daiteikoku,代码行数:9,代码来源:Widget.cpp


示例12: intFromChild

int Scene::intFromChild(const xml_node &node, const string &child)
{
	xml_node childNode = node.child(child.c_str());
	if(!childNode){
		stringstream ss;
		ss << "node <"<< node.name() << "> has no child named '" << child << "'";
		throw invalid_argument(ss.str().c_str());
	}
	return childNode.text().as_int();
}
开发者ID:mvignale1987,项目名称:computer-graphics,代码行数:10,代码来源:Scene.cpp


示例13: get_channelnames

static void
get_channelnames (const xml_node &n, std::vector<std::string> &channelnames)
{
    xml_node channel_node = n.child ("channelnames");

    for (xml_node n = channel_node.child ("channelname"); n;
            n = n.next_sibling ("channelname")) {
        channelnames.push_back (n.child_value ());
    }
}
开发者ID:nerd93,项目名称:oiio,代码行数:10,代码来源:formatspec.cpp


示例14: stringAttributeFromNode

string Scene::stringAttributeFromNode(const xml_node &node, const string& attributeName)
{
	xml_attribute attr = node.attribute(attributeName.c_str());
	if(!attr){
		stringstream ss;
		ss << "node <"<< node.name() << "> has no '" << attributeName << "' attribute";
		throw invalid_argument(ss.str().c_str());
	}
	return attr.as_string();
}
开发者ID:mvignale1987,项目名称:computer-graphics,代码行数:10,代码来源:Scene.cpp


示例15: parseAlias

void Camera::parseAlias( xml_node &cur )
{
  if (isTag(cur.name(), "Alias")) {
    aliases.push_back(string(cur.first_child().value()));
    pugi::xml_attribute key = cur.attribute("id");
    if (key)
      canonical_aliases.push_back(string(key.as_string()));
    else
      canonical_aliases.push_back(string(cur.first_child().value()));
  }
}
开发者ID:acarrasco,项目名称:darktable,代码行数:11,代码来源:Camera.cpp


示例16: set_attribute

/**
 * Set an attribute on an XML node.
 * In theory, XML nodes have an ordered collection of named attributes, duplicates
 * allowed. In practice, we're using it as an unordered string=>string dictionary.
 */
template<class T> static void set_attribute(xml_node &node, const char *key, T newValue)
{
	if(node.attribute(key).empty())
	{
		node.append_attribute(key).set_value(newValue);
	}
	else
	{
		node.attribute(key).set_value(newValue);
	}
}
开发者ID:unclok,项目名称:Perception,代码行数:16,代码来源:ProxyHelper.cpp


示例17: loadNode

void AlphaInputBox::loadNode(xml_node node) {

	TextBox::loadNode(node);

	if (node.attribute("default") != NULL) {

		string def = node.attribute("default").as_string();
		wstringstream wss;
		wss << def.c_str();
		userInput = wss.str();

	}
}
开发者ID:TheDizzler,项目名称:RPGEngine,代码行数:13,代码来源:AlphaInputBox.cpp


示例18: processInputVariable

bool XMLFPParser::processInputVariable(const xml_node& var_root,
		MamdaniFuzzyObject* object) {

	InputLinguisticVariable *variable = new InputLinguisticVariable(var_root.child(LINGUISTIC_VARIABLE_ID_TAG).first_child().value(),
																	parsing::extractFloat(var_root.child(LINGUISTIC_VARIABLE_LOW_BOUND_TAG).child(LINGUISTIC_VARIABLE_VALUE_TAG).first_child().value()),
																	parsing::extractFloat(var_root.child(LINGUISTIC_VARIABLE_UP_BOUND_TAG).child(LINGUISTIC_VARIABLE_VALUE_TAG).first_child().value()));
	if(!loopFuzzySets(var_root.child(LINGUISTIC_VARIABLE_SETS_TAG),variable)){
		LERROR << "Error in parsing the fuzzy set for the variable : " << std::string(var_root.child(LINGUISTIC_VARIABLE_ID_TAG).first_child().value());
		return false;
	}

	return object->addInputVar(variable);
}
开发者ID:pablosproject,项目名称:FuzzyBrain-Release,代码行数:13,代码来源:XMLFPParser.cpp


示例19: operator

 result_type operator()(xml_node node) const
 {
   if(node.node_type() == Derived::node_type)
     return true;
   else if(node.node_type() == node_type::unknown_node
           && static_cast<Derived const&>(*this).predicate(node))
   {
     node.node_type(Derived::node_type);
     return true;
   }
   else
     return false;
 }
开发者ID:alyssonbrito,项目名称:gntl,代码行数:13,代码来源:xml_generic_predicate.hpp


示例20: _configure

		 /**
		   * configures the filter
		   * @param n the xml subtree
		   */
		 virtual void _configure(const xml_node&  n )
		 {
		     xml_node config = n.child("config");
		     xml_node log = n.child("logdir");
		     if(!config or !log)
	                 throw std::runtime_error("TstatAnalyzer: missing parameter");
             std::string cname=config.attribute("name").value();
		     tstat_init((char*)cname.c_str());
             std::string lname=config.attribute("name").value();
		     struct timeval cur_time;
		     gettimeofday(&cur_time,NULL);
		     tstat_new_logdir((char*)lname.c_str(), &cur_time);
		 }
开发者ID:carriercomm,项目名称:blockmon,代码行数:17,代码来源:TstatAnalyzer.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ xr_string类代码示例发布时间:2022-05-31
下一篇:
C++ xml_document类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap