# Poco::XML

# class DOMBuilder

Library: XML
Package: DOM
Header: Poco/DOM/DOMBuilder.h

## Description

This class builds a tree representation of an XML document, according to the W3C Document Object Model, Level 1 and 2 specifications.

The actual XML parsing is done by an XMLReader, which must be supplied to the DOMBuilder.

## Inheritance

Direct Base Classes: DTDHandler, ContentHandler, LexicalHandler

All Base Classes: ContentHandler, DTDHandler, LexicalHandler

## Member Summary

Member Functions: appendNode, characters, comment, endCDATA, endDTD, endDocument, endElement, endEntity, endPrefixMapping, ignorableWhitespace, notationDecl, parse, parseMemoryNP, processingInstruction, setDocumentLocator, setupParse, skippedEntity, startCDATA, startDTD, startDocument, startElement, startEntity, startPrefixMapping, unparsedEntityDecl

Inherited Functions: characters, comment, endCDATA, endDTD, endDocument, endElement, endEntity, endPrefixMapping, ignorableWhitespace, notationDecl, processingInstruction, setDocumentLocator, skippedEntity, startCDATA, startDTD, startDocument, startElement, startEntity, startPrefixMapping, unparsedEntityDecl

## Constructors

### DOMBuilder

DOMBuilder(
XMLReader & xmlReader,
NamePool * pNamePool = nullptr,
std::size_t maxDepth = 0
);

Creates a DOMBuilder using the given XMLReader. If a NamePool is given, it becomes the Document's NamePool.

The maxDepth parameter can be used to limit the maximum element depth of the document. This can be used to prevent excessive element depth, which could lead to a stack overflow when destroying the document. A maxDepth of 0 does not limit the depth.

## Destructor

### ~DOMBuilder

virtual ~DOMBuilder();

Destroys the DOMBuilder.

## Member Functions

### parse

virtual Document * parse(
const XMLString & uri
);

Parse an XML document from a location identified by an URI.

### parse

virtual Document * parse(
InputSource * pInputSource
);

Parse an XML document from a location identified by an InputSource.

### parseMemoryNP

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

Parses an XML document from memory.

### appendNode

void appendNode(
AbstractNode * pNode
);

### characters

void characters(
const XMLChar ch[],
int start,
int length
);

See also: Poco::XML::ContentHandler::characters()

### comment

void comment(
const XMLChar ch[],
int start,
int length
);

See also: Poco::XML::LexicalHandler::comment()

### endCDATA

void endCDATA();

See also: Poco::XML::LexicalHandler::endCDATA()

### endDTD

void endDTD();

See also: Poco::XML::LexicalHandler::endDTD()

### endDocument

void endDocument();

See also: Poco::XML::ContentHandler::endDocument()

### endElement

void endElement(
const XMLString & uri,
const XMLString & localName,
const XMLString & qname
);

See also: Poco::XML::ContentHandler::endElement()

### endEntity

void endEntity(
const XMLString & name
);

See also: Poco::XML::LexicalHandler::endEntity()

### endPrefixMapping

void endPrefixMapping(
const XMLString & prefix
);

See also: Poco::XML::ContentHandler::endPrefixMapping()

### ignorableWhitespace

void ignorableWhitespace(
const XMLChar ch[],
int start,
int length
);

See also: Poco::XML::ContentHandler::ignorableWhitespace()

### notationDecl

void notationDecl(
const XMLString & name,
const XMLString * publicId,
const XMLString * systemId
);

See also: Poco::XML::DTDHandler::notationDecl()

### processingInstruction

void processingInstruction(
const XMLString & target,
const XMLString & data
);

See also: Poco::XML::ContentHandler::processingInstruction()

### setDocumentLocator

void setDocumentLocator(
const Locator * loc
);

See also: Poco::XML::ContentHandler::setDocumentLocator()

### setupParse

void setupParse();

### skippedEntity

void skippedEntity(
const XMLString & name
);

See also: Poco::XML::ContentHandler::skippedEntity()

### startCDATA

void startCDATA();

See also: Poco::XML::LexicalHandler::startCDATA()

### startDTD

void startDTD(
const XMLString & name,
const XMLString & publicId,
const XMLString & systemId
);

See also: Poco::XML::LexicalHandler::startDTD()

### startDocument

void startDocument();

See also: Poco::XML::ContentHandler::startDocument()

### startElement

void startElement(
const XMLString & uri,
const XMLString & localName,
const XMLString & qname,
const Attributes & attributes
);

See also: Poco::XML::ContentHandler::startElement()

### startEntity

void startEntity(
const XMLString & name
);

See also: Poco::XML::LexicalHandler::startEntity()

### startPrefixMapping

void startPrefixMapping(
const XMLString & prefix,
const XMLString & uri
);

See also: Poco::XML::ContentHandler::startPrefixMapping()

### unparsedEntityDecl

void unparsedEntityDecl(
const XMLString & name,
const XMLString * publicId,
const XMLString & systemId,
const XMLString & notationName
);

See also: Poco::XML::DTDHandler::unparsedEntityDecl()