Xalan-C++ API Reference 1.12.0
xalanc::FormatterToHTML Class Reference

FormatterToHTML formats SAX-style events into HTML. More...

#include <xalanc/XMLSupport/FormatterToHTML.hpp>

Inheritance diagram for xalanc::FormatterToHTML:
[legend]
Collaboration diagram for xalanc::FormatterToHTML:
[legend]

Classes

struct  Entity

Public Types

enum  { eDefaultIndentAmount = 0 }
typedef XalanVector< XalanHTMLElementsProperties::ElementPropertiesElementPropertiesStackType
Public Types inherited from xalanc::FormatterToXML
enum  eDummy { eDefaultIndentAmount = 0 }
typedef XalanVector< bool > BoolStackType
typedef XalanVector< XalanDOMChar > DOMCharBufferType
typedef XalanVector< char > ByteBufferType
Public Types inherited from xalanc::FormatterListener
enum  eFormat {
  OUTPUT_METHOD_NONE = 0 , OUTPUT_METHOD_XML = 1 , OUTPUT_METHOD_HTML = 2 , OUTPUT_METHOD_TEXT = 3 ,
  OUTPUT_METHOD_DOM = 4 , OUTPUT_METHOD_OTHER = 5
}
enum  eXMLVersion { XML_VERSION_1_0 = 0 , XML_VERSION_1_1 = 1 }
typedef xercesc::DocumentHandler ParentType
typedef XalanSize_t size_type

Public Member Functions

 FormatterToHTML (Writer &writer, const XalanDOMString &encoding=XalanDOMString(XalanMemMgrs::getDummyMemMgr()), const XalanDOMString &mediaType=XalanDOMString(XalanMemMgrs::getDummyMemMgr()), const XalanDOMString &doctypeSystem=XalanDOMString(XalanMemMgrs::getDummyMemMgr()), const XalanDOMString &doctypePublic=XalanDOMString(XalanMemMgrs::getDummyMemMgr()), bool doIndent=true, int indent=eDefaultIndentAmount, bool escapeURLs=true, bool omitMetaTag=false, MemoryManager &theManager XALAN_DEFAULT_MEMMGR)
 Constructor for customized encoding and doctype.
virtual ~FormatterToHTML ()
virtual void startDocument ()
virtual void endDocument ()
virtual void startElement (const XMLCh *const name, AttributeListType &attrs)
virtual void endElement (const XMLCh *const name)
virtual void characters (const XMLCh *const chars, const size_type length)
virtual bool accumDefaultEntity (XalanDOMChar ch, bool escLF)
 Handle one of the default entities, return false if it is not a default entity.
virtual void entityReference (const XMLCh *const name)
 Receive notification of a entityReference.
virtual void cdata (const XMLCh *const ch, const size_type length)
virtual void processingInstruction (const XMLCh *const target, const XMLCh *const data)
bool getEscapeURLs () const
void setEscapeURLs (bool flag)
Public Member Functions inherited from xalanc::FormatterToXML
 FormatterToXML (Writer &writer, const XalanDOMString &version=XalanDOMString(XalanMemMgrs::getDummyMemMgr()), bool doIndent=false, int indent=eDefaultIndentAmount, const XalanDOMString &encoding=XalanDOMString(XalanMemMgrs::getDummyMemMgr()), const XalanDOMString &mediaType=XalanDOMString(XalanMemMgrs::getDummyMemMgr()), const XalanDOMString &doctypeSystem=XalanDOMString(XalanMemMgrs::getDummyMemMgr()), const XalanDOMString &doctypePublic=XalanDOMString(XalanMemMgrs::getDummyMemMgr()), bool xmlDecl=true, const XalanDOMString &standalone=XalanDOMString(XalanMemMgrs::getDummyMemMgr()), eFormat format=OUTPUT_METHOD_XML, bool fBufferData=true, MemoryManager &theManager XALAN_DEFAULT_MEMMGR)
 Constructor for customized encoding and doctype.
virtual ~FormatterToXML ()
MemoryManager & getMemoryManager ()
virtual void setDocumentLocator (const Locator *const locator)
virtual void charactersRaw (const XMLCh *const chars, const size_type length)
virtual void ignorableWhitespace (const XMLCh *const chars, const size_type length)
virtual void resetDocument ()
virtual void comment (const XMLCh *const data)
 Called when a Comment is to be constructed.
