本文整理汇总了C++中dom::Node::getFirstChild方法的典型用法代码示例。如果您正苦于以下问题:C++ Node::getFirstChild方法的具体用法?C++ Node::getFirstChild怎么用?C++ Node::getFirstChild使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dom::Node
的用法示例。
在下文中一共展示了Node::getFirstChild方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: execute
virtual void execute(const DOM::Node<string_type, string_adaptor>& node,
ExecutionContext<string_type, string_adaptor>& context) const
{
ParamPasser<string_type, string_adaptor> passer(*this, node, context);
if(!SortableT::has_sort() && select_ == 0)
{
if(node.hasChildNodes())
context.stylesheet().applyTemplates(node.getChildNodes(), context, mode_);
return;
}
Arabica::XPath::NodeSet<string_type, string_adaptor> nodes;
if(select_ == 0)
for(DOM::Node<string_type, string_adaptor> n = node.getFirstChild(); n != 0; n = n.getNextSibling())
nodes.push_back(n);
else
{
Arabica::XPath::XPathValue<string_type, string_adaptor> value = select_->evaluate(node, context.xpathContext());
if(value.type() != Arabica::XPath::NODE_SET)
throw std::runtime_error("apply-templates select expression is not a node-set");
nodes = value.asNodeSet();
}
this->sort(node, nodes, context);
context.stylesheet().applyTemplates(nodes, context, mode_);
} // execute
示例2: process_content
virtual void process_content(const DOM::Node<std::string>& node, ExecutionContext& context) const
{
if(node.hasAttributes())
{
const DOM::NamedNodeMap<std::string>& attrs = node.getAttributes();
for(unsigned int a = 0; a < attrs.getLength(); ++a)
copy(attrs.item(a), context);
} // if ...
for(DOM::Node<std::string> n = node.getFirstChild(); n != 0; n = n.getNextSibling())
copy(n, context);
} // process_content