CMDXMLComposer Class Reference

class CMDXMLComposer : public CActive

Creates an XML file from a given DOM structure.

Inherits from

Public Member Functions
~CMDXMLComposer()
IMPORT_C TIntCalculateFileSize(TInt &, CMDXMLDocument *, TXMLFileType)
IMPORT_C TIntComposeFile(RFs, const TDesC &, CMDXMLDocument *, TXMLFileType)
IMPORT_C TIntComposeFile(RFile &, CMDXMLDocument *, TXMLFileType)
IMPORT_C CMDXMLEntityConverter *EntityConverter()
IMPORT_C TIntError()
IMPORT_C TXMLErrorCodeSeverityErrorSeverity()
IMPORT_C CMDXMLComposer *NewL(MMDXMLComposerObserver *)
IMPORT_C CMDXMLComposer *NewL(MMDXMLComposerObserver *, TBool)
IMPORT_C CMDXMLComposer *NewLC(MMDXMLComposerObserver *)
IMPORT_C CMDXMLComposer *NewLC(MMDXMLComposerObserver *, TBool)
IMPORT_C TIntOutputAttributeL(const TDesC &, const TDesC &)
TInt OutputCDataSectionL(const TDesC &)
TInt OutputCommentL(const TDesC &)
IMPORT_C TIntOutputDataL(const TDesC &)
IMPORT_C TIntOutputEndOfElementTagL(const TBool)
TInt OutputEndTagL(const TDesC &)
TInt OutputProcessingInstructionL(const TDesC &)
IMPORT_C TIntOutputStartOfElementTagL(const TDesC &)
IMPORT_C voidSetEntityConverter(CMDXMLEntityConverter *)
Private Member Functions
CMDXMLComposer(MMDXMLComposerObserver *)
CMDXMLComposer(MMDXMLComposerObserver *, TBool)
voidBaseConstructL()
IMPORT_C TIntComposeEndTagL(CMDXMLNode &)
TInt ComposeL()
IMPORT_C TIntComposeStartTagL(CMDXMLNode &)
voidConstructL()
IMPORT_C voidDoCancel()
TInt FlushOutputBufferL()
voidInitialiseCompose(CMDXMLDocument *, TXMLFileType)
IMPORT_C voidPlaceholderForRemovedExport1(MMDXMLComposerObserver *)
IMPORT_C voidPlaceholderForRemovedExport2()
IMPORT_C voidPlaceholderForRemovedExport3()
TInt ReplaceXmlCharactersL(const TDesC16 &, const TDesC &)
IMPORT_C TIntRunError(TInt)
voidRunL()
IMPORT_C voidSetError(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,
TBoolaOutputProlog
)[private]

Parameters

MMDXMLComposerObserver * aComposerObserver
TBool aOutputProlog

~CMDXMLComposer()

IMPORT_C~CMDXMLComposer()

Destructor.

Member Functions Documentation

BaseConstructL()

voidBaseConstructL()[private]

CalculateFileSize(TInt &, CMDXMLDocument *, TXMLFileType)

IMPORT_C TIntCalculateFileSize(TInt &aSize,
CMDXMLDocument *aDocument,
TXMLFileTypeaFileType
)

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 & aSizeWill be set to the size of the XML document when composition has completed.
CMDXMLDocument * aDocumentThe document object to size
TXMLFileType aFileTypeType of the output file, required because it will affect the size of the XML

ComposeEndTagL(CMDXMLNode &)

IMPORT_C TIntComposeEndTagL(CMDXMLNode &aNode)[private]

Parameters

CMDXMLNode & aNode

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

IMPORT_C TIntComposeFile(RFsaRFs,
const TDesC &aFileToCompose,
CMDXMLDocument *aDocument,
TXMLFileTypeaFileType
)

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 aRFsA file server session
const TDesC & aFileToComposeName of the file to create
CMDXMLDocument * aDocumentThe document object to compose to the file
TXMLFileType aFileTypeType of the output file

ComposeFile(RFile &, CMDXMLDocument *, TXMLFileType)

IMPORT_C TIntComposeFile(RFile &aFileHandleToCompose,
CMDXMLDocument *aDocument,
TXMLFileTypeaFileType
)

