---
name: "ost_XMLStream"
section: "3"
platform: "linux"
package: "libcommoncpp2-doc"
version: "1.8.1-10"
release: "Debian 11 (Bullseye)"
platforms: ["linux"]
url: "https://new.carta.tech/ost_XMLStream"
---

# ost\_XMLStream(3)

This class impliments a basic XML stream parser that can be used to examine an XML resource thru virtual I/O methods.

## NAME

ost::XMLStream - This class impliments a basic XML stream parser that can be used to examine an XML resource thru virtual I/O methods.

## SYNOPSIS

`#include <xml.h>`

Inherited by **ost::XMLRPC**.

### Public Member Functions

virtual bool **open** (const char \*resource)\
 May perform an open operation on behalf of a parsed resource.  virtual void **close** (void)\
 May perform a close operation of an i/o source when the parser has completed operation.  virtual **Slog::Level** **getLogging** (void)\
 Get error logging level.  virtual void **comment** (const unsigned char \*text, size\_t len)\
 Virtual to receive embedded comments in an XML document being parsed.  virtual int **read** (unsigned char \*buffer, size\_t len)=0\
 Read method to aquire data for the parser.  virtual void **characters** (const unsigned char \*text, size\_t len)=0\
 Virtual to receive character text extracted from the document in the current element.  virtual void **startDocument** (void)\
 Identify start of document event.  virtual void **endDocument** (void)\
 Identify end of document event.  virtual void **startElement** (const unsigned char \*name, const unsigned char \*\*attr)=0\
 Identify start of an element in the document.  virtual void **endElement** (const unsigned char \*name)=0\
 Identify end of an element in the document.  bool **parse** (const char \*resource=NULL)\
 Parse a resource as a stream thru the virtual read method.

### Protected Member Functions

virtual **~XMLStream** ()\

## Detailed Description

This class impliments a basic XML stream parser that can be used to examine an XML resource thru virtual I/O methods.

This class must be derived into one that can impliment the physical I/O required to parse actual data. A mixer class using **XMLStream** and **URLStream** would seem a likely combination for this purpose.

**Author**

David Sugar dyfet@ostel.com

XML Stream Parser (SAX)

**Examples** **xmlfetch.cpp**.

## Constructor & Destructor Documentation

### virtual ost::XMLStream::~XMLStream ()` [protected]`, ` [virtual]`

## Member Function Documentation

### virtual void ost::XMLStream::characters (const unsigned char \* text, size\_t len)` [pure virtual]`

Virtual to receive character text extracted from the document in the current element.

**Parameters**

*text* received. \
 *len* length of text received.

### virtual void ost::XMLStream::close (void)` [virtual]`

May perform a close operation of an i/o source when the parser has completed operation.

### virtual void ost::XMLStream::comment (const unsigned char \* text, size\_t len)` [virtual]`

Virtual to receive embedded comments in an XML document being parsed.

**Parameters**

*text* text comment extracted. \
 *len* length of comment.

### virtual void ost::XMLStream::endDocument (void)` [virtual]`

Identify end of document event.

### virtual void ost::XMLStream::endElement (const unsigned char \* name)` [pure virtual]`

Identify end of an element in the document.

**Parameters**

*name* of element found.

### virtual Slog::Level ost::XMLStream::getLogging (void)` [virtual]`

Get error logging level.

**Returns**

error logging level.

### virtual bool ost::XMLStream::open (const char \* resource)` [virtual]`

May perform an open operation on behalf of a parsed resource. In some cases, the parser may be merged with a class that already has performed some kind of open, and this method can then be ignored.

**Returns**

true if open is successful.

**Parameters**

*resource* passed to Parse methods.

### bool ost::XMLStream::parse (const char \* resource = `NULL`)

Parse a resource as a stream thru the virtual read method.

**Returns**

true if well formed document has been fully parsed.

**Parameters**

*resource* optional name of resource.

### virtual int ost::XMLStream::read (unsigned char \* buffer, size\_t len)` [pure virtual]`

Read method to aquire data for the parser.

**Returns**

number of bytes actually read.

**Parameters**

*buffer* to read data into. \
 *len* number of bytes to read.

### virtual void ost::XMLStream::startDocument (void)` [virtual]`

Identify start of document event.

### virtual void ost::XMLStream::startElement (const unsigned char \* name, const unsigned char \*\* attr)` [pure virtual]`

Identify start of an element in the document.

**Parameters**

*name* of element found. \
 *attr* list of attributes extracted.

## Author

Generated automatically by Doxygen for GNU CommonC++ from the source code.
