Teuchos - Trilinos Tools Package Version of the Day
Loading...
Searching...
No Matches
Teuchos_XMLInputSource.cpp
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
12
13
14#ifdef HAVE_TEUCHOS_EXPAT
16# define EXPAT_BUFSIZE 8192
17#else
18# include "Teuchos_XMLParser.hpp"
19#endif
20
21using namespace Teuchos;
22
24{
25
26#ifdef HAVE_TEUCHOS_EXPAT
27
29
31
34
36
37 XML_SetUserData(parser, (void*) &(*handler));
38
40
41 bool done = false;
42 unsigned int bufsize = EXPAT_BUFSIZE;
43 unsigned char buf[EXPAT_BUFSIZE];
44
45 while (!done)
46 {
47 unsigned int nRead = s->readBytes(buf, bufsize);
48 if (nRead < bufsize)
49 {
50 done = true;
51 }
52 XML_Parse(parser, (char*) buf, bufsize, done);
53 }
54
55 return handler->getObject();
56
57#else
58
59 XMLParser parser(stream());
60
61 return parser.parse();
62
63#endif
64
65}
66
67
Expat adapter for the TreeBuildingXMLHandler.
Defines a class for assembling an XMLObject from XML input.
A base class for defining a source of XML input.
A class providing a simple XML parser. Methods can be overloaded to exploit external XML parsing libr...
Smart reference counting pointer class for automatic garbage collection.
TreeBuildingXMLHandler assembles a XMLObject from your XML input.
XMLObject getObject() const
Get an object by invoking the TreeBuildingXMLHandler on the input data.
virtual RCP< XMLInputStream > stream() const =0
Virtual input source interface.
Representation of an XML data tree. XMLObject is a ref-counted handle to a XMLObjectImplem object,...
XMLParser consumes characters from an XMLInputStream object, parsing the XML and using a TreeBuilding...
The Teuchos namespace contains all of the classes, structs and enums used by Teuchos,...
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
Deprecated.