virtual WritergetWriter () const
virtual const XalanDOMStringgetDoctypeSystem () const
virtual const XalanDOMStringgetDoctypePublic () const
virtual const XalanDOMStringgetEncoding () const
virtual const XalanDOMStringgetMediaType () const
virtual int getIndent () const
const XalanDOMStringgetVersion () const
const XalanDOMStringgetStandalone () const
bool getShouldWriteXMLHeader () const
void setShouldWriteXMLHeader (bool b)
bool getStripCData () const
void setStripCData (bool b)
bool getEscapeCData () const
void setEscapeCData (bool b)
bool getDoIndent () const
void setDoIndent (bool value)
void setIndent (int value)
Public Member Functions inherited from xalanc::FormatterListener
 FormatterListener (eFormat theFormat)
virtual ~FormatterListener ()
eFormat getOutputFormat () const
 Get the output format for the instance.
eXMLVersion getXMLVersion () const
 Get the version of XML the FormatterListener is generating.
bool isXML1_1Version () const
 Determine if the version of XML output is 1.1.
const PrefixResolvergetPrefixResolver () const
 Get the PrefixResolver for the FormatterListener.
void setPrefixResolver (const PrefixResolver *thePrefixResolver)
 Set the PrefixResolver for the FormatterListener.
virtual void charactersRaw (const XMLCh *const chars, const size_type length)=0
 Receive notification of character data.
virtual void cdata (const XMLCh *const ch, const size_type length)=0
 Receive notification of cdata.
virtual void characters (const XMLCh *const chars, const size_type length)=0
virtual void ignorableWhitespace (const XMLCh *const chars, const size_type length)=0

Static Public Member Functions

static FormatterToHTMLcreate (MemoryManager &theManager, Writer &writer, const XalanDOMString &encoding, const XalanDOMString &mediaType, const XalanDOMString &doctypeSystem, const XalanDOMString &doctypePublic, bool doIndent, int indent, bool escapeURLs, bool omitMetaTag)
Static Public Member Functions inherited from xalanc::FormatterToXML
static FormatterToXMLcreate (MemoryManager &theManager, Writer &writer, const XalanDOMString &version=XalanDOMString(XalanMemMgrs::getDummyMemMgr()), bool doIndent=false, int indent=eDefaultIndentAmount, const XalanDOMString &encoding=XalanDOMString(XalanMemMgrs::getDummyMemMgr()), const XalanDOMString &mediaType=XalanDOMString(XalanMemMgrs::getDummyMemMgr()), const XalanDOMString &doctypeSystem=XalanDOMString(XalanMemMgrs::getDummyMemMgr()), const XalanDOMString &doctypePublic=XalanDOMString(XalanMemMgrs::getDummyMemMgr()), bool xmlDecl=true, const XalanDOMString &standalone=XalanDOMString(XalanMemMgrs::getDummyMemMgr()), eFormat format=OUTPUT_METHOD_XML, bool fBufferData=true)

Protected Member Functions

virtual void writeAttrString (const XalanDOMChar *theString, size_type theStringLength)
 Write an attribute string.
virtual void accumCommentData (const XalanDOMChar *data)
 Write the data for a comment.
void writeCharacters (const XalanDOMString &theString)
void writeCharacters (const XalanDOMChar *theString, size_type theLength)
Protected Member Functions inherited from xalanc::FormatterToXML
void outputLineSep ()
 Output a line break.
void accumName (XalanDOMChar ch)
 Append a wide character to the buffer.
void accumContent (XalanDOMChar ch)
 Append a wide character to the buffer.
void accumName (const XalanDOMChar *chars)
 Append a null-terminated array of wide characters to the buffer.
void accumContent (const XalanDOMChar *chars)
 Append a null-terminated array of wide characters to the buffer.
void accumName (const XalanDOMChar chars[], size_type start, size_type length)
 Append an array of wide character to the buffer.
void accumContent (const XalanDOMChar chars[], size_type start, size_type length)
 Append an array of wide character to the buffer.
void accumName (const XalanDOMString &str)
 Append a string to the buffer.
void accumContent (const XalanDOMString &str)
 Append a string to the buffer.
size_type accumDefaultEscape (XalanDOMChar ch, size_type i, const XalanDOMChar chars[], size_type len, bool escLF)
 Escape and accum a character.
void initAttrCharsMap ()
 Set the attribute characters what will require special mapping.
void initCharsMap ()
 Set the output characters what will require special mapping.
void flushChars ()
 Flush the char buffer.
void flushBytes ()
 Flush the byte buffer.
void flushWriter ()
void openElementForChildren ()
bool childNodesWereAdded ()
bool shouldIndent () const
void writeParentTagEnd ()
 Check to see if a parent's ">" has been written, and, if it has not, write it.
void indent (int n)
 Prints a newline character and n spaces.
