CSenElement Class Reference

API published in: S60 3rd Ed

Link against: senxml.lib

Capability Information

Required Capabilities

None


#include <senelement.h>

Inherits MSenElement.

Inherited by CSenBaseElement.


Detailed Description

Abstract class definition of XML element.

Public Member Functions

virtual const TDesC8 &  LocalName () const =0
  Getter for local name.
virtual const TDesC8 &  NamespaceURI () const =0
  Getter for namespace URI.
virtual void  SetNamespaceL (const TDesC8 &aNsUri)=0
  Setter for Element's namespace URI.
virtual void  SetNamespaceL (const TDesC8 &aNsPrefix, const TDesC8 &aNsUri)=0
  Setter for Element's namespace URI.
virtual const CSenNamespace AddNamespaceL (const TDesC8 &aPrefix, const TDesC8 &aUri)=0
  Method for adding a namespace for the Element.
virtual const CSenNamespace Namespace ()=0
  Getter for Element's namespace.
virtual const CSenNamespace Namespace (const TDesC8 &aNsPrefix)=0
virtual const CSenNamespace Namespace (const TDesC8 &aNsPrefix, const TDesC8 &aUri)=0
virtual const CSenNamespace Namespace (const TDesC8 &aNsPrefix, const TBool aCheckInParent)=0
virtual const TDesC8 &  NsPrefix () const =0
  Getter for namespace prefix of this element.
virtual void  SetPrefixL (const TDesC8 &aPrefix)=0
  Setter for namespace prefix of this element.
virtual TBool  HasContent () const =0
  Method for checking if the element has any content within.
virtual TPtrC8  Content () const =0
  Getter for the content of the element.
virtual HBufC *  ContentUnicodeL () const =0
  Getter for the content of the element, unicode version.
virtual TPtrC8  SetContentL (const TDesC8 &aContent)=0
  Sets the content to the element.
virtual RWriteStream &  ContentWriteStreamL ()=0
  Gets the write stream for the content for easy appending.
virtual TBool  ConsistsOfL (MSenElement &aCandidate)=0
  Checks if element matches to another element by it's content and child elements.
virtual TInt  ElementsL (RPointerArray< CSenElement > &aElementArray, const TDesC8 &aNsUri, const TDesC8 &aLocalName)=0
  Get a list of direct children element that have the given name and namespace.
virtual TInt  ElementsL (RPointerArray< CSenElement > &aElementArray, const TDesC8 &aLocalName)=0
  Get a list of direct children element that have the given name and same namespace as this parent Element.
virtual RPointerArray< CSenElement > &  ElementsL ()=0
virtual const CSenNamespace AddNamespaceL (CSenNamespace &aNewNamespace, TBool aCheckInParent)=0
  Adds a namespace declaration.
virtual const TDesC8 *  AttrValue (const TDesC8 &aName)=0
  Gets the value of the given attribute.
virtual void  AddAttrL (const TDesC8 &aName, const TDesC8 &aValue)=0
  Adds an attribute.
virtual RPointerArray< CSenBaseAttribute > &  AttributesL ()=0
  Gets all the attributes of this element in an array.
virtual RPointerArray< CSenNamespace > &  NamespacesL ()=0
  Gets all the namespaces of this element in an array.
virtual CSenElement Parent ()=0
  Gets the parent element of this element.
virtual CSenElement SetParent (CSenElement *apParent)=0
  Sets the parent element to this element.
virtual CSenElement DetachL ()=0
  Detach the element from its parent.
virtual CSenElement Child (TInt aIndex)=0
  Gets a child element from a specified index.
virtual MSenElement Root ()=0
  Gets the root element.
virtual CSenElement Element (const TDesC8 &aLocalName)=0
  Gets the child element with the specified local name.
virtual CSenElement Element (const TDesC8 &aNsUri, const TDesC8 &aLocalName)=0
  Gets the child element with the specified local name and namespace URI.
virtual CSenElement CreateElementL (const TDesC8 &aNsPrefix, const TDesC8 &aLocalName)=0
  Create a new element ready for adding or insertion.
