MSenElement Class Reference

API published in: S60 3rd Ed

Link against: senxml.lib

Capability Information

Required Capabilities

None


#include <msenelement.h>

Inherited by CSenElement.


Detailed Description

The abstract interface of an XML element.

Public Member Functions

virtual const TDesC8 &  LocalName () const =0
  Getter for Element's local name.
virtual const TDesC8 &  NamespaceURI () const =0
  Getter for Element's 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 AddNamespaceL (CSenNamespace &aNewNamespace, TBool aCheckInParent)=0
  Adds a namespace declaration.
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 its content and child elements.
virtual RPointerArray< CSenElement > &  ElementsL ()=0
  Getting the child elements of this element.
virtual CSenElement Child (TInt aIndex)=0
  Gets a child element from a specified index.
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 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 element as an UTF-8 form XML.
virtual HBufC *  AsXmlUnicodeL ()=0
  Gets the element as XML fragment in UTF-8 format.
virtual void  WriteAsXMLToL (RWriteStream &aWriteStream)=0
  Writes this element as XML, in UTF-8 form to a stream.
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 &aAttrs)=0
  Adds new attributes to the element.

Member Function Documentation

virtual void MSenElement::AddAttributesL const RAttributeArray &  aAttrs  )  [pure virtual]
 

Adds new attributes to the element.

Parameters:
aAttrs,:  the array of attributes.

Implemented in CSenBaseElement, and CSenElement.

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

Implemented in CSenBaseElement, and CSenElement.

virtual CSenElement& MSenElement::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.

Implemented in CSenBaseElement, and CSenElement.

virtual CSenElement& MSenElement::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.

Implemented in CSenBaseElement, and CSenElement.

virtual CSenElement& MSenElement::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.

Implemented in CSenBaseElement, and CSenElement.

virtual CSenElement& MSenElement::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

Implemented in CSenBaseElement, and CSenElement.

virtual const CSenNamespace* MSenElement::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.

Implemented in CSenBaseElement, and CSenElement.

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

Method for adding a namespace for the Element.

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

Implemented in CSenBaseElement, and CSenElement.

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

Implemented in CSenBaseElement, and CSenElement.

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

Gets element as an UTF-8 form XML.

Returns:
element as XML (in UTF-8 format). Caller takes ownership.

Implemented in CSenBaseElement, and CSenElement.

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

Gets the element as XML fragment in UTF-8 format.

Returns:
the service description as XML, which ownership is transferred to the caller.

Implemented in CSenBaseElement, and CSenElement.

virtual RPointerArray<CSenBaseAttribute>& MSenElement::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.

Implemented in CSenBaseElement, and CSenElement.

virtual const TDesC8* MSenElement::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.

Implemented in CSenBaseElement, and CSenElement.

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

Implemented in CSenBaseElement, and CSenElement.

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

Checks if element matches to another element by its 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.

Implemented in CSenBaseElement, and CSenElement.

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

Getter for the content of the element.

Returns:
the content or KNullDesC8 if empty.

Implemented in CSenBaseElement, and CSenElement.

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

Getter for the content of the element, unicode version.

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

Implemented in CSenBaseElement, and CSenElement.

virtual RWriteStream& MSenElement::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.

Implemented in CSenBaseElement, and CSenElement.

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

Implemented in CSenBaseElement, and CSenElement.

virtual CSenElement* MSenElement::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 or aQName contain illegal characters. KErrSenZeroLengthDescriptor if aLocalName is zero length.

Implemented in CSenBaseElement, and CSenElement.

virtual CSenElement* MSenElement::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. Returns NULL if no parent was set, and nothing was detached.

Implemented in CSenBaseElement, and CSenElement.

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

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

Returns:
the child element or NULL if the child with the specified criterias is not found. Ownership is NOT transferred.

Implemented in CSenBaseElement, and CSenElement.

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

Returns:
the child element or NULL if the child with the specified local name is not found. Ownership is NOT transferred.

Implemented in CSenBaseElement, and CSenElement.

virtual RPointerArray<CSenElement>& MSenElement::ElementsL  )  [pure virtual]
 

Getting the child elements of this element.

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.

Implemented in CSenBaseElement, and CSenElement.

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

Method for checking if the element has any content within.

Returns:
ETrue if has content, EFalse if not.

Implemented in CSenBaseElement, and CSenElement.

virtual CSenElement& MSenElement::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

Implemented in CSenBaseElement, and CSenElement.

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

Getter for Element's local name.

Returns:
KNullDesC if not set

Implemented in CSenBaseElement, and CSenElement.

virtual const CSenNamespace* MSenElement::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

Implemented in CSenBaseElement, and CSenElement.

virtual const CSenNamespace* MSenElement::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.

Implemented in CSenBaseElement, and CSenElement.

virtual const CSenNamespace* MSenElement::Namespace const TDesC8 &  aNsPrefix  )  [pure virtual]
 
Parameters:
aNsPrefix,:  The prefix to be used in searching.
Returns:
the found Namespace that is declared for the given prefix within the scope of this Element or NULL if not found.

Implemented in CSenBaseElement, and CSenElement.

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

Getter for Element's namespace.

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

Implemented in CSenBaseElement, and CSenElement.

virtual RPointerArray<CSenNamespace>& MSenElement::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.

Implemented in CSenBaseElement, and CSenElement.

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

Getter for Element's namespace URI.

Returns:
Namespace URI or KNullDesC if not set.

Implemented in CSenBaseElement, and CSenElement.

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

Getter for namespace prefix of this element.

Returns:
namespace prefix or KNullDesC8 if not set.

Implemented in CSenBaseElement, and CSenElement.

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

Implemented in CSenBaseElement, and CSenElement.

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

Implemented in CSenBaseElement, and CSenElement.

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

Implemented in CSenBaseElement, and CSenElement.

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

Implemented in CSenBaseElement, and CSenElement.

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

Implemented in CSenBaseElement, and CSenElement.

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

Gets the root element.

If no parent element, returns this element.

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

Implemented in CSenBaseElement, and CSenElement.

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

Implemented in CSenBaseElement, and CSenElement.

virtual TPtrC8 MSenElement::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.

Implemented in CSenBaseElement, and CSenElement.

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

Setter for Element's namespace URI.

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

Implemented in CSenBaseElement, and CSenElement.

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

Setter for Element's namespace URI.

Parameters:
aNsUri,:  Namespace URI

Implemented in CSenBaseElement, and CSenElement.

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

Implemented in CSenBaseElement, and CSenElement.

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

Setter for namespace prefix of this element.

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

Implemented in CSenBaseElement, and CSenElement.

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

Writes this element as XML, in UTF-8 form to a stream.

Parameters:
aWriteStream  to write into.

Implemented in CSenBaseElement, and CSenElement.

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

Implemented in CSenBaseElement, and CSenElement.


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

Copyright © Nokia Corporation 2001-2008
Back to top