Xerces-C++ 3.2.5
List of all members
XMLFormatter Class Reference

This class provides the basic formatting capabilities that are required to turn the Unicode based XML data from the parsers into a form that can be used on non-Unicode based systems, that is, into local or generic text encodings. More...

#include <xercesc/framework/XMLFormatter.hpp>

Inheritance diagram for XMLFormatter:
XMemory

Public Types

Public Constants
enum  EscapeFlags {
  NoEscapes , StdEscapes , AttrEscapes , CharEscapes ,
  EscapeFlags_Count , DefaultEscape = 999
}
 EscapeFlags - Different styles of escape flags to control various formatting. More...
 
enum  UnRepFlags { UnRep_Fail , UnRep_CharRef , UnRep_Replace , DefaultUnRep = 999 }
 UnRepFlags. More...
 

Public Member Functions

Constructor and Destructor
 XMLFormatter (const XMLCh *const outEncoding, const XMLCh *const docVersion, XMLFormatTarget *const target, const EscapeFlags escapeFlags=NoEscapes, const UnRepFlags unrepFlags=UnRep_Fail, MemoryManager *const manager=XMLPlatformUtils::fgMemoryManager)
 
 XMLFormatter (const char *const outEncoding, const char *const docVersion, XMLFormatTarget *const target, const EscapeFlags escapeFlags=NoEscapes, const UnRepFlags unrepFlags=UnRep_Fail, MemoryManager *const manager=XMLPlatformUtils::fgMemoryManager)
 
 XMLFormatter (const XMLCh *const outEncoding, XMLFormatTarget *const target, const EscapeFlags escapeFlags=NoEscapes, const UnRepFlags unrepFlags=UnRep_Fail, MemoryManager *const manager=XMLPlatformUtils::fgMemoryManager)
 
 XMLFormatter (const char *const outEncoding, XMLFormatTarget *const target, const EscapeFlags escapeFlags=NoEscapes, const UnRepFlags unrepFlags=UnRep_Fail, MemoryManager *const manager=XMLPlatformUtils::fgMemoryManager)
 
 ~XMLFormatter ()
 
Formatting methods
void formatBuf (const XMLCh *const toFormat, const XMLSize_t count, const EscapeFlags escapeFlags=DefaultEscape, const UnRepFlags unrepFlags=DefaultUnRep)
 
XMLFormatteroperator<< (const XMLCh *const toFormat)
 
XMLFormatteroperator<< (const XMLCh toFormat)
 
void writeBOM (const XMLByte *const toFormat, const XMLSize_t count)
 
Getter methods
const XMLChgetEncodingName () const
 
const XMLTranscodergetTranscoder () const
 
XMLTranscodergetTranscoder ()
 
- Public Member Functions inherited from XMemory
void * operator new (size_t size)
 This method overrides operator new.
 
void * operator new (size_t size, MemoryManager *memMgr)
 This method defines a custom operator new, that will use the provided memory manager to perform the allocation.
 
void * operator new (size_t size, void *ptr)
 This method overrides placement operator new.
 
void operator delete (void *p)
 This method overrides operator delete.
 
void operator delete (void *p, MemoryManager *memMgr)
 This method provides a matching delete for the custom operator new.
 
void operator delete (void *p, void *ptr)
 This method provides a matching delete for the placement new.
 

Setter methods

void setEscapeFlags (const EscapeFlags newFlags)
 
void setUnRepFlags (const UnRepFlags newFlags)
 
XMLFormatteroperator<< (const EscapeFlags newFlags)
 
XMLFormatteroperator<< (const UnRepFlags newFlags)
 
EscapeFlags getEscapeFlags () const
 
UnRepFlags getUnRepFlags () const
 

Additional Inherited Members

- Protected Member Functions inherited from XMemory
 XMemory ()
 Protected default constructor.
 

Detailed Description

This class provides the basic formatting capabilities that are required to turn the Unicode based XML data from the parsers into a form that can be used on non-Unicode based systems, that is, into local or generic text encodings.

A number of flags are provided to control whether various optional formatting operations are performed.

Member Enumeration Documentation

◆ EscapeFlags

EscapeFlags - Different styles of escape flags to control various formatting.

NoEscapes: No character needs to be escaped. Just write them out as is.

StdEscapes: The following characters need to be escaped:

character should be escaped and written as
& &amp;
> &gt;
" &quot;
< &lt;
' &apos;

AttrEscapes: The following characters need to be escaped:

character should be escaped and written as
& &amp;
> &gt;
" &quot;

CharEscapes: The following characters need to be escaped:

character should be escaped and written as
& &amp;
> &gt;

EscapeFlags_Count: Special value, do not use directly.

DefaultEscape: Special value, do not use directly.

Enumerator
NoEscapes 
StdEscapes 
AttrEscapes 
CharEscapes 
EscapeFlags_Count 
DefaultEscape 

◆ UnRepFlags

UnRepFlags.