virtual CSenElement InsertElementL (CSenElement &aInsertedElement, const CSenElement &aBeforeElement)=0
  Insert an Element into the list of children elements so that the inserted Element is placed right before the aBeforeElement.
virtual CSenElement AddElementL (CSenElement &aElement)=0
  Adds an Element to the children elements.
virtual CSenElement AddElementL (const TDesC8 &aNsUri, const TDesC8 &aLocalName)=0
  Constructs and adds a new element to the children elements.
virtual CSenElement AddElementL (const TDesC8 &aNsUri, const TDesC8 &aLocalName, const TDesC8 &aQName)=0
  Constructs and adds a new element to the children elements.
virtual CSenElement AddElementL (const TDesC8 &aLocalName)=0
  Constructs and adds a new element to the children elements.
virtual CSenElement RemoveElement (CSenElement &aElement)=0
  Remove an element from the childs.
virtual CSenElement RemoveElement (const TDesC8 &aNsUri, const TDesC8 &aLocalName)=0
  Remove an element from the childs.
virtual CSenElement RemoveElement (const TDesC8 &aLocalName)=0
  Remove an element from the childs.
virtual CSenElement ReplaceElementL (CSenElement &aElement)=0
  Replaces an element from the childs with another element.
virtual HBufC8 *  AsXmlL ()=0
  Gets the element as an XML buffer.
virtual HBufC *  AsXmlUnicodeL ()=0
  Gets the element as an unicode XML buffer.
virtual void  WriteAsXMLToL (RWriteStream &aWriteStream)=0
  Element writes itself to a write stream using UTF-8 charset encoding.
virtual void  WriteNamespacesToL (RWriteStream &aWriteStream)=0
  Element writes its namespaces to a write stream using UTF-8 charset encoding.
virtual MSenElement AsElement ()=0
  Gets the current element as XML element.
virtual void  CopyFromL (CSenElement &aSource)=0
  Copies content from given element to this element appending to the existing content if there is any.
virtual void  Set (const TDesC8 &aNamespaceURI, const TDesC8 &aLocalName, const TDesC8 &aQName)=0
  (Re-) Set the name and namespace of this Element.
virtual void  AddAttributesL (const RAttributeArray &apAttrs)=0
  Adds new attributes to the element.

Member Function Documentation

virtual void CSenElement::AddAttributesL const RAttributeArray &  apAttrs  )  [pure virtual]
 

Adds new attributes to the element.

Parameters:
aAttrs,:  the array of attributes.

Implements MSenElement.

Implemented in CSenBaseElement.

virtual void CSenElement::AddAttrL const TDesC8 &  aName,
const TDesC8 &  aValue
[pure virtual]
 

Adds an attribute.

If attribute is already existing, the value of the attribute will be replaced.

Parameters:
aName  Name of the attribute to be added.
aValue  Value of the attribute to be added.

Implements MSenElement.

Implemented in CSenBaseElement.

virtual CSenElement& CSenElement::AddElementL const TDesC8 &  aLocalName  )  [pure virtual]
 

Constructs and adds a new element to the children elements.

Sets this element to be the new parent of the given element. Note: Element is created with no specific namespace, default namespace of some of the upper level elements are in effect if there is such a namespace.

Parameters:
aLocalName  local name of the new element
Returns:
the added Element Leave codes: KErrSenInvalidCharacters if aLocalName contains illegal characters. KErrSenZeroLengthDescriptor if aLocalName is zero length.

Implements MSenElement.

Implemented in CSenBaseElement.

virtual CSenElement& CSenElement::AddElementL const TDesC8 &  aNsUri,
const TDesC8 &  aLocalName,
const TDesC8 &  aQName
[pure virtual]
 

Constructs and adds a new element to the children elements.

Sets this element to be the new parent of the given element.

Parameters:
aNsUri  namespace URI of the new element
aLocalName  local name of the new element
aQName  qualified name of the new element
Returns:
the added Element Leave codes: KErrSenInvalidCharacters if aLocalName or aQName contain illegal characters. KErrSenZeroLengthDescriptor if aLocalName or aQName is zero length.

