MSenFragment Class Reference

#include <mw/MSenFragment.h>

Link against: SenXML.dll

class MSenFragment
Public Member Functions
pure virtual CSenElement &AsElement()
pure virtual HBufC8 *AsXmlL()
pure virtual HBufC *AsXmlUnicodeL()
pure virtual TInt BuildFrom(const TDesC8 &)
pure virtual TBool ConsistsOfL(MSenFragment &)
pure virtual voidDelegateParsingL(MSenFragment &)
pure virtual voidDelegateParsingL(const TDesC8 &, const TDesC8 &, const TDesC8 &, const RAttributeArray &)
pure virtual CSenElement *ExtractElement()
pure virtual const TDesC8 &LocalName()
pure virtual const TDesC8 &NsPrefix()
pure virtual const TDesC8 &NsUri()
pure virtual voidParseL(const TDesC8 &)
pure virtual voidParseWithL(CSenXmlReader &)
pure virtual CSenXmlReader *Reader()
pure virtual voidResumeParsingFromL(const TDesC8 &, const TDesC8 &, const TDesC8 &)
pure virtual voidSetAttributesL(const RAttributeArray &)
pure virtual voidSetOwner(MSenFragment &)
pure virtual voidSetReader(CSenXmlReader &)
pure virtual voidWriteAsXMLToL(RWriteStream &)
pure virtual voidWriteEndElementL(const TDesC8 &, const TDesC8 &, const TDesC8 &)
pure virtual voidWriteStartElementL(const TDesC8 &, const TDesC8 &, const TDesC8 &, const RAttributeArray &)

Detailed Description

This abstract class defines the interface for XML fragment classes. The subclasses are used to extract certain part of XML document into a separate XML subtree, called fragment. This M-class is typically used when a safe reference to some actual implementation is required. Fragment classes are content handlers for SAX callback events received from CSenXmlReader class. They typically inherit MSenContentHandlerClient to achive this.
Since
Series60 3.0

Member Function Documentation

AsElement ( )

CSenElement &AsElement()[pure virtual]
Getting the fragment as an XML element. This method will panic if element has not been initialized (EFragmentElementNotInitialized).
Since
Series60 3.0

Returns: the current object as element. Ownership is not transferred.

AsXmlL ( )

HBufC8 *AsXmlL()[pure virtual]
Gets the fragment as a UTF-8 form XML.
Since
Series60 3.0

Returns: fragment as XML. Caller takes ownership.

AsXmlUnicodeL ( )

HBufC *AsXmlUnicodeL()[pure virtual]
Gets the fragment as Unicode (UCS-2) form XML.
Since
Series60 3.0

Returns: fragment as XML. Caller takes ownership.

BuildFrom ( const TDesC8 & )

TInt BuildFrom(const TDesC8 &aBuf)[pure virtual]
Same as ParseL() except that it doesn't leave in case of an error. Instead errors are trapped and error is returned. SetReader() must be called before this method can be used.
Since
Series60 3.0

Returns: KErrNone or other system-wide Symbian error codes

ConsistsOfL ( MSenFragment & )

TBool ConsistsOfL(MSenFragment &aCandidate)[pure virtual]
Checks if fragment matches to another fragment by its content and child elements. Fragment can contain more data than the given candidate.
Since
Series60 3.0
ParameterDescription
aCandidateThe pattern to be matched. Must contain same or less data for match to come true.

Returns: ETrue if content and possible children match exactly to given pattern. EFalse otherwise.

DelegateParsingL ( MSenFragment & )

voidDelegateParsingL(MSenFragment &aDelegate)[pure virtual]
Let the delegate MSenFragment handle the following SAX events. This fragment is made the owner of the delegate and the delegate is expected to make this MSenFragment the receiver of SAX events once it has seen the end element for itself. This is achieved by ResumeParsingFromL(), which delegate will call from his parent. The currently set XML reader is used to parse XML for the delagate, too.
Since
Series60 3.0

DelegateParsingL ( const TDesC8 &, const TDesC8 &, const TDesC8 &, const RAttributeArray & )

voidDelegateParsingL(const TDesC8 &aNsUri,
const TDesC8 &aLocalName,
const TDesC8 &aQName,
const RAttributeArray &aAttrs
)[pure virtual]
Creates a new delegate (fragment) using the given arguments and lets it handle the SAX events according to given localname (or qualifiedname) and possible namespace. This instance is made the owner of the delegate and the delegate is expected to resume parsing to this MSenFragment after it has finished handling the dedicated part of XML document in question. at the EndElementL(). The currently set XML reader is used to parse XML for the delagate, too.
Since
Series60 3.0

