本文整理汇总了C++中CL_DomNode::is_text方法的典型用法代码示例。如果您正苦于以下问题:C++ CL_DomNode::is_text方法的具体用法?C++ CL_DomNode::is_text怎么用?C++ CL_DomNode::is_text使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CL_DomNode
的用法示例。
在下文中一共展示了CL_DomNode::is_text方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: get_text
CL_String CL_DomElement::get_text() const
{
CL_String str;
if (has_child_nodes() == false)
return str;
CL_DomNode cur = get_first_child();
while (!cur.is_null())
{
if (cur.is_text() || cur.is_cdata_section())
str.append(cur.get_node_value());
if (cur.is_element())
str.append(cur.to_element().get_text());
cur = cur.get_next_sibling();
}
return str;
}
示例2: load_css_layout
void CL_GUIComponent::load_css_layout(const CL_String &xml_filename, const CL_String &css_filename)
{
CL_CSSDocument2 css_document;
css_document.add_sheet(css_filename);
CL_File file(xml_filename);
CL_DomDocument dom(file, false);
CL_DomNode cur = dom.get_document_element().get_first_child();
std::vector<CL_CSSLayoutElement> element_stack;
{
CL_DomSelectNode select_node(dom.get_document_element());
impl->css_element.apply_properties(css_document.select(&select_node));
impl->css_element.apply_properties(dom.get_document_element().get_attribute("style"));
impl->css_element.set_col_span(dom.get_document_element().get_attribute_int("colspan", 1));
impl->css_element.set_row_span(dom.get_document_element().get_attribute_int("rowspan", 1));
}
element_stack.push_back(impl->css_element);
while (!cur.is_null())
{
CL_CSSLayoutElement child_css_element;
if (cur.is_element())
{
CL_DomElement cur_element = cur.to_element();
CL_DomSelectNode select_node(cur_element);
child_css_element = element_stack.back().create_element(cur_element.get_tag_name());
child_css_element.apply_properties(css_document.select(&select_node));
child_css_element.apply_properties(cur_element.get_attribute("style"));
child_css_element.set_col_span(cur_element.get_attribute_int("colspan", 1));
child_css_element.set_row_span(cur_element.get_attribute_int("rowspan", 1));
}
else if (cur.is_text())
{
CL_DomText cur_text = cur.to_text();
element_stack.back().create_text(cur_text.get_node_value());
}
CL_DomNode next = cur.get_first_child();
if (next.is_null())
{
next = cur.get_next_sibling();
if (next.is_null())
{
next = cur.get_parent_node();
while (!next.is_null() && next.get_next_sibling().is_null())
next = next.get_parent_node();
if (!next.is_null())
next = next.get_next_sibling();
}
}
else
{
element_stack.push_back(child_css_element);
}
cur = next;
}
CL_GraphicContext gc = get_gc();
impl->css_layout.layout(gc, get_size());
}