Implements MSenElement.

Implemented in CSenBaseElement.

virtual CSenElement& CSenElement::AddElementL const TDesC8 &  aNsUri,
const TDesC8 &  aLocalName
[pure virtual]
 

Constructs and adds a new element to the children elements.

Sets this element to be the new parent of the given element.

Parameters:
aNsUri  namespace URI of the new element
aLocalName  local name of the new element
Returns:
the added Element Leave codes: KErrSenInvalidCharacters if aLocalName contains illegal characters. KErrSenZeroLengthDescriptor if aLocalName is zero length.

Implements MSenElement.

Implemented in CSenBaseElement.

virtual CSenElement& CSenElement::AddElementL CSenElement aElement  )  [pure virtual]
 

Adds an Element to the children elements.

Sets this element to be the new parent of the given element.

Parameters:
aElement,:  the element to be added. Ownership is transferred.
Returns:
the added Element

Implements MSenElement.

Implemented in CSenBaseElement.

virtual const CSenNamespace* CSenElement::AddNamespaceL CSenNamespace aNewNamespace,
TBool  aCheckInParent
[pure virtual]
 

Adds a namespace declaration.

If this element (or its parent if parameter aCheckInParent is ETrue) already has a Namespace with the same prefix and URI the given Namespace is not added.

Parameters:
aNewNamespace 
aCheckInParent 
Returns:
the added Namespace, or the equivalent pre-existing one.

Implements MSenElement.

Implemented in CSenBaseElement.

virtual const CSenNamespace* CSenElement::AddNamespaceL const TDesC8 &  aPrefix,
const TDesC8 &  aUri
[pure virtual]
 

Method for adding a namespace for the Element.

Parameters:
aPrefix,:  Namespace prefix
aUri,:  Namespace URI
Returns:
the added Namespace, or the equivalent pre-existing one.

Implements MSenElement.

Implemented in CSenBaseElement.

virtual MSenElement* CSenElement::AsElement  )  [pure virtual]
 

Gets the current element as XML element.

Mostly used to get the classes which implement this interface as an instance of this interface.

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

Implements MSenElement.

Implemented in CSenBaseElement.

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

Gets the element as an XML buffer.

Buffer will contain all the childs etc.

Returns:
element as XML. Caller takes ownership.

Implements MSenElement.

Implemented in CSenBaseElement.

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

Gets the element as an unicode XML buffer.

Buffer will contain all the childs etc.

Returns:
element as XML. Caller takes ownership.

Implements MSenElement.

Implemented in CSenBaseElement.

virtual RPointerArray<CSenBaseAttribute>& CSenElement::AttributesL  )  [pure virtual]
 

Gets all the attributes of this element in an array.

Returns:
array of attributes. Array will be empty if element has no attributes.

Implements MSenElement.

Implemented in CSenBaseElement.

virtual const TDesC8* CSenElement::AttrValue const TDesC8 &  aName  )  [pure virtual]
 

Gets the value of the given attribute.

Parameters:
aName,:  Name of the attribute in question.
Returns:
the value of the attribute, or NULL if not found. Ownership is NOT TRANSFERRED.

Implements MSenElement.

Implemented in CSenBaseElement.

virtual CSenElement* CSenElement::Child TInt  aIndex  )  [pure virtual]
 

Gets a child element from a specified index.

Parameters:
aIndex,:  the index what to get
Returns:
child element from a current index. NULL if no child in given index is found

Implements MSenElement.

Implemented in CSenBaseElement.

virtual TBool CSenElement::ConsistsOfL MSenElement aCandidate  )  [pure virtual]
 

Checks if element matches to another element by it's content and child elements.

Element can contain more data than the given pattern.

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.

Implements MSenElement.

Implemented in CSenBaseElement.

virtual TPtrC8 CSenElement::Content  )  const [pure virtual]
 

Getter for the content of the element.

Returns:
the content or KNullDesC8 if empty.

Implements MSenElement.

Implemented in CSenBaseElement.