virtual void writeNormalizedChars (const XalanDOMChar ch[], size_type start, size_type length, bool isCData)
 Write normalized characters to the writer.
void writeNumberedEntityReference (XalanUnicodeChar theNumber)
 Write a number into the buffer as an entity reference.
Protected Member Functions inherited from xalanc::FormatterListener
void setXMLVersion (eXMLVersion theVersion)
 Set the output version during serializing.

Additional Inherited Members

Static Public Attributes inherited from xalanc::FormatterListener
static const XalanDOMChar s_piTarget []
static const XalanDOMChar s_piData []
static const XalanDOMString::size_type s_piTargetLength
static const XalanDOMString::size_type s_piDataLength
Protected Types inherited from xalanc::FormatterToXML
enum  eDummyTwo { SPECIALSSIZE = 256 }
typedef void(FormatterToXML::* AccumCharFunctionType) (XalanDOMChar)
typedef void(FormatterToXML::* AccumStringFunctionType) (const XalanDOMChar *)
typedef void(FormatterToXML::* AccumDOMStringFunctionType) (const XalanDOMString &)
typedef void(FormatterToXML::* AccumArrayFunctionType) (const XalanDOMChar[], size_type, size_type)
typedef void(FormatterToXML::* FlushFunctionType) ()
Static Protected Member Functions inherited from xalanc::FormatterToXML
static void throwInvalidUTF16SurrogateException (XalanDOMChar ch, MemoryManager &theManager)
 Throw an exception when an invalid surrogate is encountered.
static void throwInvalidUTF16SurrogateException (XalanDOMChar ch, XalanDOMChar next, MemoryManager &theManager)
 Throw an exception when an invalid surrogate is encountered.
static void throwInvalidCharacterException (XalanUnicodeChar ch, MemoryManager &theManager)
 Throw an exception when an invalid XML character is encountered.
static bool isUTF16Surrogate (XalanDOMChar ch)
Protected Attributes inherited from xalanc::FormatterToXML
Writer *const m_writer
 The writer where the XML will be written.
XalanOutputStream *const m_stream
 The stream where the XML will be written.
XalanDOMChar m_maxCharacter
 The maximum character size before we have to resort to escaping.
XalanDOMChar m_attrCharsMap [SPECIALSSIZE]
XalanDOMChar m_charsMap [SPECIALSSIZE]
bool m_shouldWriteXMLHeader
 If true, XML header should be written to output.
bool m_ispreserve
 State flag to tell if preservation of whitespace is important.
bool m_doIndent
 Flag to tell if indenting (pretty-printing) is on.
bool m_startNewLine
 Flag to signal that a newline should be added.
bool m_needToOutputDocTypeDecl
 Flag to tell that we need to add the doctype decl, which we can't do until the first element is encountered.
bool m_isprevtext
 State flag that tells if the previous node processed was text, so we can tell if we should preserve whitespace.
bool m_stripCData
 If true, cdata sections are simply stripped of their CDATA brackets, without escaping.
bool m_nextIsRaw
 Tell if the next text should be raw.
bool m_inCData
 Tells if we're in CData section.
bool m_encodingIsUTF
 Flag to quickly tell if the encoding is capable of full Unicode support.
const XalanDOMString m_doctypeSystem
 The System ID for the doc type.
const XalanDOMString m_doctypePublic
 The public ID for the doc type.
XalanDOMString m_encoding
 The character encoding.
int m_currentIndent
 Flag to keep track of the indent amount.
int m_indent
 Amount to indent.
BoolStackType m_preserves
 Stack to keep track of whether or not we need to preserve whitespace.
XalanDOMString m_stringBuffer
Protected Attributes inherited from xalanc::FormatterListener
const PrefixResolverm_prefixResolver
Static Protected Attributes inherited from xalanc::FormatterListener
static const XalanDOMString s_emptyString

Detailed Description

FormatterToHTML formats SAX-style events into HTML.

Definition at line 52 of file FormatterToHTML.hpp.

Member Typedef Documentation

◆ ElementPropertiesStackType

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
eDefaultIndentAmount 

Definition at line 61 of file FormatterToHTML.hpp.

Constructor & Destructor Documentation

◆ FormatterToHTML()

xalanc::FormatterToHTML::FormatterToHTML ( Writer & writer,
const XalanDOMString & encoding = XalanDOMString(XalanMemMgrs::getDummyMemMgr()),
const XalanDOMString & mediaType = XalanDOMString(XalanMemMgrs::getDummyMemMgr()),
const XalanDOMString & doctypeSystem = XalanDOMString(XalanMemMgrs::getDummyMemMgr()),
const XalanDOMString & doctypePublic = XalanDOMString(XalanMemMgrs::getDummyMemMgr()),
bool doIndent = true,
int indent = eDefaultIndentAmount,
bool escapeURLs = true,
bool omitMetaTag = false,
MemoryManager &theManager XALAN_DEFAULT_MEMMGR )

