Teuchos - Trilinos Tools Package
Version of the Day
Toggle main menu visibility
Loading...
Searching...
No Matches
parameterlist
src
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
16
17
#include "
Teuchos_ConfigDefs.hpp
"
18
#include "
Teuchos_XMLObject.hpp
"
19
#include <list>
20
#include <stack>
21
22
23
namespace
Teuchos
24
{
25
29
class
TreeBuildingXMLHandler
30
{
31
typedef
Teuchos::map<std::string, std::string> Map;
32
public
:
34
TreeBuildingXMLHandler
();
35
37
const
XMLObject
&
getObject
()
const
38
{
39
// valid XML requires a root object; we will allow empty XML files
40
TEUCHOS_TEST_FOR_EXCEPTION
(
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_ConfigDefs.hpp
Teuchos header file which uses auto-configuration information to include necessary C++ headers.
Teuchos_XMLObject.hpp
An object representation of a subset of XML data.
Teuchos::EmptyXMLError
Thrown when attempting to parse an empty XML std::string.
Definition
Teuchos_XMLObject.hpp:24
Teuchos::TreeBuildingXMLHandler::characters
void characters(const std::string &chars)
Process character data.
Definition
Teuchos_TreeBuildingXMLHandler.cpp:22
Teuchos::TreeBuildingXMLHandler::startElement
void startElement(const std::string &tag, const Map &attributes)
Receive notification of the start of an element.
Definition
Teuchos_TreeBuildingXMLHandler.cpp:45
Teuchos::TreeBuildingXMLHandler::getObject
const XMLObject & getObject() const
Retrieve the entire XML tree.
Definition
Teuchos_TreeBuildingXMLHandler.hpp:37
Teuchos::TreeBuildingXMLHandler::TreeBuildingXMLHandler
TreeBuildingXMLHandler()
Empty constructor.
Definition
Teuchos_TreeBuildingXMLHandler.cpp:16
Teuchos::TreeBuildingXMLHandler::endElement
int endElement(const std::string &tag)
Receive notification of the end of an element.
Definition
Teuchos_TreeBuildingXMLHandler.cpp:68
Teuchos::XMLObject
Representation of an XML data tree. XMLObject is a ref-counted handle to a XMLObjectImplem object,...
Definition
Teuchos_XMLObject.hpp:30
TEUCHOS_TEST_FOR_EXCEPTION
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
Macro for throwing an exception with breakpointing to ease debugging.
Definition
Teuchos_TestForException.hpp:146
Teuchos
The Teuchos namespace contains all of the classes, structs and enums used by Teuchos,...
Generated by
1.17.0