virtual HBufC* CSenElement::ContentUnicodeL  )  const [pure virtual]
 

Getter for the content of the element, unicode version.

Returns:
content as unicode. Ownership IS TRANSFERRED to the caller.

Implements MSenElement.

Implemented in CSenBaseElement.

virtual RWriteStream& CSenElement::ContentWriteStreamL  )  [pure virtual]
 

Gets the write stream for the content for easy appending.

Writing 8-bit (UTF-8) string to the returned stream will be appended to the content.

Returns:
reference to the RWriteStream.

Implements MSenElement.

Implemented in CSenBaseElement.

virtual void CSenElement::CopyFromL CSenElement aSource  )  [pure virtual]
 

Copies content from given element to this element appending to the existing content if there is any.

Parameters:
aSource  The source element.

Implements MSenElement.

Implemented in CSenBaseElement.

virtual CSenElement* CSenElement::CreateElementL const TDesC8 &  aNsPrefix,
const TDesC8 &  aLocalName
[pure virtual]
 

Create a new element ready for adding or insertion.

If the given namespace prefix is not declared yet the element will not be created and NULL will be returned.

Parameters:
aNsPrefix,:  The namespace prefix
aLocalName,:  The new elements localname
Returns:
the new Element just created, or NULL if given prefix was not declared yet. Ownership is transferred to the caller. Leave codes: KErrSenInvalidCharacters if aLocalName contain illegal characters. KErrSenZeroLengthDescriptor if aLocalName is zero length.

Implements MSenElement.

Implemented in CSenBaseElement.

virtual CSenElement* CSenElement::DetachL  )  [pure virtual]
 

Detach the element from its parent.

If the element, or one of its children, is dependent on a namespace declared in the scope of the parent copy those namespace declarations to this element.

Returns:
this Element. Ownership is NOT transferred to the caller. or NULL if no parent was set, and nothing was detached.

Implements MSenElement.

Implemented in CSenBaseElement.

virtual CSenElement* CSenElement::Element const TDesC8 &  aNsUri,
const TDesC8 &  aLocalName
[pure virtual]
 

Gets the child element with the specified local name and namespace URI.

Parameters:
aNsUri  is the XML namespace of the requested child element
aLocalName  is the XML localname of the requested child element
Returns:
the child element or NULL if the child with the specified criterias is not found. Ownership is NOT transferred.

Implements MSenElement.

Implemented in CSenBaseElement.

virtual CSenElement* CSenElement::Element const TDesC8 &  aLocalName  )  [pure virtual]
 

Gets the child element with the specified local name.

Assumes that namespace is the same as this parent element.

Parameters:
aLocalName  is the XML localname of the requested child element
Returns:
the child element or NULL if the child with the specified local name is not found. Ownership is NOT transferred.

Implements MSenElement.

Implemented in CSenBaseElement.

virtual RPointerArray<CSenElement>& CSenElement::ElementsL  )  [pure virtual]
 
Returns:
an array of child elements. This is an empty array if there are no children. Any modifications made on the returned array modify the element object.

Implements MSenElement.

Implemented in CSenBaseElement.

virtual TInt CSenElement::ElementsL RPointerArray< CSenElement > &  aElementArray,
const TDesC8 &  aLocalName
[pure virtual]
 

Get a list of direct children element that have the given name and same namespace as this parent Element.

Parameters:
aElementArray  RPointerArray that will hold matching elements
localName 
Returns:
KErrNone or some system-wide error code, if an error has occured.

Implemented in CSenBaseElement.

virtual TInt CSenElement::ElementsL RPointerArray< CSenElement > &  aElementArray,
const TDesC8 &  aNsUri,
const TDesC8 &  aLocalName
[pure virtual]
 

Get a list of direct children element that have the given name and namespace.

Parameters:
aElementArray  RPointerArray that will hold matching elements
namespaceURI 
localName 
Returns:
KErrNone or some system-wide error code, if an error has occured.

Implemented in CSenBaseElement.

virtual TBool CSenElement::HasContent  )  const [pure virtual]
 

