CMDXMLComposer Class Reference

class CMDXMLComposer : public CActive

Creates an XML file from a given DOM structure.

Inherits from

Public Member Functions
~CMDXMLComposer ()
IMPORT_C TInt CalculateFileSize ( TInt &, CMDXMLDocument *, TXMLFileType )
IMPORT_C TInt ComposeFile ( RFs , const TDesC &, CMDXMLDocument *, TXMLFileType )
IMPORT_C TInt ComposeFile ( RFile &, CMDXMLDocument *, TXMLFileType )
IMPORT_C CMDXMLEntityConverter * EntityConverter ()
IMPORT_C TInt Error ()
IMPORT_C TXMLErrorCodeSeverity ErrorSeverity ()
IMPORT_C CMDXMLComposer * NewL ( MMDXMLComposerObserver *)
IMPORT_C CMDXMLComposer * NewL ( MMDXMLComposerObserver *, TBool )
IMPORT_C CMDXMLComposer * NewLC ( MMDXMLComposerObserver *)
IMPORT_C CMDXMLComposer * NewLC ( MMDXMLComposerObserver *, TBool )
IMPORT_C TInt OutputAttributeL (const TDesC &, const TDesC &)
TInt OutputCDataSectionL (const TDesC &)
TInt OutputCommentL (const TDesC &)
IMPORT_C TInt OutputDataL (const TDesC &)
IMPORT_C TInt OutputEndOfElementTagL (const TBool )
TInt OutputEndTagL (const TDesC &)
TInt OutputProcessingInstructionL (const TDesC &)
IMPORT_C TInt OutputStartOfElementTagL (const TDesC &)
IMPORT_C void SetEntityConverter ( CMDXMLEntityConverter *)
Private Member Functions
CMDXMLComposer ( MMDXMLComposerObserver *)
CMDXMLComposer ( MMDXMLComposerObserver *, TBool )
void BaseConstructL ()
IMPORT_C TInt ComposeEndTagL ( CMDXMLNode &)
TInt ComposeL ()
IMPORT_C TInt ComposeStartTagL ( CMDXMLNode &)
void ConstructL ()
IMPORT_C void DoCancel ()
TInt FlushOutputBufferL ()
void InitialiseCompose ( CMDXMLDocument *, TXMLFileType )
IMPORT_C void PlaceholderForRemovedExport1 ( MMDXMLComposerObserver *)
IMPORT_C void PlaceholderForRemovedExport2 ()
IMPORT_C void PlaceholderForRemovedExport3 ()
TInt ReplaceXmlCharactersL (const TDesC16 &, const TDesC &)
IMPORT_C TInt RunError ( TInt )
void RunL ()
IMPORT_C void SetError (const TInt , const TXMLErrorCodeSeverity )
TInt WriteFileL (const TDesC &)
Inherited Functions
CActive::CActive(TInt)
CActive::Cancel()
CActive::Deque()
CActive::Extension_(TUint,TAny *&,TAny *)
CActive::IsActive()const
CActive::IsAdded()const
CActive::Priority()const
CActive::SetActive()
CActive::SetPriority(TInt)
CActive::~CActive()
CBase::CBase()
CBase::Delete(CBase *)
CBase::operator new(TUint)
CBase::operator new(TUint,TAny *)
CBase::operator new(TUint,TLeave)
CBase::operator new(TUint,TLeave,TUint)
CBase::operator new(TUint,TUint)
CBase::~CBase()
Inherited Enumerations
CActive:TPriority
Private Attributes
CCnvCharacterSetConverter * iCharconv
MMDXMLComposerObserver * iComposerObserver
CMDXMLEntityConverter * iEntityConverter
TInt iError
TXMLFileType iFileType
TBool iOnlyCalculatingSize
TBuf < KWriteBufferLen > iOutputBuffer
TBool iOutputProlog
RFs iRFs
TXMLErrorCodeSeverity iSeverity
TInt * iSize
TInt iSizeTally
CMDXMLDocument * iXMLDoc
RFile iXMLFile
Inherited Attributes
CActive::iStatus

Constructor & Destructor Documentation

CMDXMLComposer(MMDXMLComposerObserver *)

CMDXMLComposer ( MMDXMLComposerObserver * aComposerObserver ) [private]

Parameters

MMDXMLComposerObserver * aComposerObserver

CMDXMLComposer(MMDXMLComposerObserver *, TBool)

CMDXMLComposer ( MMDXMLComposerObserver * aComposerObserver,
TBool aOutputProlog
) [private]

Parameters

MMDXMLComposerObserver * aComposerObserver
TBool aOutputProlog

~CMDXMLComposer()

IMPORT_C ~CMDXMLComposer ( )

Destructor.

Member Functions Documentation

BaseConstructL()

void BaseConstructL ( ) [private]

CalculateFileSize(TInt &, CMDXMLDocument *, TXMLFileType)

IMPORT_C TInt CalculateFileSize ( TInt & aSize,
CMDXMLDocument * aDocument,
TXMLFileType aFileType
)

Starts calculating the size of the XML output without actually writing it to the file.

