XmlEventReader API Ref

#include <DbXml.hpp>

virtual XmlEventReader::~XmlEventReader()


Description: XmlEventReader

The XmlEventReader class enables applications to read document content via a pull interface without materializing XML as text. This can be efficient and allow closer integration of XML processing in an application.

The XmlEventReader acts as an iterator, where XmlEventReader::hasNext indicates the presence of additional events, and XmlEventReader::next moves the current location, returning the event type of the next event. At any given location, various methods on the object allow the application to retrieve the current state, such as element name and attributes. Character state (names, text values, etc) are returned in NULL-terminated const unsigned char * strings, encoded in UTF-8. Their values are valid only until another call is made on the XmlEventReader object. When processing of the object is completed, the XmlEventReader::close method must be called to release resources. Some interfaces implicitly assume ownership of the object -- for example XmlDocument::setContentAsEventReader.

XmlEventReader does not include events for attributes. Attributes are retrieved via interfaces such as XmlEventReader::getAttributeLocalName when the event type is StartElement.

XmlEventReader skips the EndElement event for empty elements (where XmlEventReader::isEmptyElement returns true).

Event types are defined at global scope, and include:
XmlEventReader::StartElement

XmlEventReader::EndElement XmlEventReader::Characters XmlEventReader::CDATA XmlEventReader::Comment XmlEventReader::Whitespace XmlEventReader::StartDocument XmlEventReader::EndDocument XmlEventReader::StartEntityReference XmlEventReader::EndEntityReference XmlEventReader::ProcessingInstruction XmlEventReader::DTD

Many of the class methods are context-dependent, as they are meaningful only within the context of a given event. See the documentation for the individual methods for details.

An XmlEventReader object may be obtained via XmlDocument::getContentAsEventReader or XmlValue::asEventReader or from an application-written class derived from XmlEventReader.

This object is not thread-safe, and can only be safely used by one thread at a time in an application.

APIRef

Copyright (c) 1996-2009 Oracle. All rights reserved.