Method for checking if the element has any content within.

Returns:
ETrue if has content, EFalse if not.

Implements MSenElement.

Implemented in CSenBaseElement.

virtual CSenElement& CSenElement::InsertElementL CSenElement aInsertedElement,
const CSenElement aBeforeElement
[pure virtual]
 

Insert an Element into the list of children elements so that the inserted Element is placed right before the aBeforeElement.

If aBeforeElement is not found, element will be appended to the last position. Function leaves if error occurs in inserting.

Parameters:
aInsertedElement  the element to be inserted. Ownership is transferred.
aBeforeElement  the element which will be right next to the element just inserted.
Returns:
the inserted Element

Implements MSenElement.

Implemented in CSenBaseElement.

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

Getter for local name.

Returns:
KNullDesC if not set (argumentless constructor).

Implements MSenElement.

Implemented in CSenBaseElement.

virtual const CSenNamespace* CSenElement::Namespace const TDesC8 &  aNsPrefix,
const TBool  aCheckInParent
[pure virtual]
 
Parameters:
aNsPrefix  The prefix used to search
aCheckInParent  The flag indicating whether to check parent's namespaces too if not found in the current element. ETrue to check, EFalse for not to check.
Returns:
the found Namespace that is declared for the given prefix and namespace URI within the scope of this Element or NULL if not found

Implements MSenElement.

Implemented in CSenBaseElement.

virtual const CSenNamespace* CSenElement::Namespace const TDesC8 &  aNsPrefix,
const TDesC8 &  aUri
[pure virtual]
 
Parameters:
aNsPrefix  The prefix used to search
aUri  The namespace URI used to search.
Returns:
the found Namespace that is declared for the given prefix and namespace URI within the scope of this Element or NULL if not found.

Implements MSenElement.

Implemented in CSenBaseElement.

virtual const CSenNamespace* CSenElement::Namespace const TDesC8 &  aNsPrefix  )  [pure virtual]
 
Parameters:
prefix 
Returns:
the Namespace that is declared for the given prefix within the scope of this Element. If no such prefix is declared return null.

Implements MSenElement.

Implemented in CSenBaseElement.

virtual const CSenNamespace* CSenElement::Namespace  )  [pure virtual]
 

Getter for Element's namespace.

Returns:
const pointer to the CSenNamespace object of this Element. NULL if not set.

Implements MSenElement.

Implemented in CSenBaseElement.

virtual RPointerArray<CSenNamespace>& CSenElement::NamespacesL  )  [pure virtual]
 

Gets all the namespaces of this element in an array.

Returns:
array of namespaces. Array will be empty if element has no namespaces.

Implements MSenElement.

Implemented in CSenBaseElement.

virtual const TDesC8& CSenElement::NamespaceURI  )  const [pure virtual]
 

Getter for namespace URI.

Returns:
KNullDesC if not set.

Implements MSenElement.

Implemented in CSenBaseElement.

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

Getter for namespace prefix of this element.

Returns:
namespace prefix or KNullDesC8 if not set.

Implements MSenElement.

Implemented in CSenBaseElement.

virtual CSenElement* CSenElement::Parent  )  [pure virtual]
 

Gets the parent element of this element.

Returns:
the parent element or NULL if no parent set. Ownership is NOT transferred to the caller.

Implements MSenElement.

Implemented in CSenBaseElement.

virtual CSenElement* CSenElement::RemoveElement const TDesC8 &  aLocalName  )  [pure virtual]
 

Remove an element from the childs.

Parameters:
aLocalName,:  the local name of the element to be removed.
Returns:
The removed element. May be NULL if nothing was removed (if element was not found from the childs). The caller TAKES OWNERSHIP of the removed element.

Implements MSenElement.

Implemented in CSenBaseElement.

virtual CSenElement* CSenElement::RemoveElement const TDesC8 &  aNsUri,
const TDesC8 &  aLocalName
[pure virtual]
 

Remove an element from the childs.

