Xalan-C++ API Documentation

The Xalan C++ XSLT Processor Version 1.10

Classes | Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
XalanXMLSerializerBase Class Referenceabstract

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

Inheritance diagram for XalanXMLSerializerBase:
FormatterListener FormatterToXMLUnicode< UnicodeWriter, ConstantsType, CharPredicate, IndentHandler, XMLVersion >

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 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
XERCES_CPP_NAMESPACE_QUALIFIER
DocumentHandler 
ParentType
 
typedef unsigned int 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. More...
 
virtual ~XalanXMLSerializerBase ()
 
MemoryManagerTypegetMemoryManager ()
 
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 unsigned int length)
 
virtual void charactersRaw (const XMLCh *const chars, const unsigned int length)=0
 Receive notification of character data. More...
 
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)
 Receive notification of cdata. More...
 
virtual const XalanDOMStringgetDoctypeSystem () const
 
virtual const XalanDOMStringgetDoctypePublic () const
 
virtual const XalanDOMStringgetEncoding () const =0
 
const XalanDOMStringgetVersion () const
 
const XalanDOMStringgetStandalone () const
 
bool getShouldWriteXMLHeader () const
 
void setShouldWriteXMLHeader (bool b)
 
- Public Member Functions inherited from FormatterListener
 FormatterListener (eFormat theFormat)
 
virtual ~FormatterListener ()
 
eFormat getOutputFormat () const
 Get the output format for the instance. More...
 
eXMLVersion getXMLVersion () const
 Get the version of XML the FormatterListener is generating. More...
 
bool isXML1_1Version () const
 Determine if the version of XML output is 1.1. More...
 
const PrefixResolvergetPrefixResolver () const
 Get the PrefixResolver for the FormatterListener. More...
 
void setPrefixResolver (const PrefixResolver *thePrefixResolver)
 Set the PrefixResolver for the FormatterListener. More...
 
virtual void endDocument ()=0
 
virtual WritergetWriter () const
 
virtual const XalanDOMStringgetMediaType () const
 
virtual int getIndent () const
 

Static Public Member Functions

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

Static Public Attributes

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

Static Protected Member Functions

static bool isUTF16HighSurrogate (XalanDOMChar theChar)
 
static bool isUTF16LowSurrogate (XalanDOMChar theChar)
 
static unsigned int decodeUTF16SurrogatePair (XalanDOMChar theHighSurrogate, XalanDOMChar theLowSurrogate, MemoryManager &theManager)
 
static void throwInvalidUTF16SurrogateException (XalanDOMChar ch, MemoryManager &theManager)
 Throw an exception when an invalid surrogate is encountered. More...
 
static void throwInvalidUTF16SurrogateException (XalanDOMChar ch, XalanDOMChar next, MemoryManager &theManager)
 Throw an exception when an invalid surrogate is encountered. More...
 
static void throwInvalidCharacterException (unsigned int ch, MemoryManager &theManager)
 Throw an exception when an invalid character is encountered. More...
 
static void throwInvalidXMLCharacterException (unsigned int ch, const XalanDOMString &theXMLversion, MemoryManager &theManager)
 Throw an exception when an invalid character for the specific XML version is encountered. More...
 

Protected Attributes

bool m_nextIsRaw
 Tell if the next text should be raw. More...
 
bool m_spaceBeforeClose
 Add space before '/>' for XHTML. More...
 
const XalanDOMString m_doctypeSystem
 The System ID for the doc type. More...
 
const XalanDOMString m_doctypePublic
 The public ID for the doc type. More...
 
const XalanDOMStringm_version
 Tells the XML version, for writing out to the XML decl. More...
 
const XalanDOMString m_standalone
 Text for standalone part of header. More...
 
const XalanDOMString m_encoding
 
- Protected Attributes inherited from FormatterListener
const PrefixResolverm_prefixResolver
 

Additional Inherited Members

- Static Protected Attributes inherited from FormatterListener
static const XalanDOMString s_emptyString
 

Detailed Description

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

Member Typedef Documentation

Member Enumeration Documentation

anonymous enum
Enumerator
eBufferSize 
anonymous enum
Enumerator
eNone 
eAttr 
eBoth 
eForb 
eCRFb 

Constructor & Destructor Documentation

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
virtual XalanXMLSerializerBase::~XalanXMLSerializerBase ( )
virtual

Member Function Documentation

virtual void XalanXMLSerializerBase::cdata ( const XMLCh *const  ch,
const unsigned int  length 
)
virtual

Receive notification of cdata.

The Parser will call this method to report each chunk of character data. SAX parsers may return all contiguous character data in a single chunk, or they may split it into several chunks; however, all of the characters in any single event must come from the same external entity, so that the Locator provides useful information.

The application must not attempt to read from the array outside of the specified range.

Note that some parsers will report whitespace using the ignorableWhitespace() method rather than this one (validating parsers must do so).

Parameters
chpointer to characters from the XML document
lengthnumber of characters to read from the array
Exceptions
SAXException

Implements FormatterListener.

virtual void XalanXMLSerializerBase::characters ( const XMLCh *const  chars,
const unsigned int  length 
)
virtual

Implements FormatterListener.

virtual void XalanXMLSerializerBase::charactersRaw ( const XMLCh *const  chars,
const unsigned int  length 
)
pure virtual

Receive notification of character data.

If available, when the disable-output-escaping attribute is used, output raw text without escaping.

Parameters
charspointer to characters from the XML document
lengthnumber of characters to read from the array
Exceptions
SAXException

Implements FormatterListener.

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

