MSenFragment Class Reference

API published in: S60 3rd Ed

Link against: senxml.lib

Capability Information

Required Capabilities

None


#include <
msenfragment.h>

Inherited by CSenFragment, and CSenServiceConnection.


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.


Public Member Functions

virtual CSenElementAsElement ()=0
 Getting the fragment as an XML element.
virtual CSenElementExtractElement ()=0
 Method extracts the root element (whole data) from this fragment.
virtual void SetReader (CSenXmlReader &aReader)=0
 Sets the XML reader to be used for parsing for the fragment.
virtual CSenXmlReaderReader ()=0
 Gets the XML reader which this fragment uses for parsing.
virtual void ParseL (const TDesC8 &aBuf)=0
 Method to invoke parsing of a UTF-8 form XML data.
virtual TInt BuildFrom (const TDesC8 &aBuf)=0
 Same as ParseL() except that it doesn't leave in case of an error.
virtual void DelegateParsingL (MSenFragment &aDelegate)=0
 Let the delegate MSenFragment handle the following SAX events.
virtual void DelegateParsingL (const TDesC8 &aNsUri, const TDesC8 &aLocalName, const TDesC8 &aQName, const RAttributeArray &aAttrs)=0
 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.
virtual void ParseWithL (CSenXmlReader &aReader)=0
 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.
virtual void SetOwner (MSenFragment &aFragment)=0
 Sets a new owner (parent) for this fragment.
virtual void ResumeParsingFromL (const TDesC8 &aNsUri, const TDesC8 &aLocalName, const TDesC8 &aQName)=0
 Resumes the parsing.
virtual void SetAttributesL (const RAttributeArray &aAttrs)=0
 Sets the attributes for the fragment.
virtual void WriteStartElementL (const TDesC8 &aNsUri, const TDesC8 &aLocalName, const TDesC8 &aQName, const RAttributeArray &aAttrs)=0
 Writes the start element tag to the content stream.
virtual void WriteEndElementL (const TDesC8 &aNsUri, const TDesC8 &aLocalName, const TDesC8 &aQName)=0
 Writes the end element tag to the content stream.
virtual const TDesC8 & LocalName () const =0
 Getter for fragment XML local name.
virtual const TDesC8 & NsUri () const =0
 Getter for fragment XML namespace URI.
virtual const TDesC8 & NsPrefix () const =0
 Getter for XML namespace prefix of this fragment.
virtual void WriteAsXMLToL (RWriteStream &aWriteStream)=0
 Fragment writes itself to a write stream using UTF-8 encoding.
virtual HBufC * AsXmlUnicodeL ()=0
 Gets the fragment as Unicode (UCS-2) form XML.
virtual HBufC8 * AsXmlL ()=0
 Gets the fragment as a UTF-8 form XML.
virtual TBool ConsistsOfL (MSenFragment &aCandidate)=0
 Checks if fragment matches to another fragment by its content and child elements.

Member Function Documentation

virtual CSenElement& MSenFragment::AsElement  )  [pure virtual]
 

Getting the fragment as an XML element.

This method will panic if element has not been initialized (EFragmentElementNotInitialized).

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

Implemented in CSenBaseFragment, and CSenFragment.

virtual HBufC8* MSenFragment::AsXmlL  )  [pure virtual]
 

Gets the fragment as a UTF-8 form XML.

Returns:
fragment as XML. Caller takes ownership.

Implemented in CSenBaseFragment, CSenFragment, and CSenXmlServiceDescription.

virtual HBufC* MSenFragment::AsXmlUnicodeL  )  [pure virtual]
 

Gets the fragment as Unicode (UCS-2) form XML.

Returns:
fragment as XML. Caller takes ownership.

Implemented in CSenBaseFragment, CSenFragment, and CSenXmlServiceDescription.

virtual TInt MSenFragment::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.

Parameters:
aBuf,: The XML to be parsed.
Returns:
KErrNone or other system-wide Symbian error codes

Implemented in CSenBaseFragment, and CSenFragment.

virtual TBool MSenFragment::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.

Parameters:
aCandidate The 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.

Implemented in CSenBaseFragment, and CSenFragment.

virtual void MSenFragment::DelegateParsingL 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.

