12#include "Teuchos_Assert.hpp"
17 : root_(), current_(), path_()
25 "TreeBuildingXMLHandler::trying to add content to an empty node");
27 size_t k = current_.numContentLines();
29 if(chars.compare(
"\n")==0) {
30 if((k>0) && (current_.getContentLine(k-1).length()>0))
31 current_.addContent(
"");
46 const Map& attributes)
50 if (current_.isEmpty())
60 for (Map::const_iterator i=attributes.begin(); i != attributes.end(); ++i)
62 const std::string& key = (*i).first;
63 const std::string& val = (*i).second;
64 current_.addAttribute(key, val);
73 if (current_.getTag() != tag) {
77 size_t k = current_.numContentLines();
78 while( (k>0) && (current_.getContentLine(--k).length() == 0))
79 current_.removeContentLine(k);
81 current_ = path_.top();
A std::string utilities class for Teuchos.
Defines a class for assembling an XMLObject from XML input.
static std::string fixUnprintableCharacters(const std::string &str)
Convert unprintable non-null characters to whitespace.
static bool isWhite(const std::string &str)
Returns true if a std::string consists entirely of whitespace.
void characters(const std::string &chars)
Process character data.
void startElement(const std::string &tag, const Map &attributes)
Receive notification of the start of an element.
TreeBuildingXMLHandler()
Empty constructor.
int endElement(const std::string &tag)
Receive notification of the end of an element.
Representation of an XML data tree. XMLObject is a ref-counted handle to a XMLObjectImplem object,...
void addChild(const XMLObject &child)
Add a child node to the node.
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
Macro for throwing an exception with breakpointing to ease debugging.
The Teuchos namespace contains all of the classes, structs and enums used by Teuchos,...