CSenBaseFragment Class Reference
class CSenBaseFragment : public CSenFragment |
Class implements basic functionality of an XML fragment Typically BaseFragment is used to parse certain part of some XML document. The element is identified by localname (or qualifiedname) and namespace. All child elements between start tag and and end tag defined this fragment will become content of this BaseFragment. In other words, BaseFragment has all data inside a single element. BaseFragment will parse only namespace (xmlns) attributes from a document and rest of the attributes are to be handled by subclasses, which should overwrite
SetAttributesL() method to achieve this. The
CSenXmlReader class will do the actual parsing and this class will act as content handler for XML parser SAX events. SenXML.dll
- Since
- Series60 3.0
Public Member Functions |
---|
| ~CSenBaseFragment() |
IMPORT_C CSenElement & | AsElement() |
IMPORT_C HBufC8 * | AsXmlL() |
IMPORT_C HBufC * | AsXmlUnicodeL() |
IMPORT_C TInt | BuildFrom(const TDesC8 &) |
IMPORT_C TBool | ConsistsOfL(MSenFragment &) |
IMPORT_C TPtrC8 | Content() |
IMPORT_C void | DelegateParsingL(MSenFragment &) |
IMPORT_C void | DelegateParsingL(const TDesC8 &, const TDesC8 &, const TDesC8 &, const RAttributeArray &) |
IMPORT_C void | DetachL() |
IMPORT_C void | EnsureNamespace(const TDesC8 &) |
IMPORT_C CSenElement * | ExtractElement() |
IMPORT_C const TDesC8 & | LocalName() |
IMPORT_C CSenNamespace * | Namespace(const TDesC8 &) |
IMPORT_C CSenBaseFragment * | NewL(const CSenElement &) |
IMPORT_C CSenBaseFragment * | NewL(const TDesC8 &) |
IMPORT_C CSenBaseFragment * | NewL(const TDesC8 &, const TDesC8 &) |
IMPORT_C CSenBaseFragment * | NewL(const TDesC8 &, const TDesC8 &, const TDesC8 &) |
IMPORT_C CSenBaseFragment * | NewL(const TDesC8 &, const TDesC8 &, const TDesC8 &, const RAttributeArray &) |
IMPORT_C CSenBaseFragment * | NewL(const TDesC8 &, const TDesC8 &, const TDesC8 &, const RAttributeArray &, CSenElement &) |
IMPORT_C const TDesC8 & | NsPrefix() |
IMPORT_C const TDesC8 & | NsUri() |
IMPORT_C void | ParseL(const TDesC8 &) |
IMPORT_C void | ParseWithL(CSenXmlReader &) |
IMPORT_C CSenXmlReader * | Reader() |
IMPORT_C void | ResetContentL() |
IMPORT_C void | ResumeParsingFromL(const TDesC8 &, const TDesC8 &, const TDesC8 &) |
IMPORT_C void | SaveNamespacesL(const RAttributeArray &, TBool) |
IMPORT_C void | SetAttributesL(const RAttributeArray &) |
IMPORT_C void | SetOwner(MSenFragment &) |
IMPORT_C void | SetReader(CSenXmlReader &) |
IMPORT_C void | WriteAsXMLToL(RWriteStream &) |
IMPORT_C void | WriteEndElementL(const TDesC8 &, const TDesC8 &, const TDesC8 &) |
IMPORT_C void | WriteStartElementL(const TDesC8 &, const TDesC8 &, const TDesC8 &, const RAttributeArray &) |
Protected Member Functions |
---|
| CSenBaseFragment() |
IMPORT_C void | AllocContentSaverL() |
IMPORT_C void | BaseConstructL(const CSenElement &) |
IMPORT_C void | BaseConstructL(const TDesC8 &) |
IMPORT_C void | BaseConstructL(const TDesC8 &, const TDesC8 &) |
IMPORT_C void | BaseConstructL(const TDesC8 &, const TDesC8 &, const TDesC8 &) |
IMPORT_C void | BaseConstructL(const TDesC8 &, const TDesC8 &, const TDesC8 &, const RAttributeArray &) |
IMPORT_C void | BaseConstructL(const TDesC8 &, const TDesC8 &, const TDesC8 &, const RAttributeArray &, CSenElement &) |
IMPORT_C void | BaseConstructL(CSenXmlReader &) |
IMPORT_C void | CharactersL(const TDesC8 &, TInt, TInt) |
IMPORT_C TPtrC8 | ContentOf(const TDesC8 &) |
IMPORT_C void | EndElementL(const TDesC8 &, const TDesC8 &, const TDesC8 &) |
IMPORT_C MSenElement & | SetContentOfL(const TDesC8 &, const TDesC8 &) |
IMPORT_C void | StartElementL(const TDesC8 &, const TDesC8 &, const TDesC8 &, const RAttributeArray &) |
IMPORT_C TInt | StartEntity(TDesC8 &) |
Constructor & Destructor Documentation
CSenBaseFragment()
IMPORT_C | CSenBaseFragment | ( | ) | [protected] |
~CSenBaseFragment()
IMPORT_C | ~CSenBaseFragment | ( | ) | [virtual] |
Member Functions Documentation
AllocContentSaverL()
IMPORT_C void | AllocContentSaverL | ( | ) | [protected, virtual] |
Makes the content internal stream for content saving available.
- Since
- Series60 3.0
AsElement()
Getting the fragment as an XML element. This method will panic if element has not been initialized for any reason.
- Since
- Series60 3.0
AsXmlL()
IMPORT_C HBufC8 * | AsXmlL | ( | ) | [virtual] |
Gets the fragment data as an UTF-8 form XML.
- Since
- Series60 3.0
AsXmlUnicodeL()
IMPORT_C HBufC * | AsXmlUnicodeL | ( | ) | [virtual] |
Gets the fragment data as an unicode XML.
- Since
- Series60 3.0
BaseConstructL(const CSenElement &)
IMPORT_C void | BaseConstructL | ( | const CSenElement & | aElement | ) | [protected] |
Following BaseConstructL methods should be called from ConstructL() methods of some deriving (fragment) class. BaseConstructL, where an element is given as initializer.
- Since
- Series60 3.0
Parameters
const CSenElement & aElement | from which this fragment will be constructed from. |
BaseConstructL(const TDesC8 &)
IMPORT_C void | BaseConstructL | ( | const TDesC8 & | aLocalName | ) | [protected] |
BaseConstructL setting XML localname for this fragment.
- Since
- Series60 3.0
Parameters
const TDesC8 & aLocalName | XML localname for this fragment |
BaseConstructL(const TDesC8 &, const TDesC8 &)
IMPORT_C void | BaseConstructL | ( | const TDesC8 & | aNsUri, |
| const TDesC8 & | aLocalName |
| ) | [protected] |
BaseConstructL offering possibility to set XML namespace and localname.
- Since
- Series60 3.0
Parameters
const TDesC8 & aNsUri | XML namespace URI for this fragment |
const TDesC8 & aLocalName | XML localname for this fragment |
BaseConstructL(const TDesC8 &, const TDesC8 &, const TDesC8 &)
IMPORT_C void | BaseConstructL | ( | const TDesC8 & | aNsUri, |
| const TDesC8 & | aLocalName, |
| const TDesC8 & | aQName |
| ) | [protected] |
Base constructor
- Since
- Series60 3.0
Parameters
const TDesC8 & aNsUri | XML namespace URI for this fragment |
const TDesC8 & aLocalName | XML localname for this fragment |
const TDesC8 & aQName | XML qualifiedname for this fragment |
BaseConstructL(const TDesC8 &, const TDesC8 &, const TDesC8 &, const RAttributeArray &)
Base constructor
- Since
- Series60 3.0
Parameters
const TDesC8 & aNsUri | XML namespace URI for this fragment |
const TDesC8 & aLocalName | XML localname for this fragment |
const TDesC8 & aQName | XML qualifiedname for this fragment |
const RAttributeArray & aAttrs | XML attributes for this fragment |
BaseConstructL(const TDesC8 &, const TDesC8 &, const TDesC8 &, const RAttributeArray &, CSenElement &)
Base constructor
- Since
- Series60 3.0
Parameters
const TDesC8 & aNsUri | XML namespace URI for this fragment |
const TDesC8 & aLocalName | XML localname for this fragment |
const TDesC8 & aQName | XML qualifiedname for this fragment |
const RAttributeArray & aAttrs | XML attributes for this fragment |
CSenElement & aParent | parent to be set for this fragmemt |
BaseConstructL(CSenXmlReader &)
BuildFrom(const TDesC8 &)
IMPORT_C TInt | BuildFrom | ( | const TDesC8 & | aXml | ) | [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
Characters(const TDesC8 &, const TInt, const TInt)
IMPORT_C TInt | Characters | ( | const TDesC8 & | aChars, |
| const TInt | aStart, |
| const TInt | aLength |
| ) | [private, virtual] |
CharactersL(const TDesC8 &, TInt, TInt)
IMPORT_C void | CharactersL | ( | const TDesC8 & | aChars, |
| TInt | aStart, |
| TInt | aLength |
| ) | [protected, virtual] |
Function which implement the XML content handler interface. Inheriting classes can override these. This one is called when content is starting.
- Since
- Series60 3.0
Parameters
const TDesC8 & aChars | The content characters. |
TInt aStart | The starting index |
TInt aLength | The length of the characters. |
ConsistsOfL(MSenFragment &)
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
Parameters
MSenFragment & aCandidate | The pattern to be matched. Must contain same or less data for match to come true. |
Content()
IMPORT_C TPtrC8 | Content | ( | ) | [virtual] |
Getter for the content,which is returned as UTF-8 form XML.
- Since
- Series60 3.0
ContentL()
Leaving variant which is then trapped in the non-leaving function.
ContentOf(const TDesC8 &)
IMPORT_C TPtrC8 | ContentOf | ( | const TDesC8 & | aLocalName | ) | [protected] |
Gets the content of a given element.
- Since
- Series60 3.0
Parameters
const TDesC8 & aLocalName | The local name of the element which content is asked |
DelegateParsingL(MSenFragment &)
IMPORT_C void | DelegateParsingL | ( | MSenFragment & | aDelegate | ) | [virtual] |
Leave codes: KErrSenXmlReaderNotSet if XML reader has not been set. 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.
- Since
- Series60 3.0
Parameters
MSenFragment & aDelegate | is the fragment to start handling the SAX events. |
DelegateParsingL(const TDesC8 &, const TDesC8 &, const TDesC8 &, const RAttributeArray &)
Leave codes: KErrSenXmlReaderNotSet if XML reader has not been set. Creates a new fragment and lets the created
MSenFragment handle the following SAX events. This fragment is made the owner of the delegate and the delegate is expected to make this
MSenFragment act as receiver for SAX events (callbacks) once it has seen the end element for itself.
- Since
- Series60 3.0
Parameters
const TDesC8 & aNsUri | The XML namespace URI for the delegate to be created |
const TDesC8 & aLocalName | The XML localname for the delegate to be created |
const TDesC8 & aQName | The XML qualifiedname for the delegate to be created |
const RAttributeArray & aAttrs | |
DetachL()
IMPORT_C void | DetachL | ( | ) | [virtual] |
EndDocument()
IMPORT_C TInt | EndDocument | ( | ) | [private, virtual] |
EndElement(const TDesC8 &, const TDesC8 &, const TDesC8 &)
IMPORT_C TInt | EndElement | ( | const TDesC8 & | aNsUri, |
| const TDesC8 & | aLocalName, |
| const TDesC8 & | aQName |
| ) | [private, virtual] |
EndElementL(const TDesC8 &, const TDesC8 &, const TDesC8 &)
IMPORT_C void | EndElementL | ( | const TDesC8 & | aNsUri, |
| const TDesC8 & | aLocalName, |
| const TDesC8 & | aQName |
| ) | [protected, virtual] |
Callback function which implement the XML content handler interface. Inheriting classes can override these.
- Since
- Series60 3.0
Parameters
const TDesC8 & aNsUri | The namespace URI of the new element |
const TDesC8 & aLocalName | The local name of the new element |
const TDesC8 & aQName | The qualified name of the new element |
EnsureNamespace(const TDesC8 &)
IMPORT_C void | EnsureNamespace | ( | const TDesC8 & | aPrefix | ) | [virtual] |
Parameters
const TDesC8 & aPrefix | is the XML namespace prefix |
Error(TInt)
IMPORT_C TInt | Error | ( | TInt | aErrorCode | ) | [private, virtual] |
ExtractElement()
Etracts the XML element from the fragment, leaving the fragment empty. Note(!): the return value (
CSenElement) STRONGLY suggests that subclasses INHERIT
CSenFragment in order properly comply the requirement of the
ExtractElement() implementation.
- Since
- Series60 3.0
LocalName()
IMPORT_C const TDesC8 & | LocalName | ( | ) | const [virtual] |
Namespace(const TDesC8 &)
Gets the namespace object with a given prefix.
- Since
- Series60 3.0
NewL(const CSenElement &)
Standard 2 phase constructor.
- Since
- Series60 3.0
Parameters
const CSenElement & aElement | is the element where construction data will be copied from. |
NewL(const TDesC8 &)
Standard 2 phase constructor. Leave codes: KErrSenInvalidCharacters if aLocalName contains illegal characters. KErrSenZeroLengthDescriptor if aLocalName is zero length.
- Since
- Series60 3.0
NewL(const TDesC8 &, const TDesC8 &)
Standard 2 phase constructor. Leave codes: KErrSenInvalidCharacters if aLocalName contains illegal characters. KErrSenZeroLengthDescriptor if aLocalName is zero length.
- Since
- Series60 3.0
NewL(const TDesC8 &, const TDesC8 &, const TDesC8 &)
Standard 2 phase constructor. Leave codes: KErrSenInvalidCharacters if aLocalName or aQName contains illegal characters. KErrSenZeroLengthDescriptor if aLocalName or aQName is zero length.
- Since
- Series60 3.0
NewL(const TDesC8 &, const TDesC8 &, const TDesC8 &, const RAttributeArray &)
Standard 2 phase constructor. Leave codes: KErrSenInvalidCharacters if aLocalName or aQName contains illegal characters. KErrSenZeroLengthDescriptor if aLocalName or aQName is zero length.
- Since
- Series60 3.0
NewL(const TDesC8 &, const TDesC8 &, const TDesC8 &, const RAttributeArray &, CSenElement &)
Standard 2 phase constructor.
- Since
- Series60 3.0
NsPrefix()
IMPORT_C const TDesC8 & | NsPrefix | ( | ) | const [virtual] |
Getter for namespace prefix of this fragment.
- Since
- Series60 3.0
NsUri()
IMPORT_C const TDesC8 & | NsUri | ( | ) | const [virtual] |
Getter for Fragment's namespace URI..
- Since
- Series60 3.0
ParseL(const TDesC8 &)
IMPORT_C void | ParseL | ( | const TDesC8 & | aXml | ) | [virtual] |
Leave codes: KErrSenXmlReaderNotSet if XML reader has not been set. Method to invoke parsing of a XML data. Note that
SetReader() must be called before this method can be used. Note that
CSenBaseFragment does not parse any other attributes, but XML namespace attributes only. This is due to allow subclasses to process only those attributes they are interested in, and not others.
- Since
- Series60 3.0
ParseWithL(CSenXmlReader &)
Sets the reader for this fragment and sets this to be the content handler of the following SAX events.
- Since
- Series60 3.0
Reader()
Gets the XML reader which this fragment uses for parsing.
- Since
- Series60 3.0
ResetContentL()
IMPORT_C void | ResetContentL | ( | ) | [virtual] |
Resets the content of the fragment, and resets the namespaces.
- Since
- Series60 3.0
ResumeParsingFromL(const TDesC8 &, const TDesC8 &, const TDesC8 &)
IMPORT_C void | ResumeParsingFromL | ( | const TDesC8 & | aNsUri, |
| const TDesC8 & | aLocalName, |
| const TDesC8 & | aQName |
| ) | [virtual] |
Leave codes: KErrSenXmlReaderNotSet if XML reader has not been set. Resumes parsing to be handled by this fragment. Usually called by some delegate fragment which was set to be content handler because this fragment called
DelegateParsingL().
- Since
- Series60 3.0
Parameters
const TDesC8 & aNsUri | The namespace URI of the current element |
const TDesC8 & aLocalName | The local name of the current element |
const TDesC8 & aQName | The qualified name of the current element |
SaveNamespacesL(const RAttributeArray &, TBool)
Parameters
const RAttributeArray & aAttrs | are the attributes from which the namespaces are searched from. |
TBool aEnsure | if set to TRUE, the namespaces are copied into this fragment. If FALSE, then the namespaces are only referenced, but not copied and owned by this class. |
SetAttributesL(const RAttributeArray &)
Sets the attributes for the fragment. BaseFragment parses only namespace (xmlns) attributes from the document. Subclasses should override this method if they are intrested of handling any other XML attributes and their corresponding values.
- Since
- Series60 3.0
SetContentOfL(const TDesC8 &, const TDesC8 &)
Sets content to a child element. If no element with given local name is not found, new one is added and content is set to that one.
- Since
- Series60 3.0
Parameters
const TDesC8 & aLocalName | The local name of element which content is about to be set |
const TDesC8 & aContent | Content to be set. |
SetOwner(MSenFragment &)
Sets a new parent for this fragment.
- Since
- Series60 3.0
SetReader(CSenXmlReader &)
Sets the XML reader to be used for parsing for the fragment.
- Since
- Series60 3.0
StartDocument()
IMPORT_C TInt | StartDocument | ( | ) | [private, virtual] |
StartElement(const TDesC8 &, const TDesC8 &, const TDesC8 &, const RAttributeArray &)
StartElementL(const TDesC8 &, const TDesC8 &, const TDesC8 &, const RAttributeArray &)
Callback function implementing the XML content handler interface. Inheriting classes can override these.
- Since
- Series60 3.0
Parameters
const TDesC8 & aNsUri | The namespace URI of the new element |
const TDesC8 & aLocalName | The local name of the new element |
const TDesC8 & aQName | The qualified name of the new element |
const RAttributeArray & aAttrs | The attributes of the new element |
StartEntity(TDesC8 &)
IMPORT_C TInt | StartEntity | ( | TDesC8 & | aName | ) | [protected] |
Callback function which implement the XML content handler interface. Inheriting classes can override these. Note that overrides should return TRUE (1) on success and FALSE (0) on failure to parser.
WriteAsXMLToL(RWriteStream &)
Invokes
AsElement()->WriteAsXMLToL(aWs);
- Since
- Series60 3.0
Parameters
RWriteStream & aWs | is the stream into which the UTF-8 form XML will be written. |
WriteEndElementL(const TDesC8 &, const TDesC8 &, const TDesC8 &)
IMPORT_C void | WriteEndElementL | ( | const TDesC8 & | aNsUri, |
| const TDesC8 & | aLocalName, |
| const TDesC8 & | aQName |
| ) | [virtual] |
Writes the end element tag to the content stream. Derivants can override the basic usage used in BaseFragment.
- Since
- Series60 3.0
Parameters
const TDesC8 & aNsUri | The namespace URI of the current element |
const TDesC8 & aLocalName | The local name of the current element |
const TDesC8 & aQName | The qualified name of the current element |
WriteStartElementL(const TDesC8 &, const TDesC8 &, const TDesC8 &, const RAttributeArray &)
Writes the start element tag to the content stream. Derivants can override the basic usage used in BaseFragment.
- Since
- Series60 3.0
Parameters
const TDesC8 & aNsUri | The namespace URI of the current element |
const TDesC8 & aLocalName | The local name of the current element |
const TDesC8 & aQName | The qualified name of the current element |
const RAttributeArray & aAttrs | is the array of attributes. |
Member Data Documentation
TBool
hasContentWriteStream
TBool
| hasContentWriteStream | [private] |
TBool
iElementOwned
TBool
| iElementOwned | [private] |
RPointerArray< CSenNamespace > iNamespaces
RPointerArray< HBufC8 > iPrefixes
CSenXmlReader * iXmlReader
CBufFlat * ipContentWithNamespaces
CBufFlat * | ipContentWithNamespaces | [private] |
CSenFragment * ipDelegate
Copyright ©2010 Nokia Corporation and/or its subsidiary(-ies).
All rights
reserved. Unless otherwise stated, these materials are provided under the terms of the Eclipse Public License
v1.0.