Xalan-C++ API Reference 1.12.0
xalanc::XalanXMLSerializerBase Class Referenceabstract

XalanXMLSerializerBase serves as a base class for XML serializers based on FormatterListener events. More...

#include <xalanc/XMLSupport/XalanXMLSerializerBase.hpp>

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

Classes

class  CharFunctor1_0
class  CharFunctor1_1
class  UTF16
class  UTF8

Public Types

enum  { eBufferSize = 512 }
enum  {
  eNone = 0u , eAttr = 1u , eBoth = 2u , eForb = 4u ,
  eCRFb = 5u
}
typedef XalanVector< bool > BoolStackType
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

 XalanXMLSerializerBase (MemoryManager &theManager, eXMLVersion theXMLVersion, const XalanDOMString &theEncoding, const XalanDOMString &theDoctypeSystem, const XalanDOMString &theDoctypePublic, bool xmlDecl, const XalanDOMString &theStandalone)
 Constructor.
virtual ~XalanXMLSerializerBase ()
MemoryManager & getMemoryManager ()
virtual void setDocumentLocator (const Locator *const locator)
virtual void startDocument ()
virtual void startElement (const XMLCh *const name, AttributeList &attrs)=0
virtual void endElement (const XMLCh *const name)=0
virtual void characters (const XMLCh *const chars, const size_type length)
virtual void charactersRaw (const XMLCh *const chars, const size_type length)=0
virtual void entityReference (const XMLCh *const name)=0
 Receive notification of a entityReference.
virtual void ignorableWhitespace (const XMLCh *const chars, const size_type 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.
virtual void cdata (const XMLCh *const ch, const size_type length)
virtual const XalanDOMStringgetDoctypeSystem () const
virtual const XalanDOMStringgetDoctypePublic () const
virtual const XalanDOMStringgetEncoding () const
const XalanDOMStringgetVersion () const
const XalanDOMStringgetStandalone () const
bool getShouldWriteXMLHeader () const
void setShouldWriteXMLHeader (bool b)
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 endDocument ()=0
virtual void ignorableWhitespace (const XMLCh *const chars, const size_type length)=0
virtual WritergetWriter () const
virtual const XalanDOMStringgetMediaType () const
virtual int getIndent () const

Static Public Member Functions

static void initialize (MemoryManager &theManager)
 Perform static initialization.
static void terminate ()
 Perform static shut down.

Static Public Attributes

static const XalanDOMStrings_1_0String
static const XalanDOMStrings_1_1String
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 Member Functions

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, size_type length)=0
virtual void writeCDATA (const XMLCh *chars, size_type length)=0
virtual void outputNewline ()=0
bool markParentForChildren ()
 Mark the parent element as having a child.
bool getNeedToOutputDoctypeDecl () const
 Determine if it a DOCTYPE declaration needs to be written.
void openElementForChildren ()
 Open an element for possibile children.
bool outsideDocumentElement () const
bool childNodesWereAdded ()
 Determine if an element ever had any children added.
void generateDoctypeDecl (const XalanDOMChar *name)
Protected Member Functions inherited from xalanc::FormatterListener
void setXMLVersion (eXMLVersion theVersion)
 Set the output version during serializing.

Static Protected Member Functions

static bool isUTF16HighSurrogate (XalanDOMChar theChar)
static bool isUTF16LowSurrogate (XalanDOMChar theChar)
static XalanUnicodeChar decodeUTF16SurrogatePair (XalanDOMChar theHighSurrogate, XalanDOMChar theLowSurrogate, MemoryManager &theManager)
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 character is encountered.
static void throwInvalidXMLCharacterException (XalanUnicodeChar ch, const XalanDOMString &theXMLversion, MemoryManager &theManager)
 Throw an exception when an invalid character for the specific XML version is encountered.

Protected Attributes

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 XalanDOMStringm_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_encoding
Protected Attributes inherited from xalanc::FormatterListener
const PrefixResolverm_prefixResolver

