void TreeMaker::OnText (std::string const & text) { Assert (_curr != 0); // Parser must not allow such call std::auto_ptr<Node> child (new Node (std::string ())); Node * newChild = _curr->AddChild (child); newChild->AddAttribute ("Text", text); }
void Node::AddText (std::string const & text) { if (_closed) throw XML::Exception ("Cannot add text to a closed XML node"); // text as a nameless child with Text attribute std::auto_ptr<Node> child (new Node (std::string ())); Node * newChild = AddChild (child); newChild->AddAttribute ("Text", text); }