File size calculation is asyncronous, the size value is only updated when ComposeFileComplete is called on the MMDXMLComposerObserver passed in in the NewL.

This function must not be called when file composition or another sizing operation is in progress. If it is necessary to calulate the size and generate the XML simultaneously then two instances of the composer should be used, one for sizing and one for composition.

Parameters

TInt & aSize Will be set to the size of the XML document when composition has completed.
CMDXMLDocument * aDocument The document object to size
TXMLFileType aFileType Type of the output file, required because it will affect the size of the XML

ComposeEndTagL(CMDXMLNode &)

IMPORT_C TInt ComposeEndTagL ( CMDXMLNode & aNode ) [private]

Parameters

CMDXMLNode & aNode

ComposeFile(RFs, const TDesC &, CMDXMLDocument *, TXMLFileType)

IMPORT_C TInt ComposeFile ( RFs aRFs,
const TDesC & aFileToCompose,
CMDXMLDocument * aDocument,
TXMLFileType aFileType
)

Starts file composition.

This function must not be called when file sizing is in progress. If it is necessary to calulate the size and generate the XML simultaneously then two instances of the composer should be used, one for sizing and one for composition.

Parameters

RFs aRFs A file server session
const TDesC & aFileToCompose Name of the file to create
CMDXMLDocument * aDocument The document object to compose to the file
TXMLFileType aFileType Type of the output file

ComposeFile(RFile &, CMDXMLDocument *, TXMLFileType)

IMPORT_C TInt ComposeFile ( RFile & aFileHandleToCompose,
CMDXMLDocument * aDocument,
TXMLFileType aFileType
)

Parameters

RFile & aFileHandleToCompose
CMDXMLDocument * aDocument
TXMLFileType aFileType

ComposeL()

TInt ComposeL ( ) [private]

ComposeStartTagL(CMDXMLNode &)

IMPORT_C TInt ComposeStartTagL ( CMDXMLNode & aNode ) [private]

Parameters

CMDXMLNode & aNode

ConstructL()

void ConstructL ( ) [private]

DoCancel()

IMPORT_C void DoCancel ( ) [private, virtual]

Implements cancellation of an outstanding request.

This function is called as part of the active object's Cancel() .

It must call the appropriate cancel function offered by the active object's asynchronous service provider. The asynchronous service provider's cancel is expected to act immediately.

DoCancel() must not wait for event completion; this is handled by Cancel() .

CActive::Cancel

EntityConverter()

IMPORT_C CMDXMLEntityConverter * EntityConverter ( ) const

Gets the entity converter used by the composer.

Error()

IMPORT_C TInt Error ( ) const

Gets the composer's last error.

ErrorSeverity()

IMPORT_C TXMLErrorCodeSeverity ErrorSeverity ( ) const

Get the severity of the most severe error found.

FlushOutputBufferL()

TInt FlushOutputBufferL ( ) [private, virtual]

InitialiseCompose(CMDXMLDocument *, TXMLFileType)

void InitialiseCompose ( CMDXMLDocument * aDocument,
TXMLFileType aFileType
) [private]

Parameters

CMDXMLDocument * aDocument
TXMLFileType aFileType

NewL(MMDXMLComposerObserver *)

IMPORT_C CMDXMLComposer * NewL ( MMDXMLComposerObserver * aComposerObserver ) [static]

Allocates and constructs a new XML composer.

leave
KErrNoMemory Out of memory

Parameters

MMDXMLComposerObserver * aComposerObserver Composer observer

NewL(MMDXMLComposerObserver *, TBool)

IMPORT_C CMDXMLComposer * NewL ( MMDXMLComposerObserver * aComposerObserver,
TBool aOutputProlog
) [static]

Allocates and constructs a new XML composer.

leave
KErrNoMemory Out of memory

Parameters

MMDXMLComposerObserver * aComposerObserver Composer observer
TBool aOutputProlog Whether to output Version and Doctype tags.

NewLC(MMDXMLComposerObserver *)

IMPORT_C CMDXMLComposer * NewLC ( MMDXMLComposerObserver * aComposerObserver ) [static]

Allocates and constructs a new XML composer, leaving the object on the cleanup stack.

leave
KErrNoMemory Out of memory

Parameters

MMDXMLComposerObserver * aComposerObserver Composer observer

NewLC(MMDXMLComposerObserver *, TBool)

IMPORT_C CMDXMLComposer * NewLC ( MMDXMLComposerObserver * aComposerObserver,
TBool aOutputProlog
) [static]

Allocates and constructs a new XML composer, leaving the object on the cleanup stack.

leave
KErrNoMemory Out of memory

Parameters

MMDXMLComposerObserver * aComposerObserver Composer observer
TBool aOutputProlog Whether to output Version and Doctype tags.

OutputAttributeL(const TDesC &, const TDesC &)

IMPORT_C TInt OutputAttributeL ( const TDesC & aAttributeName,
const TDesC & aAttributeValue
)

Outputs an attribute name and value.

Parameters

const TDesC & aAttributeName Attribute name
const TDesC & aAttributeValue Attribute value

OutputCDataSectionL(const TDesC &)

