xmlpp::ContentNode Class Reference

Content node. More...

`#include <libxml++/nodes/contentnode.h>`

Inheritance diagram for xmlpp::ContentNode:

## Public Member Functions

| ContentNode (_xmlNode * node)
| ~ContentNode () override
Glib::ustring | get_content () const
| Get the text of this content node.
std::optional< Glib::ustring > | get_content2 () const
| Get the text of this content node.
bool | is_white_space () const
void | set_content (const Glib::ustring & content)
| Set the text of this content node.
Public Member Functions inherited from xmlpp::Node
| Node (_xmlNode * node)
| ~Node () override
| Destructor.
const _xmlNode * | cobj () const noexcept
| Access the underlying libxml implementation.
_xmlNode * | cobj () noexcept
| Access the underlying libxml implementation.
bool | eval_to_boolean (const Glib::ustring & xpath, const PrefixNsMap & namespaces, XPathResultType * result_type=nullptr) const
| Evaluate an XPath expression.
bool | eval_to_boolean (const Glib::ustring & xpath, XPathResultType * result_type=nullptr) const
| Evaluate an XPath expression.
double | eval_to_number (const Glib::ustring & xpath, const PrefixNsMap & namespaces, XPathResultType * result_type=nullptr) const
| Evaluate an XPath expression.
double | eval_to_number (const Glib::ustring & xpath, XPathResultType * result_type=nullptr) const
| Evaluate an XPath expression.
Glib::ustring | eval_to_string (const Glib::ustring & xpath, const PrefixNsMap & namespaces, XPathResultType * result_type=nullptr) const
| Evaluate an XPath expression.
Glib::ustring | eval_to_string (const Glib::ustring & xpath, XPathResultType * result_type=nullptr) const
| Evaluate an XPath expression.
std::variant< NodeSet, bool, double, Glib::ustring > | eval_xpath (const Glib::ustring & xpath, const PrefixNsMap & namespaces={})
| Evaluate an XPath expression.
std::variant< const_NodeSet, bool, double, Glib::ustring > | eval_xpath (const Glib::ustring & xpath, const PrefixNsMap & namespaces={}) const
| Evaluate an XPath expression.
NodeSet | find (const Glib::ustring & xpath)
| Find nodes from an XPath expression.
const_NodeSet | find (const Glib::ustring & xpath) const
| Find nodes from an XPath expression.
NodeSet | find (const Glib::ustring & xpath, const PrefixNsMap & namespaces)
| Find nodes from an XPath expression.
const_NodeSet | find (const Glib::ustring & xpath, const PrefixNsMap & namespaces) const
| Find nodes from an XPath expression.
NodeList | get_children (const Glib::ustring & name=Glib::ustring())
| Obtain the list of child nodes.
const_NodeList | get_children (const Glib::ustring & name=Glib::ustring()) const
| Obtain the list of child nodes.
Node * | get_first_child (const Glib::ustring & name=Glib::ustring())
| Get the first child of this node.
const Node * | get_first_child (const Glib::ustring & name=Glib::ustring()) const
| Get the first child of this node.
int | get_line () const
| Discover at what line number this node occurs in the XML file.
Glib::ustring | get_name () const
| Get the name of this node.
std::optional< Glib::ustring > | get_name2 () const
| Get the name of this node.
Glib::ustring | get_namespace_prefix () const
| Get the namespace prefix of this node.
std::optional< Glib::ustring > | get_namespace_prefix2 () const
| Get the namespace prefix of this node.
Glib::ustring | get_namespace_uri () const
| Get the namespace URI of this node.
std::optional< Glib::ustring > | get_namespace_uri2 () const
| Get the namespace URI of this node.
Node * | get_next_sibling ()
| Get the next sibling for this node.
const Node * | get_next_sibling () const
| Get the next sibling for this node.
Element * | get_parent ()
| Get the parent element for this node.
const Element * | get_parent () const
| Get the parent element for this node.
Glib::ustring | get_path () const
| Get the XPath of this node.
std::optional< Glib::ustring > | get_path2 () const
| Get the XPath of this node.
Node * | get_previous_sibling ()
| Get the previous sibling for this node.
const Node * | get_previous_sibling () const
| Get the previous sibling for this node .
Node * | import_node (const Node * node, bool recursive=true)
| Import node(s) from another document under this node, without affecting the source node.
void | set_name (const Glib::ustring & name)
| Set the name of this node.
void | set_namespace (const Glib::ustring & ns_prefix)
| Set the namespace prefix used by the node.

## Additional Inherited Members

Public Types inherited from xmlpp::Node
using | const_NodeList = std::list<const Node*>
using | const_NodeSet = std::vector<const Node*>
using | NodeList = std::list<Node*>
using | NodeSet = std::vector<Node*>
using | PrefixNsMap = std::map<Glib::ustring, Glib::ustring>
| A map of namespace prefixes to namespace URIs.
Static Public Member Functions inherited from xmlpp::Node
static void | create_wrapper (_xmlNode * node)
| Construct the correct C++ instance for a given libxml C struct instance.
static void | free_wrappers (_xmlNode * node)
| Delete the C++ instance for a given libxml C struct instance, and also recursively destroy the C++ instances for any children.
static void | remove_node (Node * node)
| Remove a node and its children.
Protected Member Functions inherited from xmlpp::NonCopyable
| NonCopyable () noexcept
| NonCopyable (const NonCopyable &)=delete
| NonCopyable (NonCopyable &&)=delete
virtual | ~NonCopyable ()
NonCopyable & | operator= (const NonCopyable &)=delete
NonCopyable & | operator= (NonCopyable &&)=delete

## Detailed Description

Content node.

This will be instantiated by the parser.

## Constructor & Destructor Documentation

## ContentNode()

xmlpp::ContentNode::ContentNode | ( | _xmlNode * | node | ) |

explicit

## ~ContentNode()

xmlpp::ContentNode::~ContentNode | ( |  | ) |

override

## Member Function Documentation

## get_content()

Glib::ustring xmlpp::ContentNode::get_content | ( |  | ) | const

Get the text of this content node.

Returns
  The text. Note that the 5 predefined entities (&, ", <, >, ') are always resolved, so this content will show their human-readable equivalents.

Deprecated
  4.4: Use get_content2() instead.

## get_content2()

std::optional< Glib::ustring > xmlpp::ContentNode::get_content2 | ( |  | ) | const

Get the text of this content node.

Returns
  The text, or no value if this node has no text. Note that the 5 predefined entities (&, ", <, >, ') are always resolved, so this content will show their human-readable equivalents.

Since libxml++ 4.4

## is_white_space()

bool xmlpp::ContentNode::is_white_space | ( |  | ) | const

Returns
  Whether this node contains only white space, or is empty.

## set_content()

void xmlpp::ContentNode::set_content | ( | const Glib::ustring & | content | ) |

Set the text of this content node.

Parameters

  content | The text. This must be unescaped, meaning that the predefined entities will be created for you where necessary. See get_content().