- Main Page
- Namespaces
- Classes
- Files
- Related Pages

- Alphabetical List
- Class List
- Class Hierarchy
- Class Members

# Mers::Utils::Io::Xml::Stream::XmlStreamReader Class Reference

`#include <XmlStreamReader.h>`

Collaboration diagram for Mers::Utils::Io::Xml::Stream::XmlStreamReader:

[legend]
List of all members.

## Public Types
enum | EventType { ATTRIBUTE, CDATA, CHARACTERS, COMMENT, DTD, END_DOCUMENT, END_ELEMENT, ENTITY_DECLARATION, ENTITY_REFERENCE, NAMESPACE, NOTATION_DECLARATION, PROCESSING_INSTRUCTION, SPACE, START_DOCUMENT, START_ELEMENT }
## Public Member Functions
| XmlStreamReader ()
virtual | ~XmlStreamReader ()
virtual int | getAttributeCount () const=0
virtual const std::string & | getAttributeValue (const std::string &name) const =0
virtual const std::string & | getAttributeValue (const std::string &namespaceURI, const std::string &localName) const =0
virtual const std::string & | getElementText ()
virtual double | getElementTextAsDouble ()
virtual int | getElementTextAsInt ()
virtual const std::string & | getLocalName () const=0
virtual const XmlStreamLocation & | getLocation () const=0
virtual const std::string & | getText () const=0
virtual EventType | getEventType () const=0
virtual bool | isCharacters () const
virtual bool | isStartElement () const
virtual bool | isEndElement () const
virtual bool | isWhiteSpace () const
virtual bool | hasNext () const=0
virtual EventType | next ()=0
virtual EventType | nextTag ()
virtual EventType | nextSibling ()=0
virtual EventType | nextSiblingTag ()
## Protected Member Functions
void | checkHasNext () const

## Detailed Description

A base class that defines an interface for a pull parser and a couple of utility functions. It declares a subset of Streaming API for XML (JSR 173, see https://mers.csail.mit.edu/doc/3rdparty.html), plus a few useful functions for quickly navigating the XML stream. For all functions that return cont string&, the value in the string will not change until the next invocation of the same (or similarly-named) function.

Definition at line 37 of file XmlStreamReader.h.

## Member Enumeration Documentation

enum Mers::Utils::Io::Xml::Stream::XmlStreamReader::EventType

Event types in the stream. Some of these may never be returned in the current Libxml2 implementation.

Definition at line 43 of file XmlStreamReader.h.

## Member Function Documentation

const string & XmlStreamReader::getElementText | ( |  | ) | `[virtual]`

Returns the characters of a text-only element. By default, implemented, as described in JSR137.

Definition at line 26 of file XmlStreamReader.cpp.

References next().

Referenced by getElementTextAsDouble(), and getElementTextAsInt().

Here is the call graph for this function:

bool XmlStreamReader::isCharacters | ( |  | ) | const`[virtual]`

Returns true if this event represents text. By default, calls getEventType().

Definition at line 88 of file XmlStreamReader.cpp.

bool XmlStreamReader::isStartElement | ( |  | ) | const`[virtual]`

Returns true if this event represents a start tag of an element. By default, calls getEventType().

Definition at line 95 of file XmlStreamReader.cpp.

bool XmlStreamReader::isEndElement | ( |  | ) | const`[virtual]`

Returns true if this event represents an end tag of an element. By default, calls getEventType().

Definition at line 102 of file XmlStreamReader.cpp.

Referenced by Mers::Utils::Io::Xml::Stream::XmlStreamObjectFactory::checkEnd().

bool XmlStreamReader::isWhiteSpace | ( |  | ) | const`[virtual]`

Returns true if this event represents text that consists entirely of whitespace. By default, calls getEventType().

Definition at line 111 of file XmlStreamReader.cpp.

Referenced by nextSiblingTag(), and nextTag().

virtual bool Mers::Utils::Io::Xml::Stream::XmlStreamReader::hasNext | ( |  | ) | const`[pure virtual]`

Returns true if there are more XML events/nodes available.

Referenced by checkHasNext().

virtual EventType Mers::Utils::Io::Xml::Stream::XmlStreamReader::next | ( |  | ) | `[pure virtual]`

Returns the next event/node in the XML stream.

Exceptions:

  | NoSuchElementException | if the end of the stream has been reached.

Referenced by getElementText(), and nextTag().

XmlStreamReader::EventType XmlStreamReader::nextTag | ( |  | ) | `[virtual]`

Skips over any whitespace, until a start or an end of an element is reached. The default implementation uses next(), as described in the JSR173 standard.

Exceptions:

  | XmlStreamException | if the element contains non-whitespace data (characters).

Definition at line 120 of file XmlStreamReader.cpp.

References isWhiteSpace(), and next().

Referenced by Mers::Utils::Io::Xml::Stream::XmlStreamObjectFactory::checkEnd().

Here is the call graph for this function:

virtual EventType Mers::Utils::Io::Xml::Stream::XmlStreamReader::nextSibling | ( |  | ) | `[pure virtual]`

Moves to the next sibling node, skipping over the subtree.

Exceptions:

  | XmlStreamException | if the current node is an END_ELEMENT.

Referenced by nextSiblingTag().

XmlStreamReader::EventType XmlStreamReader::nextSiblingTag | ( |  | ) | `[virtual]`

Moves to the next sibling element, skipping over the subtree.

Exceptions:

  | XmlStreamException | if the current node is an END_ELEMENT or if the element contains non-whitespace data (characters).

Definition at line 139 of file XmlStreamReader.cpp.

References isWhiteSpace(), and nextSibling().

Here is the call graph for this function:

void XmlStreamReader::checkHasNext | ( |  | ) | const`[protected]`

Throws XmlStreamException if hasNext() == false.

Definition at line 159 of file XmlStreamReader.cpp.

References hasNext().

Here is the call graph for this function:

The documentation for this class was generated from the following files:

- /Users/fpy/titan-1-5-MBARI/Mers/Utils/Io/Xml/Stream/XmlStreamReader.h
- /Users/fpy/titan-1-5-MBARI/Mers/Utils/Io/Xml/Stream/XmlStreamReader.cpp