The unrepresentable flags that indicate how to react when a character cannot be represented in the target encoding.

UnRep_Fail: Fail the operation.

UnRep_CharRef: Display the unrepresented character as reference.

UnRep_Replace: Replace the unrepresented character with the replacement character.

DefaultUnRep: Special value, do not use directly.

Enumerator
UnRep_Fail 
UnRep_CharRef 
UnRep_Replace 
DefaultUnRep 

Constructor & Destructor Documentation

◆ XMLFormatter() [1/4]

XMLFormatter::XMLFormatter ( const XMLCh *const  outEncoding,
const XMLCh *const  docVersion,
XMLFormatTarget *const  target,
const EscapeFlags  escapeFlags = NoEscapes,
const UnRepFlags  unrepFlags = UnRep_Fail,
MemoryManager *const  manager = XMLPlatformUtils::fgMemoryManager 
)
Parameters
outEncodingthe encoding for the formatted content.
docVersionthe document version.
targetthe formatTarget where the formatted content is written to.
escapeFlagsthe escape style for certain character.
unrepFlagsthe reaction to unrepresentable character.
managerPointer to the memory manager to be used to allocate objects.

◆ XMLFormatter() [2/4]

XMLFormatter::XMLFormatter ( const char *const  outEncoding,
const char *const  docVersion,
XMLFormatTarget *const  target,
const EscapeFlags  escapeFlags = NoEscapes,
const UnRepFlags  unrepFlags = UnRep_Fail,
MemoryManager *const  manager = XMLPlatformUtils::fgMemoryManager 
)

◆ XMLFormatter() [3/4]

XMLFormatter::XMLFormatter ( const XMLCh *const  outEncoding,
XMLFormatTarget *const  target,
const EscapeFlags  escapeFlags = NoEscapes,
const UnRepFlags  unrepFlags = UnRep_Fail,
MemoryManager *const  manager = XMLPlatformUtils::fgMemoryManager 
)

◆ XMLFormatter() [4/4]

XMLFormatter::XMLFormatter ( const char *const  outEncoding,
XMLFormatTarget *const  target,
const EscapeFlags  escapeFlags = NoEscapes,
const UnRepFlags  unrepFlags = UnRep_Fail,
MemoryManager *const  manager = XMLPlatformUtils::fgMemoryManager 
)

◆ ~XMLFormatter()

XMLFormatter::~XMLFormatter ( )

Member Function Documentation

◆ formatBuf()

void XMLFormatter::formatBuf ( const XMLCh *const  toFormat,
const XMLSize_t  count,
const EscapeFlags  escapeFlags = DefaultEscape,
const UnRepFlags  unrepFlags = DefaultUnRep 
)
Parameters
toFormatthe string to be formatted
countlength of the string
escapeFlagsthe escape style for formatting toFormat
unrepFlagsthe reaction for any unrepresentable character in toFormat

◆ getEncodingName()

const XMLCh * XMLFormatter::getEncodingName ( ) const
Returns
return the encoding set for the formatted content

◆ getEscapeFlags()

XMLFormatter::EscapeFlags XMLFormatter::getEscapeFlags ( ) const
Returns
return the escape style for the formatted content

◆ getTranscoder() [1/2]

XMLTranscoder * XMLFormatter::getTranscoder ( )
Returns
return the transcoder used internally for transcoding the formatter content

◆ getTranscoder() [2/2]

const XMLTranscoder * XMLFormatter::getTranscoder ( ) const
Returns
return constant transcoder used internally for transcoding the formatter conent

◆ getUnRepFlags()

XMLFormatter::UnRepFlags XMLFormatter::getUnRepFlags ( ) const
Returns
return the reaction for unrepresentable character

◆ operator<<() [1/4]

XMLFormatter & XMLFormatter::operator<< ( const EscapeFlags  newFlags)
Parameters
newFlagsset the escape style for the follow-on formatted content
See also
setEscapeFlags

◆ operator<<() [2/4]

XMLFormatter & XMLFormatter::operator<< ( const UnRepFlags  newFlags)
Parameters
newFlagsset the reaction for unrepresentable character
See also
setUnRepFlags

◆ operator<<() [3/4]

XMLFormatter & XMLFormatter::operator<< ( const XMLCh *const  toFormat)
See also
formatBuf

◆ operator<<() [4/4]

XMLFormatter & XMLFormatter::operator<< ( const XMLCh  toFormat)

◆ setEscapeFlags()

void XMLFormatter::setEscapeFlags ( const EscapeFlags  newFlags)
Parameters
newFlagsset the escape style for the follow-on formatted content

◆ setUnRepFlags()

void XMLFormatter::setUnRepFlags ( const UnRepFlags  newFlags)
Parameters
newFlagsset the reaction for unrepresentable character

◆ writeBOM()

void XMLFormatter::writeBOM ( const XMLByte *const  toFormat,
const XMLSize_t  count 
)

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