## Xalan-C++ API Documentation

### The Xalan C++ XSLT Processor Version 1.7

Main Page Class Hierarchy Alphabetical List Compound List File List Compound Members File Members

# FormatterToXMLBase Class Reference

FormatterToXML_UTF8 formats SAX-style events into XML. More...

`#include <FormatterToXMLBase.hpp>`

Inheritance diagram for FormatterToXMLBase

Collaboration diagram for FormatterToXMLBase:

List of all members.

## Public Types

- typedef std::vector<bool> BoolStackType

## Public Methods

- FormatterToXMLBase ( Writer& writer, const XalanDOMString& version, const XalanDOMString& mediaType, const XalanDOMString& doctypeSystem, const XalanDOMString& doctypePublic, bool xmlDecl, const XalanDOMString& standalone)
    Constructor. More...
- virtual ~FormatterToXMLBase ()
- virtual void setDocumentLocator (const LocatorType* const locator)
- virtual void startDocument ()
- virtual void endDocument ()
- virtual void startElement ( const XMLCh* const name, AttributeListType& attrs) = 0
- virtual void endElement (const XMLCh* const name) = 0
- virtual void characters ( const XMLCh* const chars, const unsigned int length)
- virtual void charactersRaw ( const XMLCh* const chars, const unsigned int length) = 0
- virtual void entityReference (const XMLCh* const name) = 0
    Receive notification of a entityReference. More...
- virtual void ignorableWhitespace ( const XMLCh* const chars, const unsigned int length)
- virtual void processingInstruction ( const XMLCh* const target, const XMLCh* const data)
- virtual void resetDocument ()
- virtual void comment (const XMLCh* const data) = 0
    Called when a Comment is to be constructed. More...
- virtual void cdata ( const XMLCh* const ch, const unsigned int length)
- virtual Writer* getWriter () const
- virtual const XalanDOMString& getDoctypeSystem () const
- virtual const XalanDOMString& getDoctypePublic () const
- virtual const XalanDOMString& getEncoding () const = 0
- virtual const XalanDOMString& getMediaType () const
- const XalanDOMString& getVersion () const
- const XalanDOMString& getStandalone () const
- bool getShouldWriteXMLHeader () const
- void setShouldWriteXMLHeader (bool b)

## Protected Types

- enum {
  kNotSpecial = 0,
  kContentSpecial = 1,
  kAttributeSpecial = 2,
  kBothSpecial = 3,
  kSpecialsSize = 0x80,
  kBufferSize = 512
  }

## Protected Methods

- virtual void writeXMLHeader () = 0
- virtual void flushBuffer () = 0
- virtual void writeDoctypeDecl (const XalanDOMChar* name) = 0
- virtual void writeProcessingInstruction ( const XMLCh* target, const XMLCh* data) = 0
- virtual void writeCharacters ( const XMLCh* chars, unsigned int length) = 0
- virtual void writeCDATA ( const XMLCh* chars, unsigned int length) = 0
- bool markParentForChildren ()
    Mark the parent element as having a child. More...
- void openElementForChildren ()
    Open an element for possibile children.
- bool outsideDocumentElement () const
- bool childNodesWereAdded ()
    Determine if an element ever had any children added. More...
- void generateDoctypeDecl (const XalanDOMChar* name)
- void flushWriter ()

## Protected Attributes

- Writer* m_writer
    The writer.
- bool m_nextIsRaw
    Tell if the next text should be raw.
- bool m_spaceBeforeClose
    Add space before '/>' for XHTML.
- const XalanDOMString m_doctypeSystem
    The System ID for the doc type.
- const XalanDOMString m_doctypePublic
    The public ID for the doc type.
- const XalanDOMString m_version
    Tells the XML version, for writing out to the XML decl.
- const XalanDOMString m_standalone
    Text for standalone part of header.
- const XalanDOMString m_mediaType
    The media type. More...
- const XalanDOMChar* m_newlineString
    The string of characters that represents the newline.
- XalanDOMString::size_type m_newlineStringLength
    The length of the the string of characters that represents the newline.

## Static Protected Methods

- bool isUTF16HighSurrogate (XalanDOMChar theChar)
- bool isUTF16LowSurrogate (XalanDOMChar theChar)
- unsigned int decodeUTF16SurrogatePair ( XalanDOMChar theHighSurrogate, XalanDOMChar theLowSurrogate)
- void throwInvalidUTF16SurrogateException (XalanDOMChar ch)
    Throw an exception when an invalid surrogate is encountered. More...
- void throwInvalidUTF16SurrogateException ( XalanDOMChar ch, XalanDOMChar next)
    Throw an exception when an invalid surrogate is encountered. More...
- void throwInvalidCharacterException (unsigned int ch)
    Throw an exception when an invalid character is encountered. More...

## Static Protected Attributes

- const XalanDOMChar s_specialChars []

## Detailed Description