Additional Inherited Members

Static Protected Attributes inherited from xalanc::FormatterListener
static const XalanDOMString s_emptyString

Detailed Description

XalanXMLSerializerBase serves as a base class for XML serializers based on FormatterListener events.

Definition at line 58 of file XalanXMLSerializerBase.hpp.

Member Typedef Documentation

◆ BoolStackType

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
eBufferSize 

Definition at line 430 of file XalanXMLSerializerBase.hpp.

◆ anonymous enum

anonymous enum
Enumerator
eNone 
eAttr 
eBoth 
eForb 
eCRFb 

Definition at line 542 of file XalanXMLSerializerBase.hpp.

Constructor & Destructor Documentation

◆ XalanXMLSerializerBase()

xalanc::XalanXMLSerializerBase::XalanXMLSerializerBase ( MemoryManager & theManager,
eXMLVersion theXMLVersion,
const XalanDOMString & theEncoding,
const XalanDOMString & theDoctypeSystem,
const XalanDOMString & theDoctypePublic,
bool xmlDecl,
const XalanDOMString & theStandalone )

Constructor.

Parameters
theManagerThe MemoryManager instance to use for any memory allocations
doctypeSystemsystem identifier to be used in the document type declaration
doctypePublicpublic identifier to be used in the document type declaration
xmlDecltrue if the XSLT processor should output an XML declaration
theStandaloneThe string the XSLT processor should output for the standalone document declaration

Referenced by xalanc::FormatterToXMLUnicode< UnicodeWriter, ConstantsType, CharPredicate, IndentHandler, XMLVersion >::FormatterToXMLUnicode(), and throwInvalidXMLCharacterException().

◆ ~XalanXMLSerializerBase()

virtual xalanc::XalanXMLSerializerBase::~XalanXMLSerializerBase ( )
virtual

Member Function Documentation

◆ cdata()

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

References xalanc::length().

◆ characters()

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

References xalanc::length().

◆ charactersRaw()

virtual void xalanc::XalanXMLSerializerBase::charactersRaw ( const XMLCh *const chars,
const size_type length )
pure virtual

◆ childNodesWereAdded()

bool xalanc::XalanXMLSerializerBase::childNodesWereAdded ( )
inlineprotected

Determine if an element ever had any children added.

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

Definition at line 640 of file XalanXMLSerializerBase.hpp.

Referenced by xalanc::FormatterToXMLUnicode< UnicodeWriter, ConstantsType, CharPredicate, IndentHandler, XMLVersion >::endElement().

◆ comment()

virtual void xalanc::XalanXMLSerializerBase::comment ( const XMLCh *const data)
pure virtual

Called when a Comment is to be constructed.

Parameters
datapointer to comment data
Exceptions
SAXException

Implements xalanc::FormatterListener.

Implemented in xalanc::FormatterToXMLUnicode< UnicodeWriter, ConstantsType, CharPredicate, IndentHandler, XMLVersion >.

◆ decodeUTF16SurrogatePair()

XalanUnicodeChar xalanc::XalanXMLSerializerBase::decodeUTF16SurrogatePair ( XalanDOMChar theHighSurrogate,
XalanDOMChar theLowSurrogate,
MemoryManager & theManager )
staticprotected

◆ endElement()

virtual void xalanc::XalanXMLSerializerBase::endElement ( const XMLCh *const name)
pure virtual

◆ entityReference()

virtual void xalanc::XalanXMLSerializerBase::entityReference ( const XMLCh *const name)
pure virtual

Receive notification of a entityReference.

Parameters
datapointer to characters from the XML document
Exceptions
SAXException

Implements xalanc::FormatterListener.

Implemented in xalanc::FormatterToXMLUnicode< UnicodeWriter, ConstantsType, CharPredicate, IndentHandler, XMLVersion >.

◆ flushBuffer()

virtual void xalanc::XalanXMLSerializerBase::flushBuffer ( )
protectedpure virtual