TInt OutputCDataSectionL ( const TDesC & aCDataSection )

Outputs a CDATA section.

Parameters

const TDesC & aCDataSection CDATA section to output

OutputCommentL(const TDesC &)

TInt OutputCommentL ( const TDesC & aComment )

Outputs a comment.

Parameters

const TDesC & aComment Comment to output

OutputDataL(const TDesC &)

IMPORT_C TInt OutputDataL ( const TDesC & aData )

Outputs raw data. it's only intended to be used from within a custom entity converter as it relies on a Composer sesssion already being in progress

Parameters

const TDesC & aData Data to output

OutputEndOfElementTagL(const TBool)

IMPORT_C TInt OutputEndOfElementTagL ( const TBool aHasChildren )

Outputs an end of element start tag (</).

Parameters

const TBool aHasChildren True if the element has children

OutputEndTagL(const TDesC &)

TInt OutputEndTagL ( const TDesC & aElementName )

Output an end of element tag.

Parameters

const TDesC & aElementName The name of the tag to output

OutputProcessingInstructionL(const TDesC &)

TInt OutputProcessingInstructionL ( const TDesC & aInstruction )

Outputs a processing instruction.

Parameters

const TDesC & aInstruction Processing instruction text to output

OutputStartOfElementTagL(const TDesC &)

IMPORT_C TInt OutputStartOfElementTagL ( const TDesC & aElementName )

Outputs a start of element tag.

Parameters

const TDesC & aElementName The name of the tag to output

PlaceholderForRemovedExport1(MMDXMLComposerObserver *)

IMPORT_C void PlaceholderForRemovedExport1 ( MMDXMLComposerObserver * aComposerObserver ) [private]

Parameters

MMDXMLComposerObserver * aComposerObserver

PlaceholderForRemovedExport2()

IMPORT_C void PlaceholderForRemovedExport2 ( ) [private]

PlaceholderForRemovedExport3()

IMPORT_C void PlaceholderForRemovedExport3 ( ) [private]

ReplaceXmlCharactersL(const TDesC16 &, const TDesC &)

TInt ReplaceXmlCharactersL ( const TDesC16 & aXmlData,
const TDesC & aString
) [private]

Parameters

const TDesC16 & aXmlData
const TDesC & aString

RunError(TInt)

IMPORT_C TInt RunError ( TInt aError ) [private, virtual]

Parameters

TInt aError

RunL()

void RunL ( ) [private, virtual]

Handles an active object's request completion event.

A derived class must provide an implementation to handle the completed request. If appropriate, it may issue another request.

The function is called by the active scheduler when a request completion event occurs, i.e. after the active scheduler's WaitForAnyRequest() function completes.

Before calling this active object's RunL() function, the active scheduler has:

1. decided that this is the highest priority active object with a completed request

2. marked this active object's request as complete (i.e. the request is no longer outstanding)

RunL() runs under a trap harness in the active scheduler. If it leaves, then the active scheduler calls RunError() to handle the leave.

Note that once the active scheduler's Start() function has been called, all user code is run under one of the program's active object's RunL() or RunError() functions.

CActiveScheduler::Start CActiveScheduler::Error CActiveScheduler::WaitForAnyRequest TRAPD

SetEntityConverter(CMDXMLEntityConverter *)

IMPORT_C void SetEntityConverter ( CMDXMLEntityConverter * aEntityConverter )

Sets the entity converter to be used and take ownership of the passed entity converter

Parameters

CMDXMLEntityConverter * aEntityConverter The entity converter to be used

SetError(const TInt, const TXMLErrorCodeSeverity)

IMPORT_C void SetError ( const TInt aErrorCode,
const TXMLErrorCodeSeverity aSeverity
) [private]

Parameters

const TInt aErrorCode
const TXMLErrorCodeSeverity aSeverity

WriteFileL(const TDesC &)

TInt WriteFileL ( const TDesC & aStringToWrite ) [private, virtual]

Parameters

const TDesC & aStringToWrite

Member Data Documentation

CCnvCharacterSetConverter * iCharconv

CCnvCharacterSetConverter * iCharconv [private]

MMDXMLComposerObserver * iComposerObserver

MMDXMLComposerObserver * iComposerObserver [private]

CMDXMLEntityConverter * iEntityConverter

CMDXMLEntityConverter * iEntityConverter [private]

TInt iError

TInt iError [private]

TXMLFileType iFileType

TXMLFileType iFileType [private]

TBool iOnlyCalculatingSize

TBool iOnlyCalculatingSize [private]

TBuf< KWriteBufferLen > iOutputBuffer

TBuf < KWriteBufferLen > iOutputBuffer [private]

TBool iOutputProlog

TBool iOutputProlog [private]

RFs iRFs

RFs iRFs [private]

TXMLErrorCodeSeverity iSeverity

TXMLErrorCodeSeverity iSeverity [private]

TInt * iSize

TInt * iSize [private]

TInt iSizeTally

TInt iSizeTally [private]

CMDXMLDocument * iXMLDoc

CMDXMLDocument * iXMLDoc [private]

RFile iXMLFile

RFile iXMLFile [private]