void Xml::Element::eraseNode(const Xml::node_iterator& deleteThis) { const char* method = "Xml::Element::eraseNode()"; // Check that the supplied iterator points to something. SimTK_ERRCHK_ALWAYS(deleteThis != node_end(), method, "The node_iterator is at node_end() so doesn't refer to a Node."); // There is an iterator, make sure it points to a child of this element. SimTK_ERRCHK_ALWAYS(deleteThis->hasParentElement() && deleteThis->getParentElement()==*this, method, "The node_iterator did not refer to a child of this Element."); updTiElement().RemoveChild(deleteThis->updTiNodePtr()); }
Xml::Node Xml::Element::removeNode(const Xml::node_iterator& removeThis) { const char* method = "Xml::Element::removeNode()"; // Check that the supplied iterator points to something. SimTK_ERRCHK_ALWAYS(removeThis != node_end(), method, "The node_iterator is at node_end() so doesn't refer to a Node."); // There is an iterator, make sure it points to a child of this element. SimTK_ERRCHK_ALWAYS(removeThis->hasParentElement() && removeThis->getParentElement()==*this, method, "The node_iterator did not refer to a child of this Element."); TiXmlNode* p = updTiElement().DisconnectChild(removeThis->updTiNodePtr()); return Xml::Node(p); }