bool XalanXMLSerializerBase::childNodesWereAdded ( )
protected

Determine if an element ever had any children added.

Returns
true if the children were added, false if not.
virtual void XalanXMLSerializerBase::comment ( const XMLCh *const  data)
pure virtual

Called when a Comment is to be constructed.

Parameters
datapointer to comment data
Exceptions
SAXException

Implements FormatterListener.

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

static unsigned int XalanXMLSerializerBase::decodeUTF16SurrogatePair ( XalanDOMChar  theHighSurrogate,
XalanDOMChar  theLowSurrogate,
MemoryManager &  theManager 
)
staticprotected
virtual void XalanXMLSerializerBase::endElement ( const XMLCh *const  name)
pure virtual
virtual void XalanXMLSerializerBase::entityReference ( const XMLCh *const  name)
pure virtual

Receive notification of a entityReference.

Parameters
datapointer to characters from the XML document
Exceptions
SAXException

Implements FormatterListener.

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

virtual void XalanXMLSerializerBase::flushBuffer ( )
protectedpure virtual
void XalanXMLSerializerBase::generateDoctypeDecl ( const XalanDOMChar *  name)
protected
virtual const XalanDOMString& XalanXMLSerializerBase::getDoctypePublic ( ) const
virtual

Reimplemented from FormatterListener.

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

Reimplemented from FormatterListener.

virtual const XalanDOMString& XalanXMLSerializerBase::getEncoding ( ) const
pure virtual
MemoryManagerType& XalanXMLSerializerBase::getMemoryManager ( )
bool XalanXMLSerializerBase::getNeedToOutputDoctypeDecl ( ) const
protected

Determine if it a DOCTYPE declaration needs to be written.

bool XalanXMLSerializerBase::getShouldWriteXMLHeader ( ) const
const XalanDOMString& XalanXMLSerializerBase::getStandalone ( ) const
const XalanDOMString& XalanXMLSerializerBase::getVersion ( ) const
virtual void XalanXMLSerializerBase::ignorableWhitespace ( const XMLCh *const  chars,
const unsigned int  length 
)
virtual

Implements FormatterListener.

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

Perform static initialization.

See class XMLSupportInit.

static bool XalanXMLSerializerBase::isUTF16HighSurrogate ( XalanDOMChar  theChar)
staticprotected
static bool XalanXMLSerializerBase::isUTF16LowSurrogate ( XalanDOMChar  theChar)
staticprotected
bool XalanXMLSerializerBase::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 XalanXMLSerializerBase::openElementForChildren ( )
protected

Open an element for possibile children.

virtual void XalanXMLSerializerBase::outputNewline ( )
protectedpure virtual
bool XalanXMLSerializerBase::outsideDocumentElement ( ) const
protected
virtual void XalanXMLSerializerBase::processingInstruction ( const XMLCh *const  target,
const XMLCh *const  data 
)
virtual

Implements FormatterListener.

virtual void XalanXMLSerializerBase::resetDocument ( )
virtual

Implements FormatterListener.

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

Implements FormatterListener.

void XalanXMLSerializerBase::setShouldWriteXMLHeader ( bool  b)
virtual void XalanXMLSerializerBase::startDocument ( )
virtual

Implements FormatterListener.

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

Perform static shut down.

See class XMLSupportInit.

static void XalanXMLSerializerBase::throwInvalidCharacterException ( unsigned int  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
static void XalanXMLSerializerBase::throwInvalidUTF16SurrogateException ( XalanDOMChar  ch,
MemoryManager &  theManager 
)
staticprotected

Throw an exception when an invalid surrogate is encountered.

Parameters
chThe first character in the surrogate
static void 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
static void XalanXMLSerializerBase::throwInvalidXMLCharacterException ( unsigned int  ch,
const XalanDOMString theXMLversion,
MemoryManager &  theManager 
)
staticprotected

Throw an exception when an invalid character for the specific XML version is encountered.

Parameters
chThe first character in the surrogate
nextThe next character in the surrogate
virtual void XalanXMLSerializerBase::writeCDATA ( const XMLCh *  chars,
unsigned int  length 
)
protectedpure virtual
virtual void XalanXMLSerializerBase::writeCharacters ( const XMLCh *  chars,
unsigned int  length 
)
protectedpure virtual
virtual void XalanXMLSerializerBase::writeDoctypeDecl ( const XalanDOMChar *  name)
protectedpure virtual
virtual void XalanXMLSerializerBase::writeProcessingInstruction ( const XMLCh *  target,
const XMLCh *  data 
)
protectedpure virtual
virtual void XalanXMLSerializerBase::writeXMLHeader ( )
protectedpure virtual

Member Data Documentation

const XalanDOMString XalanXMLSerializerBase::m_doctypePublic
protected

The public ID for the doc type.

const XalanDOMString XalanXMLSerializerBase::m_doctypeSystem
protected

The System ID for the doc type.

const XalanDOMString XalanXMLSerializerBase::m_encoding
protected
bool XalanXMLSerializerBase::m_nextIsRaw
protected

Tell if the next text should be raw.

bool XalanXMLSerializerBase::m_spaceBeforeClose
protected

Add space before '/>' for XHTML.

const XalanDOMString XalanXMLSerializerBase::m_standalone
protected

Text for standalone part of header.

const XalanDOMString& XalanXMLSerializerBase::m_version
protected

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

const XalanDOMString& XalanXMLSerializerBase::s_1_0String
static
const XalanDOMString& XalanXMLSerializerBase::s_1_1String
static

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

Interpreting class diagrams

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

dot

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

Apache Logo