◆ generateDoctypeDecl()

void xalanc::XalanXMLSerializerBase::generateDoctypeDecl ( const XalanDOMChar * name)
inlineprotected

◆ getDoctypePublic()

virtual const XalanDOMString & xalanc::XalanXMLSerializerBase::getDoctypePublic ( ) const
virtual

Reimplemented from xalanc::FormatterListener.

◆ getDoctypeSystem()

virtual const XalanDOMString & xalanc::XalanXMLSerializerBase::getDoctypeSystem ( ) const
virtual

Reimplemented from xalanc::FormatterListener.

◆ getEncoding()

virtual const XalanDOMString & xalanc::XalanXMLSerializerBase::getEncoding ( ) const
virtual

Reimplemented from xalanc::FormatterListener.

◆ getMemoryManager()

◆ getNeedToOutputDoctypeDecl()

bool xalanc::XalanXMLSerializerBase::getNeedToOutputDoctypeDecl ( ) const
inlineprotected

Determine if it a DOCTYPE declaration needs to be written.

Definition at line 614 of file XalanXMLSerializerBase.hpp.

Referenced by xalanc::FormatterToXMLUnicode< UnicodeWriter, ConstantsType, CharPredicate, IndentHandler, XMLVersion >::writeXMLHeader().

◆ getShouldWriteXMLHeader()

bool xalanc::XalanXMLSerializerBase::getShouldWriteXMLHeader ( ) const
inline

Definition at line 180 of file XalanXMLSerializerBase.hpp.

◆ getStandalone()

const XalanDOMString & xalanc::XalanXMLSerializerBase::getStandalone ( ) const
inline

Definition at line 174 of file XalanXMLSerializerBase.hpp.

References m_standalone.

◆ getVersion()

const XalanDOMString & xalanc::XalanXMLSerializerBase::getVersion ( ) const
inline

Definition at line 168 of file XalanXMLSerializerBase.hpp.

References m_version.

◆ ignorableWhitespace()

virtual void xalanc::XalanXMLSerializerBase::ignorableWhitespace ( const XMLCh *const chars,
const size_type length )
virtual

References xalanc::length().

◆ initialize()

void xalanc::XalanXMLSerializerBase::initialize ( MemoryManager & theManager)
static

Perform static initialization.

See class XMLSupportInit.

◆ isUTF16HighSurrogate()

bool xalanc::XalanXMLSerializerBase::isUTF16HighSurrogate ( XalanDOMChar theChar)
inlinestaticprotected

Definition at line 700 of file XalanXMLSerializerBase.hpp.

◆ isUTF16LowSurrogate()

bool xalanc::XalanXMLSerializerBase::isUTF16LowSurrogate ( XalanDOMChar theChar)
inlinestaticprotected

Definition at line 706 of file XalanXMLSerializerBase.hpp.

◆ markParentForChildren()

bool xalanc::XalanXMLSerializerBase::markParentForChildren ( )
inlineprotected

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.

Definition at line 593 of file XalanXMLSerializerBase.hpp.

Referenced by xalanc::FormatterToXMLUnicode< UnicodeWriter, ConstantsType, CharPredicate, IndentHandler, XMLVersion >::writeParentTagEnd().

◆ openElementForChildren()

void xalanc::XalanXMLSerializerBase::openElementForChildren ( )
inlineprotected

◆ outputNewline()

virtual void xalanc::XalanXMLSerializerBase::outputNewline ( )
protectedpure virtual

◆ outsideDocumentElement()

bool xalanc::XalanXMLSerializerBase::outsideDocumentElement ( ) const
inlineprotected

Definition at line 629 of file XalanXMLSerializerBase.hpp.

◆ processingInstruction()

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

◆ resetDocument()

virtual void xalanc::XalanXMLSerializerBase::resetDocument ( )
virtual

◆ setDocumentLocator()

virtual void xalanc::XalanXMLSerializerBase::setDocumentLocator ( const Locator *const locator)
virtual

