Gets document of which attribute is a child. \return Pointer to document that contains this attribute, or 0 if there is no parent document.
| 817 | //! Gets document of which attribute is a child. |
| 818 | //! \return Pointer to document that contains this attribute, or 0 if there is no parent document. |
| 819 | xml_document<Ch> *document() const |
| 820 | { |
| 821 | if (xml_node<Ch> *node = this->parent()) |
| 822 | { |
| 823 | while (node->parent()) |
| 824 | node = node->parent(); |
| 825 | return node->type() == node_document ? static_cast<xml_document<Ch> *>(node) : 0; |
| 826 | } |
| 827 | else |
| 828 | return 0; |
| 829 | } |
| 830 | |
| 831 | //! Gets previous attribute, optionally matching attribute name. |
| 832 | //! \param name Name of attribute to find, or 0 to return previous attribute regardless of its name; this string doesn't have to be zero-terminated if name_size is non-zero |