Gets document of which node is a child. \return Pointer to document that contains this node, or 0 if there is no parent document.
| 921 | //! Gets document of which node is a child. |
| 922 | //! \return Pointer to document that contains this node, or 0 if there is no parent document. |
| 923 | xml_document<Ch> *document() const |
| 924 | { |
| 925 | xml_node<Ch> *node = const_cast<xml_node<Ch> *>(this); |
| 926 | while (node->parent()) |
| 927 | node = node->parent(); |
| 928 | return node->type() == node_document ? static_cast<xml_document<Ch> *>(node) : 0; |
| 929 | } |
| 930 | |
| 931 | //! Gets first child node, optionally matching node name. |
| 932 | //! \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 |