◆ setShouldWriteXMLHeader()

void xalanc::XalanXMLSerializerBase::setShouldWriteXMLHeader ( bool b)
inline

Definition at line 186 of file XalanXMLSerializerBase.hpp.

◆ startDocument()

virtual void xalanc::XalanXMLSerializerBase::startDocument ( )
virtual

◆ startElement()

virtual void xalanc::XalanXMLSerializerBase::startElement ( const XMLCh *const name,
AttributeList & attrs )
pure virtual

◆ terminate()

void xalanc::XalanXMLSerializerBase::terminate ( )
static

Perform static shut down.

See class XMLSupportInit.

◆ throwInvalidCharacterException()

void xalanc::XalanXMLSerializerBase::throwInvalidCharacterException ( XalanUnicodeChar ch,
MemoryManager & theManager )
staticprotected

Throw an exception when an invalid character is encountered.

Parameters
chThe first character in the surrogate
nextThe next character in the surrogate

◆ throwInvalidUTF16SurrogateException() [1/2]

void xalanc::XalanXMLSerializerBase::throwInvalidUTF16SurrogateException ( XalanDOMChar ch,
MemoryManager & theManager )
staticprotected

Throw an exception when an invalid surrogate is encountered.

Parameters
chThe first character in the surrogate

◆ throwInvalidUTF16SurrogateException() [2/2]

void xalanc::XalanXMLSerializerBase::throwInvalidUTF16SurrogateException ( XalanDOMChar ch,
XalanDOMChar next,
MemoryManager & theManager )
staticprotected

Throw an exception when an invalid surrogate is encountered.

Parameters
chThe first character in the surrogate
nextThe next character in the surrogate

◆ throwInvalidXMLCharacterException()

void xalanc::XalanXMLSerializerBase::throwInvalidXMLCharacterException ( XalanUnicodeChar ch,
const XalanDOMString & theXMLversion,
MemoryManager & theManager )
staticprotected

◆ writeCDATA()

virtual void xalanc::XalanXMLSerializerBase::writeCDATA ( const XMLCh * chars,
size_type length )
protectedpure virtual

◆ writeCharacters()

virtual void xalanc::XalanXMLSerializerBase::writeCharacters ( const XMLCh * chars,
size_type length )
protectedpure virtual

◆ writeDoctypeDecl()

virtual void xalanc::XalanXMLSerializerBase::writeDoctypeDecl ( const XalanDOMChar * name)
protectedpure virtual

◆ writeProcessingInstruction()

virtual void xalanc::XalanXMLSerializerBase::writeProcessingInstruction ( const XMLCh * target,
const XMLCh * data )
protectedpure virtual

◆ writeXMLHeader()

virtual void xalanc::XalanXMLSerializerBase::writeXMLHeader ( )
protectedpure virtual

Member Data Documentation

◆ m_doctypePublic

const XalanDOMString xalanc::XalanXMLSerializerBase::m_doctypePublic
protected

◆ m_doctypeSystem

const XalanDOMString xalanc::XalanXMLSerializerBase::m_doctypeSystem
protected

◆ m_encoding

◆ m_nextIsRaw

bool xalanc::XalanXMLSerializerBase::m_nextIsRaw
protected

Tell if the next text should be raw.

Definition at line 670 of file XalanXMLSerializerBase.hpp.

◆ m_spaceBeforeClose

bool xalanc::XalanXMLSerializerBase::m_spaceBeforeClose
protected

◆ m_standalone

const XalanDOMString xalanc::XalanXMLSerializerBase::m_standalone
protected

◆ m_version

◆ s_1_0String

const XalanDOMString& xalanc::XalanXMLSerializerBase::s_1_0String
static

Definition at line 194 of file XalanXMLSerializerBase.hpp.

◆ s_1_1String

const XalanDOMString& xalanc::XalanXMLSerializerBase::s_1_1String
static

Definition at line 196 of file XalanXMLSerializerBase.hpp.


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