* xmlDocGetRootElement: * @doc: the document * * Get the root element of the document (doc->children is a list * containing possibly comments, PIs, etc ...). * * Returns the root element or NULL if no element was found. */
| 5051 | * Returns the root element or NULL if no element was found. |
| 5052 | */ |
| 5053 | xmlNodePtr |
| 5054 | xmlDocGetRootElement(const xmlDoc *doc) { |
| 5055 | xmlNodePtr ret; |
| 5056 | |
| 5057 | if (doc == NULL) return(NULL); |
| 5058 | ret = doc->children; |
| 5059 | while (ret != NULL) { |
| 5060 | if (ret->type == XML_ELEMENT_NODE) |
| 5061 | return(ret); |
| 5062 | ret = ret->next; |
| 5063 | } |
| 5064 | return(ret); |
| 5065 | } |
| 5066 | |
| 5067 | #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_WRITER_ENABLED) |
| 5068 | /** |
no outgoing calls