Gets document of which node is a child. \return Pointer to document that contains this node, or 0 if there is no parent document.
| 934 | //! Gets document of which node is a child. |
| 935 | //! \return Pointer to document that contains this node, or 0 if there is no parent document. |
| 936 | xml_document<Ch> *document() const |
| 937 | { |
| 938 | xml_node<Ch> *node = const_cast<xml_node<Ch> *>(this); |
| 939 | while (node->parent()) |
| 940 | node = node->parent(); |
| 941 | return node->type() == node_document ? static_cast<xml_document<Ch> *>(node) : 0; |
| 942 | } |
| 943 | |
| 944 | //! Gets first child node, optionally matching node name. |
| 945 | //! \param name_ Name of child to find, or 0 to return first child regardless of its name; this string doesn't have to be zero-terminated if name_size is non-zero |