TXmlEngAttr Class Reference

Link against: xmlengineDOM.lib


#include <
xmlengattr.h>

Inherits TXmlEngNode.


Detailed Description

Instance of TXmlEngAttr class represents an XML attribute in the DOM tree.

Is a storage attributes properties. Implements DOM action for it.

Dll XmlEngineDOM.lib
Since:
S60 v3.1

Public Member Functions

 TXmlEngAttr ()
 Default constructor.
IMPORT_C TXmlEngAttr CopyL () const
 Clones attribute node.
IMPORT_C const TXmlEngElement OwnerElement () const
 Get owner element.
IMPORT_C TPtrC8 Name () const
 Check attribute name.
IMPORT_C TPtrC8 Value () const
 Get element value.
IMPORT_C void WholeValueCopyL (RBuf8 &aBuffer) const
 Get copy of attribute content.
IMPORT_C void SetValueL (const TDesC8 &aNewValue)
 Sets new value of the attribute.
IMPORT_C void SetEscapedValueL (const TDesC8 &aNewValue)
 Sets new value from escaped XML character data that may contain entity references.
IMPORT_C void SetValueNoEncL (const TDesC8 &aNewValue)
 Sets new attribute value exactly as presented in the string.

Protected Member Functions

 TXmlEngAttr (void *aInternal)
 Constructor.

Constructor & Destructor Documentation

TXmlEngAttr::TXmlEngAttr  )  [inline]
 

Default constructor.

Since:
S60 v3.1
TXmlEngAttr::TXmlEngAttr void aInternal  )  [inline, protected]
 

Constructor.

Since:
S60 v3.1
Parameters:
aInternal attribute pointer

Member Function Documentation

IMPORT_C TXmlEngAttr TXmlEngAttr::CopyL  )  const
 

Clones attribute node.

Since:
S60 v3.1
Returns:
A copy of the attribute with its value
Note:
Namespace of the attribute is reset; use TXmlEngNode::CopyToL(TXmlEngNode), which finds appropriate or creates new namespace declaration on the new parent node (argument should be an TXmlEngElement handle)
See also:
CopyToL(TXmlEngNode)

Reimplemented from TXmlEngNode.

IMPORT_C TPtrC8 TXmlEngAttr::Name  )  const
 

Check attribute name.

Since:
S60 v3.1
Returns:
Local name of the attribute
Note:
Equal to TXmlEngNode::Name(), but works faster.
Never call this on NULL object!
See also:
TXmlEngNode::Name()

Reimplemented from TXmlEngNode.

IMPORT_C const TXmlEngElement TXmlEngAttr::OwnerElement  )  const
 

Get owner element.

Since:
S60 v3.1
Returns:
TXmlEngElement that contains the attribute
Same as TXmlEngNode::ParentNode() but returns TXmlEngElement instead of TXmlEngNode.
Note:
Copies of attributes [TXmlEngAttr::CopyL()] and newly created attribute nodes [RXmlEngDocument::CreateAttributeL(..)] do not have parent element until they are attached to some element.
IMPORT_C void TXmlEngAttr::SetEscapedValueL const TDesC8 &  aNewValue  ) 
 

Sets new value from escaped XML character data that may contain entity references.

The value as if it is an escaped contents from XML file. If the value contains entity references, then the resulting content of the attribute is a list of TXmlEngTextNode and TXmlEngEntityRefeerence nodes. Predefined entities are converted into characters they represent.

Parameters:
aNewValue is a new attribute value
Since:
S60 v3.1
See also:
TXmlEngAttr::SetValueL(const TDesC8&)
IMPORT_C void TXmlEngAttr::SetValueL const TDesC8 &  aNewValue  ) 
 

Sets new value of the attribute.

Provided new value will be escaped as needed.

@ since S60 v3.1

Parameters:
aNewValue A string value for the attribute
The new value should not contain entity references. Entity references are not expanded, but used as text, because the ampersand (&) character of reference is escaped.
See also:
SetEscapedValueL(const TDesC8&)

Reimplemented from TXmlEngNode.

IMPORT_C void TXmlEngAttr::SetValueNoEncL const TDesC8 &  aNewValue  ) 
 

Sets new attribute value exactly as presented in the string.

Predefined entities are not converted into characters they represent.

Parameters:
aNewValue is a new attribute value
Since:
S60 v3.2
See also:
TXmlEngAttr::SetValueL(const TDesC8&)
IMPORT_C TPtrC8 TXmlEngAttr::Value  )  const
 

Get element value.

Since:
S60 v3.1
Returns:
Attribute's contents
Note:
For values consisting of more then one TXmlEngTextNode node (as attribute's child) returns only the begining of the value; this happens when the value is represented by list of TXmlEngTextNode and TXmlEngEntityReference nodes.
See also:
IsSimpleContents(), WholeValueCopyL()

Reimplemented from TXmlEngNode.

IMPORT_C void TXmlEngAttr::WholeValueCopyL RBuf8 &  aBuffer  )  const
 

Get copy of attribute content.

Since:
S60 v3.1
Returns:
Complex value of the attribute, probably consisting of text nodes and entity references
Since the value may be composed from a set of TXmlEngTextNode and EntityRefernce nodes, the returned result is newly allocated string, which should be freed by caller.

BE SURE TO FREE THE RESULT STRING!!!

Example usage of the API:

    RBuf8 value;
    attr.WholeValueCopyL(value);
    ...
    value.Close();
See also:
TXmlEngAttr::Value(), TXmlEngNode::Value(), TXmlEngNode::IsSimpleTextContents(), TXmlEngNode::WholeTextContentsCopyL()
Note:
In most cases using Value() is enough (and it needs no memory allocation). Use IsSimpleTextContents() if there doubts can Value() be used or not safely.

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

Copyright © Nokia Corporation 2001-2007
Back to top