Teuchos - Trilinos Tools Package Version of the Day
Loading...
Searching...
No Matches
Teuchos_TreeBuildingXMLHandler.hpp
Go to the documentation of this file.
1// @HEADER
2// *****************************************************************************
3// Teuchos: Common Tools Package
4//
5// Copyright 2004 NTESS and the Teuchos contributors.
6// SPDX-License-Identifier: BSD-3-Clause
7// *****************************************************************************
8// @HEADER
9
10#ifndef Teuchos_TREEBUILDINGXMLHANDLER_H
11#define Teuchos_TREEBUILDINGXMLHANDLER_H
12
18#include "Teuchos_XMLObject.hpp"
19#include <list>
20#include <stack>
21
22
23namespace Teuchos
24{
25
30 {
32 public:
35
37 const XMLObject& getObject() const
38 {
39 // valid XML requires a root object; we will allow empty XML files
41 root_.isEmpty(), EmptyXMLError
42 ,"Error, An empty XML std::string or file was specified!"
43 " The XML specification requires at minimum the presence"
44 " of a root element!" );
45 return root_.getChild(0);
46 }
47
49 void characters(const std::string& chars);
50
52 int endElement(const std::string& tag);
53
55 void startElement(const std::string& tag,
56 const Map& attributes);
57
58 private:
59 XMLObject root_;
60 XMLObject current_;
61 std::stack<XMLObject> path_;
62 };
63}
64
65
66#endif
67
Teuchos header file which uses auto-configuration information to include necessary C++ headers.
An object representation of a subset of XML data.
Thrown when attempting to parse an empty XML std::string.
Smart reference counting pointer class for automatic garbage collection.
TreeBuildingXMLHandler assembles a XMLObject from your XML input.
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.
const XMLObject & getObject() const
Retrieve the entire XML tree.
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,...
const XMLObject & getChild(int i) const
Return the i-th child node.
bool isEmpty() const
Find out if a node is empty.
#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,...