Parameters:
aNsUri,: the namespace URI of the new delegate
aLocalName,: the local name of the new delegate
aQName,: the qualified name of the new delegate
aAttrs,: the attributes which to be set for the new delegate

Implemented in CSenBaseFragment, and CSenFragment.

virtual void MSenFragment::DelegateParsingL 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.

Parameters:
aDelegate,: the fragment to start handling the SAX events.

Implemented in CSenBaseFragment, and CSenFragment.

virtual CSenElement* MSenFragment::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.

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

Implemented in CSenBaseFragment, and CSenFragment.

virtual const TDesC8& MSenFragment::LocalName  )  const [pure virtual]
 

Getter for fragment XML local name.

Returns:
localname or KNullDesC8 if not set.

Implemented in CSenBaseFragment, and CSenFragment.

virtual const TDesC8& MSenFragment::NsPrefix  )  const [pure virtual]
 

Getter for XML namespace prefix of this fragment.

Returns:
namespace prefix or KNullDesC8 if not set.

Implemented in CSenBaseFragment, and CSenFragment.

virtual const TDesC8& MSenFragment::NsUri  )  const [pure virtual]
 

Getter for fragment XML namespace URI.

Returns:
namespace URI or KNullDesC8 if not set.

Implemented in CSenBaseFragment, and CSenFragment.

virtual void MSenFragment::ParseL 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.

Parameters:
aBuf,: The XML to be parsed.

Implemented in CSenBaseFragment, and CSenFragment.

virtual void MSenFragment::ParseWithL 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.

Parameters:
aReader,: Reader to be used.

Implemented in CSenBaseFragment, CSenDomFragment, and CSenFragment.

virtual CSenXmlReader* MSenFragment::Reader  )  [pure virtual]
 

Gets the XML reader which this fragment uses for parsing.

Parameters:
aReader,: the reader to be used. Ownerships is not transferred. May return NULL.

Implemented in CSenBaseFragment, and CSenFragment.

virtual void MSenFragment::ResumeParsingFromL 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.

Parameters:
aNsUri The namespace URI of the current element
aLocalName The local name of the current element
aQName The qualified name of the current element

Implemented in CSenBaseFragment, CSenDomFragment, CSenFragment, and CSenXmlServiceDescription.

virtual void MSenFragment::SetAttributesL const RAttributeArray &  aAttrs  )  [pure virtual]
 

Sets the attributes for the fragment.

Parameters:
aAttrs,: the array of attributes.

Implemented in CSenBaseFragment, CSenDomFragment, CSenFragment, and CSenXmlServiceDescription.

virtual void MSenFragment::SetOwner MSenFragment aFragment  )  [pure virtual]
 

Sets a new owner (parent) for this fragment.

Parameters:
aFragment,: the new parent.

Implemented in CSenBaseFragment, and CSenFragment.

virtual void MSenFragment::SetReader CSenXmlReader aReader  )  [pure virtual]
 

Sets the XML reader to be used for parsing for the fragment.

Parameters:
aReader,: the reader to be used. Ownership is NOT transferred.

Implemented in CSenBaseFragment, and CSenFragment.

virtual void MSenFragment::WriteAsXMLToL RWriteStream &  aWriteStream  )  [pure virtual]
 

Fragment writes itself to a write stream using UTF-8 encoding.

Parameters:
aWriteStream,: The stream to write to.

Implemented in CSenBaseFragment, CSenFragment, and CSenXmlServiceDescription.

virtual void MSenFragment::WriteEndElementL const TDesC8 &  aNsUri,
const TDesC8 &  aLocalName,
const TDesC8 &  aQName
[pure virtual]
 

Writes the end element tag to the content stream.

Subclasses typically override this

Parameters:
aNsUri The namespace URI of the current element
aLocalName The local name of the current element
aQName The qualified name of the current element

Implemented in CSenBaseFragment, CSenDomFragment, and CSenFragment.

virtual void MSenFragment::WriteStartElementL 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.

Parameters:
aNsUri The namespace URI of the current element
aLocalName The local name of the current element
aQName The qualified name of the current element
aAttrs,: the array of attributes.

Implemented in CSenBaseFragment, CSenDomFragment, and CSenFragment.


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

Copyright © Nokia Corporation 2001-2008
Back to top