FormatterToXML_UTF8 formats SAX-style events into XML.

## Member Typedef Documentation

typedef std::vector<bool> FormatterToXMLBase::BoolStackType

## Member Enumeration Documentation

anonymous enum`[protected]`

Enumeration values:

  kNotSpecial |
  kContentSpecial |
  kAttributeSpecial |
  kBothSpecial |
  kSpecialsSize |
  kBufferSize |

## Constructor & Destructor Documentation

FormatterToXMLBase::FormatterToXMLBase ( | Writer & writer,
| const XalanDOMString & version,
| const XalanDOMString & mediaType,
| const XalanDOMString & doctypeSystem,
| const XalanDOMString & doctypePublic,
| bool xmlDecl,
| const XalanDOMString & standalone )

Constructor.

Parameters:

  writer | the writer.
  version | the string to write for the XML version number.
  mediaType | media type (MIME content type) of the data
  doctypeSystem | system identifier to be used in the document type declaration
  doctypePublic | public identifier to be used in the document type declaration
  xmlDecl | true if the XSLT processor should output an XML declaration
  standalone | The string the XSLT processor should output for the standalone document declaration

virtual FormatterToXMLBase::~FormatterToXMLBase ( | )`[virtual]`

## Member Function Documentation

virtual void FormatterToXMLBase::cdata ( | const XMLCh *const ch,
| const unsigned int length )`[virtual]`

virtual void FormatterToXMLBase::characters ( | const XMLCh *const chars,
| const unsigned int length )`[virtual]`

virtual void FormatterToXMLBase::charactersRaw ( | const XMLCh *const chars,
| const unsigned int length )`[pure virtual]`

Reimplemented in FormatterToXML_UTF16, and FormatterToXML_UTF8.

bool FormatterToXMLBase::childNodesWereAdded ( | )`[protected]`

Determine if an element ever had any children added.

Returns:
  true if the children were added, false if not.

virtual void FormatterToXMLBase::comment ( | const XMLCh *const data )`[pure virtual]`

Called when a Comment is to be constructed.

Parameters:

  data | pointer to comment data

Exceptions:

  SAXException |

Reimplemented from FormatterListener.

Reimplemented in FormatterToXML_UTF16, and FormatterToXML_UTF8.

unsigned int FormatterToXMLBase::decodeUTF16SurrogatePair ( | XalanDOMChar theHighSurrogate,
| XalanDOMChar theLowSurrogate )`[static, protected]`

virtual void FormatterToXMLBase::endDocument ( | )`[virtual]`

Reimplemented from FormatterListener.

virtual void FormatterToXMLBase::endElement ( | const XMLCh *const name )`[pure virtual]`

Reimplemented from FormatterListener.

Reimplemented in FormatterToXML_UTF16, and FormatterToXML_UTF8.

virtual void FormatterToXMLBase::entityReference ( | const XMLCh *const name )`[pure virtual]`

Receive notification of a entityReference.

Parameters:

  data | pointer to characters from the XML document

Exceptions:

  SAXException |

Reimplemented from FormatterListener.

Reimplemented in FormatterToXML_UTF16, and FormatterToXML_UTF8.

virtual void FormatterToXMLBase::flushBuffer ( | )`[protected, pure virtual]`

Reimplemented in FormatterToXML_UTF16, and FormatterToXML_UTF8.

void FormatterToXMLBase::flushWriter ( | )`[protected]`

void FormatterToXMLBase::generateDoctypeDecl ( | const XalanDOMChar * name )`[protected]`

virtual const XalanDOMString& FormatterToXMLBase::getDoctypePublic ( | ) const`[virtual]`

Reimplemented from FormatterListener.

virtual const XalanDOMString& FormatterToXMLBase::getDoctypeSystem ( | ) const`[virtual]`

Reimplemented from FormatterListener.

virtual const XalanDOMString& FormatterToXMLBase::getEncoding ( | ) const`[pure virtual]`

Reimplemented from FormatterListener.

Reimplemented in FormatterToXML_UTF16, and FormatterToXML_UTF8.

virtual const XalanDOMString& FormatterToXMLBase::getMediaType ( | ) const`[virtual]`

Reimplemented from FormatterListener.

bool FormatterToXMLBase::getShouldWriteXMLHeader ( | ) const`[]`

const XalanDOMString & FormatterToXMLBase::getStandalone ( | ) const`[]`

const XalanDOMString & FormatterToXMLBase::getVersion ( | ) const`[]`

virtual Writer* FormatterToXMLBase::getWriter ( | ) const`[virtual]`

Reimplemented from FormatterListener.

virtual void FormatterToXMLBase::ignorableWhitespace ( | const XMLCh *const chars,
| const unsigned int length )`[virtual]`

bool FormatterToXMLBase::isUTF16HighSurrogate ( | XalanDOMChar theChar )`[static, protected]`

