http://xml.apache.org/http://www.apache.org/http://www.w3.org/

Home

Readme
Release Info

Installation
Download
Build

FAQs
Samples
API Docs

DOM C++ Binding
Programming
Migration Guide

Feedback
Bug-Reporting
PDF Document

CVS Repository
Mail Archive

API Docs for SAX and DOM
 

Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File 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 <XMLFormatter.hpp>

Collaboration diagram for XMLFormatter:

Collaboration graph
[legend]
List of all members.

Public Types

Public Contants
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 Methods

Constructor and Destructor
 XMLFormatter (const XMLCh *const outEncoding,XMLFormatTarget *const target,const EscapeFlags escapeFlags=NoEscapes,const UnRepFlags unrepFlags=UnRep_Fail)
 XMLFormatter (const char *const outEncoding,XMLFormatTarget *const target,const EscapeFlags escapeFlags=NoEscapes,const UnRepFlags unrepFlags=UnRep_Fail)
 ~XMLFormatter ()
Formatting methods
void formatBuf (const XMLCh *const toFormat,const unsigned int count,const EscapeFlags escapeFlags=DefaultEscape,const UnRepFlags unrepFlags=DefaultUnRep)
XMLFormatter& operator<< (const XMLCh *const toFormat)
XMLFormatter& operator<< (const XMLCh toFormat)
Getter methods
const XMLCh* getEncodingName ()const
const XMLTranscodergetTranscoder ()const
Setter methods
void setEscapeFlags (const EscapeFlags newFlags)
void setUnRepFlags (const UnRepFlags newFlags)
XMLFormatter& operator<< (const EscapeFlags newFlags)
XMLFormatter& operator<< (const UnRepFlags newFlags)

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

enum XMLFormatter::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; &amp;amp;
&gt; &amp;gt;
" &amp;quot;
&lt; &amp;lt;
&apos; &amp;apos;

AttrEscapes: The following characters need to be escaped:
character should be escaped and written as
&amp; &amp;amp;
&gt; &amp;gt;
" &amp;quot;

CharEscapes: The following characters need to be escaped:
character should be escaped and written as
&amp; &amp;amp;
&gt; &amp;gt;

EscapeFlags_Count: Special value, do not use directly.

DefaultEscape: Special value, do not use directly.

Enumeration values:
NoEscapes  
StdEscapes  
AttrEscapes  
CharEscapes  
EscapeFlags_Count  
DefaultEscape  

enum XMLFormatter::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_CharRef: Replace the unrepresented character with the replacement character.

DefaultUnRep: Special value, do not use directly.

Enumeration values:
UnRep_Fail  
UnRep_CharRef  
UnRep_Replace  
DefaultUnRep  


Constructor & Destructor Documentation

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

Parameters:
outEncoding   the encoding for the formatted content
target   the formatTarget where the formatted content is written to
escapeFlags   the escape style for certain character
unrepFlags   the reaction to unrepresentable character

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

XMLFormatter::~XMLFormatter ( )
 


Member Function Documentation

void XMLFormatter::formatBuf ( const XMLCh *const toFormat,
const unsigned int count,
const EscapeFlags escapeFlags = DefaultEscape,
const UnRepFlags unrepFlags = DefaultUnRep )
 

Parameters:
toFormat   the string to be formatted
count   length of the string
escapeFlags   the escape style for formatting toFormat
unrepFlags   the reaction for any unrepresentable character in toFormat

const XMLCh * XMLFormatter::getEncodingName ( ) const
 

Returns:
return the encoding set for the formatted content

const XMLTranscoder * XMLFormatter::getTranscoder ( ) const
 

Returns:
return the transcoder used internally for transcoding the formatter conent

XMLFormatter & XMLFormatter::operator<< ( const UnRepFlags newFlags )
 

Parameters:
newFlags   set the reaction for unrepresentable character
See also:
setUnRepFlags

XMLFormatter & XMLFormatter::operator<< ( const EscapeFlags newFlags )
 

Parameters:
newFlags   set the escape style for the follow-on formatted content
See also:
setEscapeFlags

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

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

See also:
formatBuf

void XMLFormatter::setEscapeFlags ( const EscapeFlags newFlags )
 

Parameters:
newFlags   set the escape style for the follow-on formatted content

void XMLFormatter::setUnRepFlags ( const UnRepFlags newFlags )
 

Parameters:
newFlags   set the reaction for unrepresentable character


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


Copyright © 2000 The Apache Software Foundation. All Rights Reserved.