Parameters

RFile & aFileHandleToCompose
CMDXMLDocument * aDocument
TXMLFileType aFileType

ComposeL()

TInt ComposeL()[private]

ComposeStartTagL(CMDXMLNode &)

IMPORT_C TIntComposeStartTagL(CMDXMLNode &aNode)[private]

Parameters

CMDXMLNode & aNode

ConstructL()

voidConstructL()[private]

DoCancel()

IMPORT_C voidDoCancel()[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 TIntError()const

Gets the composer's last error.

ErrorSeverity()

IMPORT_C TXMLErrorCodeSeverityErrorSeverity()const

Get the severity of the most severe error found.

FlushOutputBufferL()

TInt FlushOutputBufferL()[private, virtual]

InitialiseCompose(CMDXMLDocument *, TXMLFileType)

voidInitialiseCompose(CMDXMLDocument *aDocument,
TXMLFileTypeaFileType
)[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 * aComposerObserverComposer observer

NewL(MMDXMLComposerObserver *, TBool)

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

Allocates and constructs a new XML composer.

leave
KErrNoMemory Out of memory

Parameters

MMDXMLComposerObserver * aComposerObserverComposer observer
TBool aOutputPrologWhether 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 * aComposerObserverComposer observer

NewLC(MMDXMLComposerObserver *, TBool)

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

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

leave
KErrNoMemory Out of memory

Parameters

MMDXMLComposerObserver * aComposerObserverComposer observer
TBool aOutputPrologWhether to output Version and Doctype tags.

OutputAttributeL(const TDesC &, const TDesC &)

IMPORT_C TIntOutputAttributeL(const TDesC &aAttributeName,
const TDesC &aAttributeValue
)

Outputs an attribute name and value.

Parameters

const TDesC & aAttributeNameAttribute name
const TDesC & aAttributeValueAttribute value

OutputCDataSectionL(const TDesC &)

TInt OutputCDataSectionL(const TDesC &aCDataSection)

Outputs a CDATA section.

Parameters

const TDesC & aCDataSectionCDATA section to output

OutputCommentL(const TDesC &)

TInt OutputCommentL(const TDesC &aComment)

Outputs a comment.

Parameters

const TDesC & aCommentComment to output

OutputDataL(const TDesC &)

IMPORT_C TIntOutputDataL(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 & aDataData to output

OutputEndOfElementTagL(const TBool)

IMPORT_C TIntOutputEndOfElementTagL(const TBoolaHasChildren)

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

Parameters

const TBool aHasChildrenTrue if the element has children

OutputEndTagL(const TDesC &)

TInt OutputEndTagL(const TDesC &aElementName)

Output an end of element tag.

Parameters

const TDesC & aElementNameThe name of the tag to output

OutputProcessingInstructionL(const TDesC &)

TInt OutputProcessingInstructionL(const TDesC &aInstruction)

Outputs a processing instruction.

Parameters

const TDesC & aInstructionProcessing instruction text to output

OutputStartOfElementTagL(const TDesC &)

IMPORT_C TIntOutputStartOfElementTagL(const TDesC &aElementName)

Outputs a start of element tag.

Parameters

const TDesC & aElementNameThe name of the tag to output

PlaceholderForRemovedExport1(MMDXMLComposerObserver *)

IMPORT_C voidPlaceholderForRemovedExport1(MMDXMLComposerObserver *aComposerObserver)[private]

Parameters

MMDXMLComposerObserver * aComposerObserver

PlaceholderForRemovedExport2()

IMPORT_C voidPlaceholderForRemovedExport2()[private]

PlaceholderForRemovedExport3()

IMPORT_C voidPlaceholderForRemovedExport3()[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 TIntRunError(TIntaError)[private, virtual]

Parameters

TInt aError

RunL()

voidRunL()[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 voidSetEntityConverter(CMDXMLEntityConverter *aEntityConverter)

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

Parameters

CMDXMLEntityConverter * aEntityConverterThe entity converter to be used

SetError(const TInt, const TXMLErrorCodeSeverity)

IMPORT_C voidSetError(const TIntaErrorCode,
const TXMLErrorCodeSeverityaSeverity
)[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]