Parameters:
aNsUri,:  the namespace URI of the element to be removed.
aLocalName,:  the local name of the element to be removed.
Returns:
The removed element. May be NULL if nothing was removed (if element was not found from the childs). The caller TAKES OWNERSHIP of the removed element.

Implements MSenElement.

Implemented in CSenBaseElement.

virtual CSenElement* CSenElement::RemoveElement CSenElement aElement  )  [pure virtual]
 

Remove an element from the childs.

Parameters:
aElement,:  the element to be removed.
Returns:
The removed element. May be NULL if nothing was removed (if element was not found from the childs). The caller TAKES OWNERSHIP of the removed element.

Implements MSenElement.

Implemented in CSenBaseElement.

virtual CSenElement* CSenElement::ReplaceElementL CSenElement aElement  )  [pure virtual]
 

Replaces an element from the childs with another element.

Element's local name and namespace URI will be used to match the element to be replaced. If matching element is not found, will normally add the given element to the childs.

Parameters:
aElement,:  the element to be added. Ownership is transferred.
Returns:
The old element. May be NULL if nothing was replaced (if element was not found from the childs). The caller TAKES OWNERSHIP of the old element.

Implements MSenElement.

Implemented in CSenBaseElement.

virtual MSenElement& CSenElement::Root  )  [pure virtual]
 

Gets the root element.

If no parent element, returns this element.

Returns:
the root of the tree. Ownership is not transferred.

Implements MSenElement.

Implemented in CSenBaseElement.

virtual void CSenElement::Set const TDesC8 &  aNamespaceURI,
const TDesC8 &  aLocalName,
const TDesC8 &  aQName
[pure virtual]
 

(Re-) Set the name and namespace of this Element.

The element will be given the localName in the the given namespace. A prefix will be computed from the qualified name. This method should be used with care and is mainly intended for protected use in implementations.

Parameters:
aNamespaceURI  The new namespace URI.
aLocalName  The new local name.
aQName  The new qualified name.

Implements MSenElement.

Implemented in CSenBaseElement.

virtual TPtrC8 CSenElement::SetContentL const TDesC8 &  aContent  )  [pure virtual]
 

Sets the content to the element.

Old content is overwritten.

Parameters:
aContent  The content to be set. Can be KNullDesC8.
Returns:
The content of the element or KNullDesC8 if no content was set.

Implements MSenElement.

Implemented in CSenBaseElement.

virtual void CSenElement::SetNamespaceL const TDesC8 &  aNsPrefix,
const TDesC8 &  aNsUri
[pure virtual]
 

Setter for Element's namespace URI.

Parameters:
aNsPrefix,:  Namespace prefix
aNsUri,:  Namespace URI

Implements MSenElement.

Implemented in CSenBaseElement.

virtual void CSenElement::SetNamespaceL const TDesC8 &  aNsUri  )  [pure virtual]
 

Setter for Element's namespace URI.

Parameters:
  aNsUri: Namespace URI

Implements MSenElement.

Implemented in CSenBaseElement.

virtual CSenElement* CSenElement::SetParent CSenElement apParent  )  [pure virtual]
 

Sets the parent element to this element.

Notice that the element is not automatically added as a child of the parent. Parent's AddElementL() should be called instead.

Parameters:
apParent,:  The wanted parent. Can be NULL.
Returns:
the parent element

Implements MSenElement.

Implemented in CSenBaseElement.

virtual void CSenElement::SetPrefixL const TDesC8 &  aPrefix  )  [pure virtual]
 

Setter for namespace prefix of this element.

Parameters:
aPrefix,:  new namespace prefix for the element.

Implements MSenElement.

Implemented in CSenBaseElement.

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

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

Parameters:
aWriteStream  The stream to write to.

Implements MSenElement.

Implemented in CSenBaseElement.

virtual void CSenElement::WriteNamespacesToL RWriteStream &  aWriteStream  )  [pure virtual]
 

Element writes its namespaces to a write stream using UTF-8 charset encoding.

Parameters:
aWriteStream  The stream to write to.

Implements MSenElement.

Implemented in CSenBaseElement.


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

Copyright © Nokia Corporation 2001-2008
Back to top