How can one determine whether an XMLDocument object is newly created and has never loaded any data? #696
-
|
When I try to use doc.empty() to determine whether the document is empty, the returned value is always 0. After doc loads an XML document, the return value remains 0 regardless of whether I call doc.reset(). |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
|
What you want is "does the document have no nodes?", which can be checked via |
Beta Was this translation helpful? Give feedback.
xml_document::emptyis misleading, it's justxml_node::emptythat is inherited. It means "is this node a null node" (see https://pugixml.org/docs/manual.html#dom.cpp); a document is never a null node.What you want is "does the document have no nodes?", which can be checked via
doc.first_child().empty().