bool FormatterToXMLBase::isUTF16LowSurrogate ( | XalanDOMChar theChar )`[static, protected]`

bool FormatterToXMLBase::markParentForChildren ( | )`[protected]`

Mark the parent element as having a child.

If this is the first child, return true, otherwise, return false. This allows the child element to determine if the parent tag has already been closed.

Returns:
  true if the parent element has not been previously marked for children.

void FormatterToXMLBase::openElementForChildren ( | )`[protected]`

Open an element for possibile children.

bool FormatterToXMLBase::outsideDocumentElement ( | ) const`[protected]`

virtual void FormatterToXMLBase::processingInstruction ( | const XMLCh *const target,
| const XMLCh *const data )`[virtual]`

Reimplemented from FormatterListener.

virtual void FormatterToXMLBase::resetDocument ( | )`[virtual]`

Reimplemented from FormatterListener.

virtual void FormatterToXMLBase::setDocumentLocator ( | const LocatorType *const locator )`[virtual]`

Reimplemented from FormatterListener.

void FormatterToXMLBase::setShouldWriteXMLHeader ( | bool b )`[]`

virtual void FormatterToXMLBase::startDocument ( | )`[virtual]`

Reimplemented from FormatterListener.

virtual void FormatterToXMLBase::startElement ( | const XMLCh *const name,
| AttributeListType & attrs )`[pure virtual]`

Reimplemented from FormatterListener.

Reimplemented in FormatterToXML_UTF16, and FormatterToXML_UTF8.

void FormatterToXMLBase::throwInvalidCharacterException ( | unsigned int ch )`[static, protected]`

Throw an exception when an invalid character is encountered.

Parameters:

  ch | The first character in the surrogate
  next | The next character in the surrogate

void FormatterToXMLBase::throwInvalidUTF16SurrogateException ( | XalanDOMChar ch,
| XalanDOMChar next )`[static, protected]`

Throw an exception when an invalid surrogate is encountered.

Parameters:

  ch | The first character in the surrogate
  next | The next character in the surrogate

void FormatterToXMLBase::throwInvalidUTF16SurrogateException ( | XalanDOMChar ch )`[static, protected]`

Throw an exception when an invalid surrogate is encountered.

Parameters:

  ch | The first character in the surrogate

virtual void FormatterToXMLBase::writeCDATA ( | const XMLCh * chars,
| unsigned int length )`[protected, pure virtual]`

Reimplemented in FormatterToXML_UTF16, and FormatterToXML_UTF8.

virtual void FormatterToXMLBase::writeCharacters ( | const XMLCh * chars,
| unsigned int length )`[protected, pure virtual]`

Reimplemented in FormatterToXML_UTF16, and FormatterToXML_UTF8.

virtual void FormatterToXMLBase::writeDoctypeDecl ( | const XalanDOMChar * name )`[protected, pure virtual]`

Reimplemented in FormatterToXML_UTF16, and FormatterToXML_UTF8.

virtual void FormatterToXMLBase::writeProcessingInstruction ( | const XMLCh * target,
| const XMLCh * data )`[protected, pure virtual]`

Reimplemented in FormatterToXML_UTF16, and FormatterToXML_UTF8.

virtual void FormatterToXMLBase::writeXMLHeader ( | )`[protected, pure virtual]`

Reimplemented in FormatterToXML_UTF16, and FormatterToXML_UTF8.

## Member Data Documentation

const XalanDOMString FormatterToXMLBase::m_doctypePublic`[protected]`

The public ID for the doc type.

const XalanDOMString FormatterToXMLBase::m_doctypeSystem`[protected]`

The System ID for the doc type.

const XalanDOMString FormatterToXMLBase::m_mediaType`[protected]`

The media type.

Not used right now.

const XalanDOMChar * FormatterToXMLBase::m_newlineString`[protected]`

The string of characters that represents the newline.

XalanDOMString::size_type FormatterToXMLBase::m_newlineStringLength`[protected]`

The length of the the string of characters that represents the newline.

bool FormatterToXMLBase::m_nextIsRaw`[protected]`

Tell if the next text should be raw.

bool FormatterToXMLBase::m_spaceBeforeClose`[protected]`

Add space before '/>' for XHTML.

const XalanDOMString FormatterToXMLBase::m_standalone`[protected]`

Text for standalone part of header.

const XalanDOMString FormatterToXMLBase::m_version`[protected]`

Tells the XML version, for writing out to the XML decl.

Writer * FormatterToXMLBase::m_writer`[protected]`

The writer.

const XalanDOMChar FormatterToXMLBase::s_specialChars[]`[static, protected]`

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

- FormatterToXMLBase.hpp

Interpreting class diagrams

Doxygen and GraphViz are used to generate this API documentation from the Xalan-C header files.

Xalan-C++ XSLT Processor Version 1.7 Copyright © 1999-2004 The Apache Software Foundation. All Rights Reserved.