Constructor for customized encoding and doctype.

Parameters
writerThe character output stream to use.
encodingThe character encoding in use by writer.
doctypeSystemThe system ID for the DOCTYPE.
doctypePublicThe public ID for the DOCTYPE.
doIndenttrue if indenting should be enabled
indentNumber of spaces to indent at each nesting level.
escapeURLsWhether or not to escape URLs according to the recommendation. The default is true.
omitMetaTagWhether or not to output a META TAG according to the recommendation. The default is false.

References eDefaultIndentAmount, FormatterToHTML(), xalanc::XalanMemMgrs::getDummyMemMgr(), xalanc::FormatterToXML::indent(), and XALAN_DEFAULT_MEMMGR.

Referenced by FormatterToHTML().

◆ ~FormatterToHTML()

virtual xalanc::FormatterToHTML::~FormatterToHTML ( )
virtual

Member Function Documentation

◆ accumCommentData()

virtual void xalanc::FormatterToHTML::accumCommentData ( const XalanDOMChar * data)
protectedvirtual

Write the data for a comment.

Parameters
dataThe comment's data.

Reimplemented from xalanc::FormatterToXML.

◆ accumDefaultEntity()

virtual bool xalanc::FormatterToHTML::accumDefaultEntity ( XalanDOMChar ch,
bool escLF )
virtual

Handle one of the default entities, return false if it is not a default entity.

Reimplemented from xalanc::FormatterToXML.

◆ cdata()

virtual void xalanc::FormatterToHTML::cdata ( const XMLCh *const ch,
const size_type length )
virtual

Reimplemented from xalanc::FormatterToXML.

References xalanc::length().

◆ characters()

virtual void xalanc::FormatterToHTML::characters ( const XMLCh *const chars,
const size_type length )
virtual

Reimplemented from xalanc::FormatterToXML.

References xalanc::length().

◆ create()

FormatterToHTML * xalanc::FormatterToHTML::create ( MemoryManager & theManager,
Writer & writer,
const XalanDOMString & encoding,
const XalanDOMString & mediaType,
const XalanDOMString & doctypeSystem,
const XalanDOMString & doctypePublic,
bool doIndent,
int indent,
bool escapeURLs,
bool omitMetaTag )
static

◆ endDocument()

virtual void xalanc::FormatterToHTML::endDocument ( )
virtual

Reimplemented from xalanc::FormatterToXML.

◆ endElement()

virtual void xalanc::FormatterToHTML::endElement ( const XMLCh *const name)
virtual

Reimplemented from xalanc::FormatterToXML.

◆ entityReference()

virtual void xalanc::FormatterToHTML::entityReference ( const XMLCh *const name)
virtual

Receive notification of a entityReference.

Parameters
datapointer to characters from the XML document
Exceptions
SAXException

Reimplemented from xalanc::FormatterToXML.

◆ getEscapeURLs()

bool xalanc::FormatterToHTML::getEscapeURLs ( ) const
inline

Definition at line 149 of file FormatterToHTML.hpp.

◆ processingInstruction()

virtual void xalanc::FormatterToHTML::processingInstruction ( const XMLCh *const target,
const XMLCh *const data )
virtual

Reimplemented from xalanc::FormatterToXML.

◆ setEscapeURLs()

void xalanc::FormatterToHTML::setEscapeURLs ( bool flag)
inline

Definition at line 155 of file FormatterToHTML.hpp.

◆ startDocument()

virtual void xalanc::FormatterToHTML::startDocument ( )
virtual

Reimplemented from xalanc::FormatterToXML.

◆ startElement()

virtual void xalanc::FormatterToHTML::startElement ( const XMLCh *const name,
AttributeListType & attrs )
virtual

Reimplemented from xalanc::FormatterToXML.

◆ writeAttrString()

virtual void xalanc::FormatterToHTML::writeAttrString ( const XalanDOMChar * theString,
size_type theStringLength )
protectedvirtual

Write an attribute string.

Parameters
theStringThe string to write.
theStringLengthThe length of the string.

Reimplemented from xalanc::FormatterToXML.

◆ writeCharacters() [1/2]

void xalanc::FormatterToHTML::writeCharacters ( const XalanDOMChar * theString,
size_type theLength )
protected

◆ writeCharacters() [2/2]

void xalanc::FormatterToHTML::writeCharacters ( const XalanDOMString & theString)
protected

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