Returns top-level element of the given instance (NULL for fragment)If the given instance is well-formed then this function will return the top-level element of the document that is stored within the instance. If the given instance is a fragment then NULL will be returned because there may be no top-level elements or too many of them. Note that in spite of this functions name this function actually returns the a top-level node rather than not a root node. According to the W3C XPATH standards, the root element is an implicit node whose children are top-level elements, comments, processing instructions and maybe text nodes. E.g. if a correct HTML document is started by tag and ended by corresponding tag then the only top-level node is the "HTML" element node and this node is a single child of the root node. If the given instance is well-formed then the function returns a top-level element of the document that is stored in the instance. If the given instance is fragment then NULL is returned, because there may be no top-level elements or too many of them.
Returns top-level element of the given instance (NULL for fragment)If the given instance is well-formed then this function will return
the top-level element of the document that is stored within the instance.
If the given instance is a fragment then NULL will be returned because there
may be no top-level elements or too many of them.
Note that in spite of this functions name this function actually
returns the a top-level node rather than not a root node. According to the
W3C XPATH standards, the root element is an implicit node whose children are top-level
elements, comments, processing instructions and maybe text nodes. E.g. if
a correct HTML document is started by tag <HTML>
and ended by corresponding </HTML> tag
then the only top-level node is the "HTML"
element node and this node is a single child of the root node.
If the given instance is well-formed then the function returns a
top-level element of the document that is stored in the instance. If the
given instance is fragment then NULL is returned, because there may be
no top-level elements or too many of them.