ExtractElement ( )

CSenElement *ExtractElement()[pure virtual]
Method extracts the root element (whole data) from this fragment. After calling this method, the fragment does not have any internal element. Method is often called before fragment is destroyed, in order to fetch its content and transfer ownership to that content to some other object.
Since
Series60 3.0

Returns: the current object as element. May return NULL. Ownership is transferred to the caller.

LocalName ( )

const TDesC8 &LocalName()const [pure virtual]
Getter for fragment XML local name.
Since
Series60 3.0

Returns: localname or KNullDesC8 if not set.

NsPrefix ( )

const TDesC8 &NsPrefix()const [pure virtual]
Getter for XML namespace prefix of this fragment.
Since
Series60 3.0

Returns: namespace prefix or KNullDesC8 if not set.

NsUri ( )

const TDesC8 &NsUri()const [pure virtual]
Getter for fragment XML namespace URI.
Since
Series60 3.0

Returns: namespace URI or KNullDesC8 if not set.

ParseL ( const TDesC8 & )

voidParseL(const TDesC8 &aBuf)[pure virtual]
Method to invoke parsing of a UTF-8 form XML data. Note that SetReader() must be called before this method can be used. Parsing is dependent of preset localname or qualifiedname and possible namespace for this fragment.
Since
Series60 3.0

ParseWithL ( CSenXmlReader & )

voidParseWithL(CSenXmlReader &aReader)[pure virtual]
Method sets the reader for this fragment and sets this to be the content handler for the SAX events according to preset localname (or qualifiedname) and possible namespace.
Since
Series60 3.0

Reader ( )

CSenXmlReader *Reader()[pure virtual]
Gets the XML reader which this fragment uses for parsing.
Since
Series60 3.0

ResumeParsingFromL ( const TDesC8 &, const TDesC8 &, const TDesC8 & )

voidResumeParsingFromL(const TDesC8 &aNsUri,
const TDesC8 &aLocalName,
const TDesC8 &aQName
)[pure virtual]
Resumes the parsing. Usually called by some delegate fragment which was parsing itself through DelegateParsingL() call from this instance.
Since
Series60 3.0
ParameterDescription
aNsUriThe namespace URI of the current element
aLocalNameThe local name of the current element
aQNameThe qualified name of the current element

SetAttributesL ( const RAttributeArray & )

voidSetAttributesL(const RAttributeArray &aAttrs)[pure virtual]
Sets the attributes for the fragment.
Since
Series60 3.0

SetOwner ( MSenFragment & )

voidSetOwner(MSenFragment &aFragment)[pure virtual]
Sets a new owner (parent) for this fragment.
Since
Series60 3.0

SetReader ( CSenXmlReader & )

voidSetReader(CSenXmlReader &aReader)[pure virtual]
Sets the XML reader to be used for parsing for the fragment.
Since
Series60 3.0

WriteAsXMLToL ( RWriteStream & )

voidWriteAsXMLToL(RWriteStream &aWriteStream)[pure virtual]
Fragment writes itself to a write stream using UTF-8 encoding.
Since
Series60 3.0

WriteEndElementL ( const TDesC8 &, const TDesC8 &, const TDesC8 & )

voidWriteEndElementL(const TDesC8 &aNsUri,
const TDesC8 &aLocalName,
const TDesC8 &aQName
)[pure virtual]
Writes the end element tag to the content stream. Subclasses typically override this
Since
Series60 3.0
ParameterDescription
aNsUriThe namespace URI of the current element
aLocalNameThe local name of the current element
aQNameThe qualified name of the current element

WriteStartElementL ( const TDesC8 &, const TDesC8 &, const TDesC8 &, const RAttributeArray & )

voidWriteStartElementL(const TDesC8 &aNsUri,
const TDesC8 &aLocalName,
const TDesC8 &aQName,
const RAttributeArray &aAttrs
)[pure virtual]
Writes the start element tag to the content stream. Subclasses typically override this.
Since
Series60 3.0
ParameterDescription
aNsUriThe namespace URI of the current element
aLocalNameThe local name of the current element
aQNameThe qualified name of the current element