Class Poco::XML::SAXParser
Author: Applied Informatics Software Engineering GmbH and Contributors

# Poco::XML

# class SAXParser

Library: XML
Package: SAX
Header: Poco/SAX/SAXParser.h

## Description

This class provides a SAX2 (Simple API for XML) interface to expat, the XML parser toolkit. The following SAX2 features and properties are supported:

- http://xml.org/sax/features/external-general-entities
- http://xml.org/sax/features/external-parameter-entities
- http://xml.org/sax/features/namespaces
- http://xml.org/sax/features/namespace-prefixes
- http://xml.org/sax/properties/lexical-handler
- http://xml.org/sax/properties/declaration-handler

The following proprietary extensions are supported:

- http://www.appinf.com/features/enable-partial-reads — see ParserEngine::setEnablePartialReads()

## Inheritance

Direct Base Classes: XMLReader

All Base Classes: XMLReader

## Member Summary

Member Functions: addEncoding, getContentHandler, getDTDHandler, getEncoding, getEntityResolver, getErrorHandler, getFeature, getProperty, parse, parseMemoryNP, parseString, setContentHandler, setDTDHandler, setEncoding, setEntityResolver, setErrorHandler, setFeature, setProperty, setupParse

Inherited Functions: getContentHandler, getDTDHandler, getEntityResolver, getErrorHandler, getFeature, getProperty, parse, parseMemoryNP, setContentHandler, setDTDHandler, setEntityResolver, setErrorHandler, setFeature, setProperty

## Constructors

### SAXParser

SAXParser();

Creates an SAXParser.

### SAXParser

SAXParser(
const XMLString & encoding
);

Creates an SAXParser with the given encoding.

## Destructor

### ~SAXParser

~SAXParser();

Destroys the SAXParser.

## Member Functions

### addEncoding

void addEncoding(
const XMLString & name,
Poco::TextEncoding * pEncoding
);

Adds an encoding to the parser. Does not take ownership of the pointer! XMLReader

### getContentHandler

ContentHandler * getContentHandler() const;

See also: Poco::XML::XMLReader::getContentHandler()

### getDTDHandler

DTDHandler * getDTDHandler() const;

See also: Poco::XML::XMLReader::getDTDHandler()

### getEncoding

const XMLString & getEncoding() const;

Returns the name of the encoding used by the parser if no encoding is specified in the XML document.

### getEntityResolver

EntityResolver * getEntityResolver() const;

See also: Poco::XML::XMLReader::getEntityResolver()

### getErrorHandler

ErrorHandler * getErrorHandler() const;

See also: Poco::XML::XMLReader::getErrorHandler()

### getFeature

bool getFeature(
const XMLString & featureId
) const;

See also: Poco::XML::XMLReader::getFeature()

### getProperty

void * getProperty(
const XMLString & propertyId
) const;

See also: Poco::XML::XMLReader::getProperty()

### parse

void parse(
InputSource * pSource
);

See also: Poco::XML::XMLReader::parse()

### parse

void parse(
const XMLString & systemId
);

See also: Poco::XML::XMLReader::parse()

### parseMemoryNP

void parseMemoryNP(
const char * xml,
std::size_t size
);

Extensions

See also: Poco::XML::XMLReader::parseMemoryNP()

### parseString

void parseString(
const std::string & xml
);

### setContentHandler

void setContentHandler(
ContentHandler * pContentHandler
);

See also: Poco::XML::XMLReader::setContentHandler()

### setDTDHandler

void setDTDHandler(
DTDHandler * pDTDHandler
);

See also: Poco::XML::XMLReader::setDTDHandler()

### setEncoding

void setEncoding(
const XMLString & encoding
);

Sets the encoding used by the parser if no encoding is specified in the XML document.

### setEntityResolver

void setEntityResolver(
EntityResolver * pResolver
);

See also: Poco::XML::XMLReader::setEntityResolver()

### setErrorHandler

void setErrorHandler(
ErrorHandler * pErrorHandler
);

See also: Poco::XML::XMLReader::setErrorHandler()

### setFeature

void setFeature(
const XMLString & featureId,
bool state
);

See also: Poco::XML::XMLReader::setFeature()

### setProperty

void setProperty(
const XMLString & propertyId,
const XMLString & value
);

See also: Poco::XML::XMLReader::setProperty()

### setProperty

void setProperty(
const XMLString & propertyId,
void * value
);

See also: Poco::XML::XMLReader::setProperty()

### setupParse

void setupParse();

## Variables

### FEATURE_PARTIAL_READS

static const XMLString FEATURE_PARTIAL_READS;