epoc32/include/xml/dom/xmlengelement.h
branchSymbian3
changeset 4 837f303aceeb
parent 3 e1b950c65cb4
equal deleted inserted replaced
3:e1b950c65cb4 4:837f303aceeb
     1 /*
     1 /*
     2 * Copyright (c) 2004-2006 Nokia Corporation and/or its subsidiary(-ies). 
     2 * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     8 *
     8 *
     9 * Initial Contributors:
     9 * Initial Contributors:
    10 * Nokia Corporation - initial contribution.
    10 * Nokia Corporation - initial contribution.
    11 *
    11 *
    12 * Contributors:
    12 * Contributors:
    13 *
    13 *
    14 * Description:       Element node functions
    14 * Description:
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 
    18 /** @file
    19 
    19 @publishedAll
    20 
    20 @released
    21 
    21 */
    22 
    22 #ifndef XMLENGELEMENT_H
    23 
    23 #define XMLENGELEMENT_H
    24 #ifndef XMLENGINE_ELEMENT_H_INCLUDED
    24 
    25 #define XMLENGINE_ELEMENT_H_INCLUDED
    25 #include <xml/dom/xmlengattr.h>
    26 
    26 #include <xml/dom/xmlengnamespace.h>
    27 #include "XmlEngAttr.h"
       
    28 #include "XmlEngNamespace.h"
       
    29 
    27 
    30 template<class T> class RXmlEngNodeList;
    28 template<class T> class RXmlEngNodeList;
    31 
    29 
    32 
    30 
    33 /**
    31 /**
    34  * Instance of TXmlEngElement class represents an XML element in the DOM tree.
    32 This class represents an XML element in the DOM tree.
    35  *
    33 
    36  * <b>Namespace handling:</b>
    34 Namespace handling:
    37  *
    35  
    38  * Namespace of XML element is an URI that in pair with <i>local part</i> of
    36 The namespace of a XML element is an URI that in pair with the local part of
    39  * element's name consistute <b>expanded-name</b> of element. It is said that "the element
    37 the element's name consistute the @c expanded-name of the element. It is said
    40  * is of <i>NNN</i> namespace".
    38 that "the element is of NNN namespace".
    41  *
    39 
    42  * XML elements are shown as belonging to a specific namespace by using <i>prefixes</i>
    40 XML elements are shown as belonging to a specific namespace by using prefixes
    43  * that previously were bound to some namespace URIs. The scope of a prefix is the
    41 that previously were bound to some namespace URIs. The scope of a prefix is the
    44  * element, where it was declared and all its child (sub-)elements.
    42 element, where it was declared and all its child (sub-)elements.
    45  *      
    43      
    46  * Namespace declaration is created by using special <b>xmlns:<i>{prefix-name}</i></b>
    44 Namespace declaration is created by using a special @c xmlns:{prefix-name} 
    47  * attribute (which is not really considered as attribute in DOM):
    45 attribute (which is not really considered as an attribute in DOM):
    48  * @code 
    46 @code 
    49  *    <a xmlns:pr="http://some.uri.com/"> ... </a>
    47    <a xmlns:pr="http://some.uri.com/"> ... </a>
    50  * OR
    48 OR
    51  *    <pr:a xmlns:pr="http://some.uri.com/"> ... </a>
    49    <pr:a xmlns:pr="http://some.uri.com/"> ... </a>
    52  *    <a xmlns="http://some.uri.com/"> ... </a>
    50    <a xmlns="http://some.uri.com/"> ... </a>
    53  * @endcode
    51 @endcode
    54  *
    52  
    55  * The latter two examples are equivalent and show the use of <i>default namespace</i>.
    53 The latter two examples are equivalent and show the use of @c default namespace.
    56  *    
    54    
    57  * Implementation notes:
    55 Implementation notes:
    58  *	- Element having no namespace is either presented with a NULL TXmlEngNamespace node 
    56 - Elements having no namespace are either presented with a NULL 
    59  *    or a TXmlEngNamespace node that has NULL prefix and namespace URI set to "". 
    57   TXmlEngNamespace node or a TXmlEngNamespace node that has NULL (KNullDesC8)
    60  *    The former is used by default on all nodes, whereas the latter is for cases
    58   prefix and namespace URI set to "" (an empty descriptor).  The former is 
    61  *    when some node contains undeclaration of the default namespace:
    59 	used by default on all nodes, whereas the latter is for cases when some node 
    62  * @code
    60 	contains undeclaration of the default namespace:
    63  *	   <a xmlns=""> .. </a>
    61   @code
    64  * @endcode
    62 	   <a xmlns=""> .. </a>
    65  *
    63   @endcode
    66  * - The prefix of the default attribute is NULL, not "" (zero-length string)
    64  
    67  *	 "" corresponds to  
    65 - The prefix of the default attribute is NULL (KNullDesC8), not an "" (empty
    68  *   @code
    66 	descriptor).  An empty descriptor which corresponds to
    69  *       <a xmlns:="http://some.uri.com/"> ... </a>
    67   @code
    70  *   @endcode
    68       <a xmlns:="http://some.uri.com/"> ... </a>
    71  *   (it does not contradict XML spec, but you are strongly advised against using this)
    69   @endcode
    72  *
    70   (it does not contradict XML spec, but you are strongly advised against using 
    73  * - Prefix <b>"xml"</b> is reserved by XML Namespace spec for special purposes; it is implicitly bound
    71   this)
    74  *   to XML's namespace <i>"http://www.w3.org/XML/1998/namespace"</i> and no one is allowed
    72 
    75  *   to use this prefix except as with spec-defined elements and attributes or to rebind this 
    73 - Prefix "xml" is reserved by XML Namespace spec for special purposes; it is 
    76  *   prefix to other namespaces
    74   implicitly bound to XML's namespace <i>"http://www.w3.org/XML/1998/namespace"</i> 
    77  *
    75   and no one is allowed to use this prefix except as with spec-defined 
    78  * - Namespace URI may be "" only for default namespace. In other words,
    76   elements and attributes or to rebind this prefix to other namespaces
    79  *   "" namespace URI may not be bound to non-NULL prefix. 
    77  
    80  *          
    78 - Namespace URI may be "" (an empty descriptor) only for default namespace. In
    81  *   Declaration of "" namespace with NULL prefix results in:
    79   other words, "" namespace URI may not be bound to non-NULL prefix.
    82  *   @code
    80          
    83  *       <a xmlns=""> ... </a>
    81   Declaration of "" (an empty descriptor) namespace with NULL (KNullDesC8) 
    84  *   @endcode
    82   prefix results in:
    85  *   which <i>undeclares</i> any existing (in some parent element) default namespace
    83   @code
    86  *   for the scope of element 'a': element, its attributes and all child nodes of DOM tree.
    84       <a xmlns=""> ... </a>
    87  *   Note, that such "undeclaration" will be added only if neccessary. 
    85   @endcode
    88  *        
    86   which undeclares any existing (in some parent element) default namespace
    89  * - Unneccessary namespace declaration are ignored. Attemps to add namespace binding 
    87   for the scope of element 'a': element, its attributes and all child nodes 
    90  *   using same namespace URI and prefix if such binding already exists in the scope
    88   of DOM tree. Note, that such "undeclaration" will be added only if neccessary.
    91  *   will have no effect.
    89        
    92  *
    90 - Unneccessary namespace declaration are ignored. Attemps to add namespace binding 
    93  * - <b>IMPORTANT!</b> Attributes DO NOT HAVE default namespaces. If an attribute has no
    91   using same namespace URI and prefix if such binding already exists in the scope
    94  *   prefix, its namespace is <b>undeclared</b> even if there is some default namespaces for
    92   will have no effect.
    95  *   the scope of the element, which contains the attribute.
    93  
    96  *
    94 - IMPORTANT! Attributes DO NOT HAVE default namespaces. If an attribute has no
    97  * So, it is wrong to write something like this:
    95   prefix, its namespace is undeclared even if there is some default namespaces for
    98  * @code
    96   the scope of the element, which contains the attribute.
    99  *     <a xmlns="ns_uri"  attr="value"> ... </a>
    97  
   100  * @endcode
    98 So, it is wrong to write something like this:
   101  * and assume that the <b>attr</b> belongs to namespace pointed to with <i>ns_uri</i>.
    99 @code
   102  *    
   100     <a xmlns="ns_uri"  attr="value"> ... </a>
   103  * <b>HINTS:</b>
   101 @endcode
   104  * - Use namespace declaration nodes as much as possible (but watch out prefix collisions).
   102 and assume that the attr belongs to namespace pointed to with @c ns_uri.
   105  * - Add most referred to namespace declarations (AddNamespaceDeclarationL(uri,pref)) after
   103    
   106  *   any other namespace declarations in a element -- the will be found faster in
   104 HINTS:
   107  *   namespace lookups.
   105 - Use namespace declaration nodes as much as possible (but watch out for prefix collisions).
   108  *
   106 - Add most referred to namespace declarations (AddNamespaceDeclarationL(uri,pref)) after
   109  * @lib XmlEngineDOM.lib
   107   any other namespace declarations in a element -- they will be found faster in
   110  * @since S60 v3.1
   108   namespace lookups.
   111  */
   109 
   112 
   110 For more informarion on NULL and NULL nodes:
       
   111 @see TXmlEngNode
       
   112 @see KNullDesC8
       
   113 */
   113 class TXmlEngElement : public TXmlEngNode
   114 class TXmlEngElement : public TXmlEngNode
   114 {
   115 {
   115   public:
   116   public:
   116     /**
   117     /** Default constructor */
   117      * Default constructor for automatic variables (not initialized)
       
   118 	 *
       
   119      * @since S60 v3.1
       
   120 	 */
       
   121     inline TXmlEngElement();
   118     inline TXmlEngElement();
   122 
   119 
   123     /**
   120     /**
   124      * Constructor
   121     Constructor
   125      *
   122 	@param aInternal element pointer
   126      * @since S60 v3.1
   123 	*/
   127 	 * @param aInternal element pointer
       
   128 	 */
       
   129     inline TXmlEngElement(void* aInternal);
   124     inline TXmlEngElement(void* aInternal);
   130 	
   125 	
   131     /** 
   126     /*
   132     *    @name XmlEngine's non-DOM extensions
   127 	Extensions to the DOM Level 3 Core methods
   133     */
   128 	*/
   134     /** @{ */
   129 
   135 
   130     /**
   136     /**
   131     Retrieves a list of the attribute nodes of an element
   137      *   Retrieves list of attribute nodes of the element
   132 
   138      *   
   133 	Upon return, aList is initialized and is ready for use with HasNext() and
   139      *   @param aList - a node list object to initialize
   134 	Next() methods:
   140      *
   135      
   141      *   Passed by reference list of nodes is initialized and after call to
   136       @code
   142      *   Attributes(..) is ready for use with HasNext() and Next() methods:
   137           ...
   143      *
   138           TXmlEngElement root = doc.DocumentElement();
   144      *   @code
   139           RXmlEngNodeList<TXmlEngAttr>    attlist;
   145      *       ...
   140           root.GetAttributes(attlist);
   146      *       TXmlEngElement root = doc.DocumentElement();
   141           while (attlist.HasNext())
   147      *       RXmlEngNodeList<TXmlEngAttr>    attlist;
   142               processAttribute(attlist.Next());
   148      *       root.GetAttributes(attlist);
   143           ...
   149      *       while (attlist.HasNext())
   144 	      attlist.Close();
   150      *           processAttribute(attlist.Next());
   145       @endcode
   151      *       ...
   146 
   152 	 *       attlist.Close();
   147 		If there are no attributes the list will be empty.
   153      *   @endcode
   148 
   154 	 *
   149     @param aList An attribute list to initialize
   155      * @since S60 v3.1
   150     */
   156 	 */
       
   157     IMPORT_C void GetAttributes(RXmlEngNodeList<TXmlEngAttr>& aList) const;
   151     IMPORT_C void GetAttributes(RXmlEngNodeList<TXmlEngAttr>& aList) const;
   158 
   152 
   159     /**
   153     /**
   160      * Retrieves list of child elements of the element
   154     Retrieves a list of child elements of an element.
   161      *
   155 
   162      * @since S60 v3.1
   156 	Upon return, aList is initialized and is ready for use with HasNext() and
   163 	 * @param aList - a node list object to initialize
   157 	Next() methods.
   164      *
   158 
   165      * Passed by reference list of nodes is initialized and after the call
   159 	Note: This returns a list of the child element nodes only.
   166      * it is ready for use with HasNext() and Next() methods:
   160 
   167      *   
   161 	There is no affect if the element attributes are empty.
   168      * @note Returned list is a "filtered view" of the underlying
   162 
   169      *       list of all element's children (with text nodes, comments
   163 	@param aList A child list to initialize
   170      *       processing instructions, etc.)
   164 	*/ 
   171 	 */ 
       
   172     IMPORT_C void GetChildElements(RXmlEngNodeList<TXmlEngElement>& aList) const;
   165     IMPORT_C void GetChildElements(RXmlEngNodeList<TXmlEngElement>& aList) const;
   173 
   166 
   174     /**
   167 	/**
   175      * Creates new attribute node out of any namespace (i.e. it has no prefix),
   168 	Creates a new attribute node outside of any namespace (i.e. it has no
   176      * sets attribute's value and links it as the last attribute of the current element
   169 	prefix), sets the attribute's value and links it as the last attribute of
   177      *
   170 	the current element.
   178      * @since S60 v3.1
   171 
   179 	 * @param  aName   A local name of attribute
   172 	Note:
   180      * @param  aValue  Value to set for new attribute or NULL (sets value to "")
   173 			- No checks are made that an attribute with the same name exists.
   181      * @return         A handler to the newly created attribute node;
   174               Use this method only on newly created elements!
   182      *
   175               Otherwise, use TXmlEngElement::SetAttributeL()
   183      * For adding attribute as the first one, use TXmlEngNode::SetAsFirstSibling() on the attribute:
   176             - Attributes do not inherit default namespace of its element
   184      * @code
   177               (http://w3.org/TR/REC-xml-names/#defaulting)
   185      *     TXmlEngElement el = ... ; // get some element
   178             - The attribute's value is the second argument in all AddNewAttributeL() methods
   186      *     el.AddNewAttributeL("version","0.1").SetAsFirstSibling();
   179 
   187      * @endcode
   180     When adding the first attribute, use TXmlEngNode::SetAsFirstSibling() on the attribute:
   188      *   
   181     @code
   189      * @see   SetAsLastSibling(), MoveBeforeSibling(TXmlEngNode) and MoveAfterSibling(TXmlEngNode)
   182         TXmlEngElement el = ... ; // get some element
   190      *
   183         el.AddNewAttributeL("version","0.1").SetAsFirstSibling();
   191      * @note   - No checks are made that attribute with such name exists
   184     @endcode
   192      *           Use this method only on newly created elements!
   185       
   193      *           Otherwise, use TXmlEngElement::SetAttributeL(..)
   186 	 Copies are taken of descripters passed in.
   194      *         - Attributes do not inherit default namespace of its element
   187 	 
   195      *           (http://w3.org/TR/REC-xml-names/#defaulting)
   188 	@see SetAsLastSibling()
   196      *         - attribute's value is the second argument in all AddNewAttributeL(..) methods
   189 	@see MoveBeforeSibling(TXmlEngNode) 
   197      *         - Use of NULL as value is more preferrable then "" 
   190 	@see MoveAfterSibling(TXmlEngNode)
   198 	 */
   191 	 * 
       
   192 	@param  aName   A local name of the attribute
       
   193 	@param  aValue  Value to set for new attribute or KNullDesC8
       
   194 	@return The created attribute
       
   195 	@leave KXmlEngErrNullNode The node is NULL
       
   196 	@leave KXmlEngErrWrongUseOfAPI aName is empty
       
   197 	@leave - One of the system-wide error codes
       
   198 	*/
   199     IMPORT_C TXmlEngAttr AddNewAttributeL(const TDesC8& aName, const TDesC8& aValue);
   199     IMPORT_C TXmlEngAttr AddNewAttributeL(const TDesC8& aName, const TDesC8& aValue);
   200     
   200     
   201     /**
   201     /**
   202      * Creates new attribute node and add it to the element
   202     Creates a new attribute node and adds it to the element.
   203      *
   203     
   204      * Provided handle to namespace declaration is used to set up
   204 	The provided namespace declaration is used to set the attribute's namespace.
   205      * attribute's namespace.
   205 
   206      *
   206 	Note:  If aNsDef is not defined in some of the attribute's ascendants
   207      * @since S60 v3.1
   207 	(including this element), then the ReconcileNamespacesL() method must be
   208 	 * @param  aName   A local name of attribute
   208 	called on this element later.
   209      * @param  aValue  Value to set for new attribute or NULL (sets value to "")
   209     
   210      * @param  aNsDef  Namespace to add to the attribute
   210 	 Copies are taken of descripters passed in.
   211      * @return         A handler to the newly created attribute node;
   211 	 
   212      *
   212 	@param  aName   The local name of attribute
   213      * @note If aNsDef is not defined in some of attributes ascendants
   213 	@param  aValue  Value to set for new attribute or KNullDesC8
   214      *      (including this element), then
   214 	@param  aNsDef  Namespace to add to the attribute
   215      *      ReconcileNamespacesL() method must be called on
   215 	@return The created attribute
   216      *      this element later.
   216 	@leave KXmlEngErrNullNode The node is NULL
   217 	 */
   217 	@leave KXmlEngErrWrongUseOfAPI aName is empty
       
   218 	@leave - One of the system-wide error codes
       
   219 	*/
   218     IMPORT_C TXmlEngAttr AddNewAttributeL(const TDesC8& aName,
   220     IMPORT_C TXmlEngAttr AddNewAttributeL(const TDesC8& aName,
   219                                     const TDesC8& aValue, 
   221                                     const TDesC8& aValue, 
   220                                     const TXmlEngNamespace aNsDef);
   222                                     const TXmlEngNamespace aNsDef);
   221 
   223 
   222     /**
   224 	/**
   223      * Creates new attribute on the element. Namespace declaration for the attribute namespace is
   225 	Creates a new attribute for the element. A namespace declaration for the
   224      * created too.
   226 	attribute namespace is also created.
   225      *
   227 
   226      * @since S60 v3.1
   228 	Note:  Namespace declarations are reused if possible (no redundant ones are
   227 	 * @param  aName   A local name of attribute
   229 	created)
   228      * @param  aValue  Value to set for new attribute or NULL (sets value to "")
   230     
   229      * @param  aNsUri  Namespace uri
   231 	 Copies are taken of descripters passed in.
   230      * @param  aPrefix  Namespace prefix
   232 	 
   231      * @return         A handler to the newly created attribute node;
   233 	@param  aName   The local name of attribute
   232      *
   234     @param  aValue  Value to set for the new attribute or an empty string
   233      * @note
   235     @param  aNsUri  Namespace URI
   234      *    - Namespace declarations are reused if possible (no redundant ones are created)
   236     @param  aPrefix  Namespace prefix
   235      */
   237     @return The created attribute
       
   238 	@leave KXmlEngErrNullNode The node is NULL
       
   239 	@leave KXmlEngErrWrongUseOfAPI aName is empty
       
   240 	@leave - One of the system-wide error codes
       
   241     */
   236     IMPORT_C TXmlEngAttr AddNewAttributeL(const TDesC8& aName, 
   242     IMPORT_C TXmlEngAttr AddNewAttributeL(const TDesC8& aName, 
   237                                     const TDesC8& aValue,
   243                                     const TDesC8& aValue,
   238                                     const TDesC8& aNsUri, 
   244                                     const TDesC8& aNsUri, 
   239                                     const TDesC8& aPrefix);
   245                                     const TDesC8& aPrefix);
   240 
   246 
   241     /**
   247 	/**
   242      * Creates new attribute node using namespace of its parent element (this element),
   248 	Creates a new attribute node using the namespace of its parent element
   243      * sets attribute's value and links it as the last attribute of the element
   249 	(this element), sets the attribute's value and links it as the last
   244      *
   250 	attribute of the element
   245      * @since S60 v3.1
   251 
   246 	 * @param aName Local name of attribute 
   252     For more hints how to use it @see AddNewAttributeL(const TDesC8&,const TDesC8&)
   247      * @param aValue Value to set for new attribute or NULL (sets value to "")
   253            
   248      * @return A handler to the newly created attribute node;
   254 	Note:
   249      *    
   255         - No checks are made that an attribute with the same name exists
   250      * For more hints how to use it refer to AddNewAttributeL(const TDesC8&,const TDesC8&)
   256         - if the namespace of the parent element is default (i.e. bound prefix is KNullDesC8),
   251      *        
   257           then a temporary prefix will be used and bound to the same namespace URI as the element
   252      * @note    
   258           (It is due to the fact that default namespaces do not spread on unprefixed attributes,
   253      *     - No checks are made that attribute with such name exists
   259           see http://w3.org/TR/REC-xml-names/#defaulting)
   254      *     - if namespace of the parent element is default (i.e. bound prefix is NULL),
   260     
   255      *       then temporary prefix will be used and bound to the same namespace URI as elements
   261 	 Copies are taken of descripters passed in.
   256      *       (It is due to the fact that default namespaces do not spread on unprefixed attributes,
   262 	 @see KNullDesC8
   257      *       see http://w3.org/TR/REC-xml-names/#defaulting)
   263 	 
   258      */
   264 	@param aName Local name of attribute 
       
   265     @param aValue Value to set for the new attribute or empty.
       
   266     @return The created attribute
       
   267 	@leave KXmlEngErrNullNode The node is NULL
       
   268 	@leave KXmlEngErrWrongUseOfAPI aName is empty
       
   269 	@leave - One of the system-wide error codes
       
   270     */
   259     inline   TXmlEngAttr AddNewAttributeSameNsL(const TDesC8& aName, const TDesC8& aValue);
   271     inline   TXmlEngAttr AddNewAttributeSameNsL(const TDesC8& aName, const TDesC8& aValue);
   260 
   272 
   261     /**
   273     /**
   262      * Creates new attributes using namespace, which is bound to the specified prefix
   274     Creates a new attribute using the namespace which is bound to the specified prefix
   263      *
   275     
   264      * @since S60 v3.1
   276     Use this mothod only for construction of new parts of DOM tree where
   265 	 * @param  aLocalName   A local name of attribute
   277     you know for sure that the prefix is bound in the given scope.
   266      * @param  aValue  Value to set for new attribute or NULL (sets value to "")
   278     @code
   267      * @param  aPrefix  Namespace prefix for new attribute
   279         TXmlEngElement el = parent.AddNewAttributeUsePrefixL("property","ObjName","rdf");
   268      * @return A handler to the newly created attribute node;
   280         el.AddNewAttributeUsePrefixL("type", "xs:integer", "rdf");
   269      *
   281     @endcode
   270      * Use this mothod only for construction of new parts of DOM tree, where
   282     
   271      * you know for sure that prefix is bound in the given scope.
   283     Otherwise, you should check that the prefix is bound like this example shows:
   272      * @code
   284     @code
   273      *     TXmlEngElement el = parent.AddNewAttributeUsePrefixL("property","ObjName","rdf");
   285         TXmlEngNamespace boundNS = TXmlEngNamespace::LookupByPrefix(thisElement, prefix);
   274      *     el.AddNewAttributeUsePrefixL("type", "xs:integer", "rdf");
   286         if (boundNS.NotNull()){
   275      * @endcode
   287             thisElement.AddNewAttributeUsePrefixL("name", value, prefix);
   276      *
   288         }
   277      * Otherwise, you should check that prefix is bound like this example shows:
   289     @endcode
   278      * @code
   290     
   279      *     TXmlEngNamespace boundNS = TXmlEngNamespace::LookupByPrefix(thisElement, prefix);
   291 	Note: Use AddNewAttributeNsL(name,value,nsDefNode) as much as you can,
   280      *     if (boundNS.NotNull()){
   292 	because it is the most efficient way to create namespaced DOM elements (no
   281      *         thisElement.AddNewAttributeUsePrefixL("name", value, prefix);
   293 	additional lookups for namespace declarations are required).
   282      *     }
   294      
   283      * @endcode
   295     @code
   284      *
   296         // If namespace with given URI is not in the scope, then it will be declared
   285      * @note
   297         // and bound to "data" prefix.
   286      *     Use AddNewAttributeNsL(name,value,nsDefNode) as much as you can, because
   298         TXmlEngNamespace nsDef = elem.FindOrCreateNsDefL("http://../Data", "data");
   287      *     it is most efficient way to create namespaced DOM elements (no additional
   299         elem.AddNewAttributeL("location", "...", nsDef);
   288      *     lookups for namespace declarations are required).
   300         elem.AddNewElementL("child", nsDef).AddNewAttributeL("attr","...value...");
   289      *  
   301         // the result is
   290      * @code
   302             ...
   291      *     // If namespace with given URI is not in the scope, then it will be declared
   303          <elem xmlns:data="http://../Data" data:location="...">
   292      *     // and bound to "data" prefix.
   304             <data:child attr="...value..."/>
   293      *     TXmlEngNamespace nsDef = elem.FindOrCreateNsDefL("http://../Data", "data");
   305          </elem>
   294      *     elem.AddNewAttributeL("location", "...", nsDef);
   306             ...
   295      *     elem.AddNewElementL("child", nsDef).AddNewAttributeL("attr","...value...");
   307         //
   296      *     // the result is
   308     @endcode    
   297      *         ...
   309 
   298      *      <elem xmlns:data="http://../Data" data:location="...">
   310 	 Copies are taken of descripters passed in.
   299      *         <data:child attr="...value..."/>
   311 	 
   300      *      </elem>
   312 	@param  aLocalName   The local name of the attribute
   301      *         ...
   313     @param  aValue  Value to set for the new attribute or empty string.
   302      *     //
   314     @param  aPrefix  Namespace prefix for the new attribute
   303      * @endcode    
   315     @return The created attribute
   304      */
   316 	@leave KXmlEngErrNullNode The node is NULL
       
   317 	@leave KXmlEngErrWrongUseOfAPI aLocalName is empty
       
   318 	@leave KErrNoMemory The namespace is not found and the URI is not
       
   319 	http://www.w3.org/XML/1998/namespace; or there is a memory allocation error
       
   320 	@leave - One of the system-wide error codes
       
   321     */
   305     IMPORT_C TXmlEngAttr AddNewAttributeUsePrefixL(const TDesC8& aLocalName, 
   322     IMPORT_C TXmlEngAttr AddNewAttributeUsePrefixL(const TDesC8& aLocalName, 
   306                                              const TDesC8& aValue, 
   323                                              const TDesC8& aValue, 
   307                                              const TDesC8& aPrefix);
   324                                              const TDesC8& aPrefix);
   308 
   325 
   309     /**
   326     /**
   310      * Creates new attributes using namespace in the scope, which has specified URI
   327     Creates new attributes using the namespace in scope, which has the specified URI
   311      *   
   328       
   312      * Almost the same as AddNewAttributeUsePrefixL(...) but does lookup by namespace URI
   329     Almost the same as AddNewAttributeUsePrefixL() but does lookup by namespace URI
   313      *
   330 
   314      * @since S60 v3.1
   331     @see AddNewAttributeUsePrefixL(const TDesC8&,const TDesC8&,const TDesC8&)
   315 	 * @param  aLocalName   A local name of attribute
   332     
   316      * @param  aValue  Value to set for new attribute or NULL (sets value to "")
   333 	 Copies are taken of descripters passed in.
   317      * @param  aNsUri  Namespace uri for new attribute
   334 	 @see KNullDesC8
   318      * @return - NULL attribute if namespace declaration is not found OR newly added to the end of
   335 	 
   319      *           attribute list attribute of this element.
   336 	@param  aLocalName   The local name of the attribute
   320      *
   337     @param  aValue  Value to set for new attribute or empty string.
   321      * @see AddNewAttributeUsePrefixL(const TDesC8&,const TDesC8&,const TDesC8&)
   338     @param  aNsUri  Namespace URI for new attribute
   322      */
   339 	@return NULL attribute if namespace declaration is not found OR newly added
       
   340 	to the end of attribute list attribute of this element.
       
   341 	@leave KXmlEngErrNullNode The node is NULL
       
   342 	@leave KXmlEngErrWrongUseOfAPI aLocalName is empty
       
   343 	@leave - One of the system-wide error codes
       
   344     */
   323     IMPORT_C TXmlEngAttr AddNewAttributeWithNsL(const TDesC8& aLocalName, 
   345     IMPORT_C TXmlEngAttr AddNewAttributeWithNsL(const TDesC8& aLocalName, 
   324                                           const TDesC8& aValue, 
   346                                           const TDesC8& aValue, 
   325                                           const TDesC8& aNsUri);
   347                                           const TDesC8& aNsUri);
   326                                           
   348                                           
   327     /**
   349 	/**
   328      * Add attribute to element that will be used as Xml:Id.
   350 	Adds attribute to element that will be used as Xml:Id.  Does not check if
   329      *
   351 	an attribute with the same name exists.
   330      * No check if such attribute exists are made.
   352 
   331      * 
   353 	Note: Call RXmlEngDocument.RegisterXmlIdL(aName,aNsUri) first to register
   332      * @since S60 v3.2
   354 	existed id's in the document.  If the ids are not registered the ID will
   333 	 * @param aLocalName Name of attribute that should be add.
   355 	not be added to the element.
   334 	 * @param aValue Value of the attribute
   356     
   335 	 * @param aNs Namespace of the attribute
   357 	 Copies are taken of descripters passed in.
   336 	 * @return Attribute if created. Null attribute if Id exist
   358 	 
   337      *
   359 	@param aLocalName Name of the attribute
   338      * @note Call RXmlEngDocument.RegisterXmlIdL(aName,aNsUri) first
   360 	@param aValue Value of the attribute
   339      *       to register existed id's in the document.
   361 	@param aNs Namespace of the attribute
   340      */
   362 	@return Attribute if created. Null attribute if Xml:Id exists
       
   363 	@leave KXmlEngErrWrongUseOfAPI Element is NULL or attribute doesn't exist
       
   364 	@leave - One of the system-wide error codes
       
   365     */
   341     IMPORT_C TXmlEngAttr AddXmlIdL(const TDesC8& aLocalName,
   366     IMPORT_C TXmlEngAttr AddXmlIdL(const TDesC8& aLocalName,
   342                                        const TDesC8& aValue,
   367                                        const TDesC8& aValue,
   343                                        TXmlEngNamespace aNs = TXmlEngNamespace());
   368                                        TXmlEngNamespace aNs = TXmlEngNamespace());
   344     
   369     
   345     /**
   370 	/**
   346      * Adds child element with no namespace
   371 	Adds a child element with no namespace.  This results in adding an element
   347      *
   372 	with aName and no prefix.
   348      * @since S60 v3.1
   373      
   349 	 * @param aName name of the element
   374 	This method is the best for creation of non-namespace based documents
   350      * @return A handler to the newly created element node;
   375 	or document fragments, where no default namespace declared.
   351      *
   376     
   352      * Results in adding element with aName and no prefix.
   377 	It may be used also as a method for adding elements from the default
   353      *
   378 	namespace, BUT namespace will be assigned ONLY after serialization of the
   354      * This method is the best for creation of non-namespace based documents
   379 	current document and parsing it back into a DOM tree!! If you need the new
   355      * or document fragments, where no default namespace declared.
   380 	element to inherit the default namespace use:
   356      *
   381 
   357      * It may be used also as a method for adding element from default namespace,
   382     @code
   358      * BUT namespace will be assigned ONLY after serialization of the current
   383        ...
   359      * document and parsing it back into a DOM tree!! If you need that default namespace
   384        TXmlEngNamespace defns = element.DefaultNamespace();
   360      * was inherited by new element immediately use:
   385        TXmlEngElement newEl = element.AddNewElementL("Name",defns);
   361      * @code
   386        ...
   362      *    ...
   387     @endcode
   363      *    TXmlEngNamespace defns = element.DefaultNamespace();
   388     
   364      *    TXmlEngElement newEl = element.AddNewElementL("Name",defns);
   389 	It is not recommended that you use an undefined namespace with libxml.  
   365      *    ...
   390 	If an undefined namespace for the element is truly required, then DO NOT
   366      * @endcode
   391 	USE this method if there is a default namespace in the scope!
   367      *
   392 	@see AddNamespaceDeclarationL
   368      * If truly undefined namespace for the element is required, then <b>DO NOT USE</b>
   393 
   369      * this method if there is a default namespace in the scope!
   394 	Copies are taken of descripters passed in.
   370      */
   395 	 
       
   396 	@param aName The name of the element
       
   397 	@return The created element
       
   398 	@leave KXmlEngErrNullNode Element is NULL
       
   399 	@leave KXmlEngErrWrongUseOfAPI Name is not specified
       
   400 	@leave - One of the system-wide error codes
       
   401     */
   371     IMPORT_C TXmlEngElement AddNewElementL(const TDesC8& aName);
   402     IMPORT_C TXmlEngElement AddNewElementL(const TDesC8& aName);
   372 
   403 
   373     /**
   404 	/**
   374      * Creates new child element with provided name and namespace declaration
   405 	Creates a new child element with the provided name and namespace
   375      *
   406 	declaration and adds it as the last child of its parent.
   376      * @since S60 v3.1
   407     
   377 	 * @param aLocalName Name of the element
   408 	 Copies are taken of descripters passed in.
   378      * @param aNsDecl Handle of the namespace declaration, that must be retrieved from
   409 	 
   379      *            one of the ascendant nodes of the new elements (and its prefix
   410 	@param aLocalName The name of the element
   380      *            should not be remapped to another namespace URI for the scope
   411     @param aNsDecl The namespace declaration that must be retrieved from
   381      *            of the new element)
   412                one of the ascendant nodes of the new elements (and its prefix
   382      * @return    Created element node (and added as the last child of its parent)
   413                should not be remapped to another namespace URI for the scope
   383      */
   414                of the new element)
       
   415     @return Created element node
       
   416 	@leave KXmlEngErrNullNode Element is NULL
       
   417 	@leave KXmlEngErrWrongUseOfAPI Name is not specified
       
   418 	@leave - One of the system-wide error codes
       
   419     */
   384     IMPORT_C TXmlEngElement AddNewElementL(const TDesC8& aLocalName, TXmlEngNamespace aNsDecl);
   420     IMPORT_C TXmlEngElement AddNewElementL(const TDesC8& aLocalName, TXmlEngNamespace aNsDecl);
   385 
   421 
   386     /**
   422 	/**
   387      * Creates new child element with provided name, prefix and namespace URI
   423 	Creates a new child element with provided the name, prefix and namespace
   388      *
   424 	URI and adds it as the last child of its parent.
   389      * New namespace declaration will be attached to the parent (this) element and used
   425     
   390      * as namespace for newly created child element. If such binding already exists
   426 	The new namespace declaration will be attached to the parent (this) element
   391      * (same prefix is bound to same URI), it will be reused. If the prefix is already
   427 	and used as the namespace for newly created child element. If such a
   392      * bound to some another namespace URI, it will be rebound by the new namespace
   428 	binding already exists (same prefix is bound to same URI), it will be
   393      * declaration node.
   429 	reused. If the prefix is already bound to some other namespace URI, it will
   394      *
   430 	be rebound by the new namespace declaration node.
   395      * @since S60 v3.1
   431     
   396 	 * @param aLocalName Name of the element
   432 	 Copies are taken of descripters passed in.
   397      * @param aNsUri     URI of element's namespace
   433 	 
   398      * @param aPrefix    Prefix of the element
   434 	@param aLocalName Name of the element
   399      * @return Created element node (and added as the last child of its parent)
   435     @param aNsUri     URI of the element's namespace
   400      */
   436     @param aPrefix    Prefix of the element
       
   437     @return The created element node 
       
   438 	@leave KXmlEngErrNullNode Element is NULL
       
   439 	@leave KXmlEngErrWrongUseOfAPI Name or URI or prefix is not specified
       
   440 	@leave - One of the system-wide error codes
       
   441     */
   401     IMPORT_C TXmlEngElement AddNewElementL(const TDesC8& aLocalName, 
   442     IMPORT_C TXmlEngElement AddNewElementL(const TDesC8& aLocalName, 
   402                                      const TDesC8& aNsUri, 
   443                                      const TDesC8& aNsUri, 
   403                                      const TDesC8& aPrefix);
   444                                      const TDesC8& aPrefix);
   404 
   445 
   405     /**
   446 	/**
   406      * Adds child element with same namespace (and prefix if present) as parent element has
   447 	Creates a child element with the same namespace (and prefix if present) as
   407      *
   448 	the parent element and adds it as the last child of its parent.
   408      * @since S60 v3.1
   449      
   409 	 * @param aLocalName element's name
   450 	 Copies are taken of descripters passed in.
   410      * @return New element that was added to the end of children list of its parent (this element)
   451 	 
   411      */
   452 	@param aLocalName The element's name
       
   453     @return The created element
       
   454 	@leave KXmlEngErrNullNode Element is NULL
       
   455 	@leave KXmlEngErrWrongUseOfAPI Name is not specified
       
   456 	@leave - One of the system-wide error codes
       
   457     */
   412     IMPORT_C TXmlEngElement AddNewElementSameNsL(const TDesC8& aLocalName);
   458     IMPORT_C TXmlEngElement AddNewElementSameNsL(const TDesC8& aLocalName);
   413 
   459 
   414     /**
   460 	/**
   415      * Performs lookup for the namespace declaration for specified prefix and
   461 	Performs a lookup for the namespace declaration for the specified prefix
   416      * adds new child element with found namespace.
   462 	and adds a new child element with the found namespace as the last child of
   417      *
   463 	its parent.
   418      * The assumption is that prefix is bound, otherwise run-time error
   464     
   419      * (Symbian's Leave or exception) occurs
   465 	@pre The prefix is bound
   420      *
   466 
   421      * @note   Use this method only if there is a binding for the given prefix.
   467 	 Copies are taken of descripters passed in.
   422      *
   468 	 
   423      * @since S60 v3.1
   469 	@param aLocalName The element's name
   424 	 * @param aLocalName element's name
   470     @param aPrefix    The prefix to use for the search
   425      * @param aPrefix    prefix to use
   471     @return The created element
   426      * @return new TXmlEngElement that was added to the end of children list of its parent (this element)
   472 	@leave KXmlEngErrNullNode Element is NULL
   427      */
   473 	@leave KXmlEngErrWrongUseOfAPI Name is not specified
       
   474 	@leave KErrNoMemory The namespace is not found and the prefix is not "xml" 
       
   475 	(i.e http://www.w3.org/XML/1998/namespace); or there is a memory allocation 
       
   476 	error.
       
   477 	@leave - One of the system-wide error codes
       
   478     */
   428     IMPORT_C TXmlEngElement AddNewElementUsePrefixL(const TDesC8& aLocalName, const TDesC8& aPrefix);
   479     IMPORT_C TXmlEngElement AddNewElementUsePrefixL(const TDesC8& aLocalName, const TDesC8& aPrefix);
   429 
   480 
   430     /**
   481 	/**
   431      * Performs lookup for the namespace declaration for specified namespace URI and
   482 	Performs a lookup for the namespace declaration for the specified namespace
   432      * adds new child element with found namespace.
   483 	URI and adds a new child element with the found namespace.  The new element
   433      *
   484 	is added as the last child of this element.
   434      * The assumption is that namespace with given URI was declared,
   485     
   435      * otherwise run-time error (Symbian' Leave or exception) occurs
   486 	 Copies are taken of descripters passed in.
   436      * 
   487 	 
   437      * @note Use this method only if namespace declaration for the provided URI exists.
   488 	@pre A namespace with the given URI has been declared
   438      *
   489     
   439      * @since S60 v3.1
   490 	@param aLocalName    The element's name
   440 	 * @param aLocalName    element's name
   491     @param aNsUri        The namespace of the element
   441      * @param aNsUri        namespace of element
   492     @return The created element
   442      * @return new TXmlEngElement that was added to the end of children list of its parent (this element)
   493 	@leave KXmlEngErrNullNode Element is NULL
   443      */
   494 	@leave KXmlEngErrWrongUseOfAPI Name is not specified
       
   495 	@leave KErrNoMemory The namespace is not found and the URI is not http://www.w3.org/XML/1998/namespace 
       
   496 	or there is a memory allocation error
       
   497 	@leave - One of the system-wide error codes
       
   498     */
   444     IMPORT_C TXmlEngElement AddNewElementWithNsL(const TDesC8& aLocalName, const TDesC8& aNsUri);
   499     IMPORT_C TXmlEngElement AddNewElementWithNsL(const TDesC8& aLocalName, const TDesC8& aNsUri);
   445 
   500 
   446     /**
   501 	/**
   447      * Creates new child element; if there is no a prefix binding for new element's namespace,
   502 	Creates a new child element.  If there is no a prefix binding for the new
   448      * a namespace decaration is created with generated prefix at specified element.
   503 	element's namespace, a namespace decaration is created with a generated
   449      *
   504 	prefix at the specified element.
   450      * @since S60 v3.1
   505 
   451 	 * @param aLocalName    Name of the element to create
   506 	The location of the namespace declaration may be controlled with
   452      * @param aNsUri        Namespace URI of the new element
   507 	aNsDeclTarget:
   453      * @param aNsDeclTarget An element where namespace declaraton should be placed
   508 
   454      *                     if there is a needed to create new namespace declaration;
   509     @code
   455      *                     NULL is used to specify the created element itself
   510         el.AddNewElementAutoPrefixL(tagName,uri,KNullDesC8); // declare on the new element
   456      *
   511         el.AddNewElementAutoPrefixL(tagName,uri,el);   // declare on the parent element
   457      * As aNsDeclTarget any ascendant of the new node may be provided:
   512         el.AddNewElementAutoPrefixL(tagName,uri,doc.DocumentElement()); // declare on the root element
   458      * @code
   513        ...
   459      *     el.AddNewElementAutoPrefixL(tagName,uri,NULL); // declare on the new element
   514     @endcode
   460      *     el.AddNewElementAutoPrefixL(tagName,uri,el);   // declare on the parent element
   515 
   461      *     el.AddNewElementAutoPrefixL(tagName,uri,doc.DocumentElement()); // declare on the root element
   516 	Note:  The farther namespace declaration up in the document tree, the
   462      *    ...
   517 	longer the namespace declaration lookups take.
   463      * @endcode
   518     
   464      *
   519 	 Copies are taken of descripters passed in.
   465      * @note
   520 	 
   466      *  The farther namespace declaration up in the document tree,
   521 	@param aLocalName    Name of the element to create
   467      *  the longer time namespace declaration lookups take.
   522 	@param aNsUri        Namespace URI of the new element
   468      */
   523 	@param aNsDeclTarget The element where the namespace declaraton should be placed.
       
   524 	@return The created element
       
   525 	@leave KXmlEngErrNullNode Element is NULL
       
   526 	@leave KXmlEngErrWrongUseOfAPI Name or URI is not specified
       
   527 	@leave - One of the system-wide error codes
       
   528     */
   469     IMPORT_C TXmlEngElement AddNewElementAutoPrefixL(const TDesC8& aLocalName, 
   529     IMPORT_C TXmlEngElement AddNewElementAutoPrefixL(const TDesC8& aLocalName, 
   470                                                const TDesC8& aNsUri, 
   530                                                const TDesC8& aNsUri, 
   471                                                TXmlEngElement aNsDeclTarget);
   531                                                TXmlEngElement aNsDeclTarget);
   472 
   532 
   473     /**
   533 	/**
   474      * Get element content.
   534 	Gets element content.  This method may be used in most cases when the element
   475      * This method may be used in most cases, when element has only simple text content
   535 	has only simple text content (without entity references embedded).  If the
   476      * (without entity references embedded).
   536 	element's contents is mixed (other types of nodes present), only the contents
   477      * If element's contents is mixed (other types of nodes present), only contents of
   537 	of the first child node is returned (if it is a TXmlEngTextNode node). 
   478      * first child node is returned if it is a TXmlEngTextNode node. For getting mixed contents of the
   538 	
   479      * element of contents with entity references, WholeTextValueCopyL() should be used.
   539 	For getting the contents of an element that has contents containing entity
   480      *
   540 	references, WholeTextValueCopyL() should be used.
   481      * @since S60 v3.1
   541 
   482 	 * @return Basic contents of the element
   542 	@see TXmlEngNode::WholeTextContentsCopyL()
   483      * 
   543     
   484      * @see TXmlEngNode::WholeTextContentsCopyL()
   544 	@return The simple text contents of the element or NULL if there is no text.
   485      */
   545     */
   486     IMPORT_C TPtrC8 Text() const;
   546     IMPORT_C TPtrC8 Text() const;
   487 
   547 
   488     /**
   548     /**
   489      * Adds text as a child of the element.
   549     Adds text as a child of the element to the end of the list of children.
   490      *
   550 
   491      * @since S60 v3.1
   551 	Note:  There may be several TXmlEngTextNode and TXmlEngEntityReference
   492 	 * @param aString text to be added as element's content.
   552 	nodes added, depending on the aString value.  For example, if the curernt 
   493      * 
   553 	node has text and attributes, a text node and attribute nodes will
   494      * @note There may be several TXmlEngTextNode and TXmlEngEntityReference nodes added actually,
   554 	be added.
   495      *   depending on the aString value
   555      
   496      */
   556 	 Copies are taken of descripters passed in.
       
   557 	 
       
   558 	@param aString Text to be added as the element's content.
       
   559 	@leave KXmlEngErrNullNode Element is NULL
       
   560 	@leave - One of the system-wide error codes
       
   561     */
   497     IMPORT_C void  AddTextL(const TDesC8& aString);
   562     IMPORT_C void  AddTextL(const TDesC8& aString);
   498 
   563 
   499     /**
   564     /**
   500      * Sets text contents for the element.
   565     Sets text contents for the element.  Any child nodes are removed.
   501      * Any child nodes are removed.
   566     This function is the same as TXmlEngNode::SetValueL(TDesC8&)
   502      * Same as TXmlEngNode::SetValueL(TDesC8&)
   567 
   503      *
   568     @see TXmlEngNode::SetValueL(TDesC8&)
   504      * @since S60 v3.1
   569     
   505 	 * @param aString text to be set as element's content.
   570 	@param aString Text to be set as element's content.
   506      *
   571 	@leave KXmlEngErrNullNode Element is NULL
   507      * @see TXmlEngNode::SetValueL(TDesC8&)
   572 	@leave - One of the system-wide error codes
   508      */
   573     */
   509     IMPORT_C void  SetTextL(const TDesC8& aString);
   574     IMPORT_C void  SetTextL(const TDesC8& aString);
   510 
   575 
   511     /**
   576     /**
   512      * Sets text content of the element from escaped string.
   577     Sets the text content of the element from an escaped string.
   513      *
   578     @see TXmlEngAttr::SetEscapedValueL(TDesC8&)
   514      * @since S60 v3.1
   579     
   515 	 * @param aEscapedString New value
   580 	@param aEscapedString New value
   516      *
   581 	@leave KXmlEngErrNullNode Element is NULL
   517      * @see TXmlEngAttr::SetEscapedValueL(TDesC8&)
   582 	@leave - One of the system-wide error codes
   518      */
   583     */
   519     IMPORT_C void  SetEscapedTextL(const TDesC8& aEscapedString);
   584     IMPORT_C void  SetEscapedTextL(const TDesC8& aEscapedString);
   520     
   585     
   521     /**
   586 	/**
   522      * Sets new element value exactly as presented in the string.
   587 	Sets the new element value exactly as presented in the string.  Predefined
   523 	 * Predefined entities are not converted into characters they represent.
   588 	entities are not converted into the characters they represent.  Any child
   524 	 * Any child nodes are removed.     
   589 	nodes are removed.     
   525      *
   590 
   526      * @since S60 v3.2
   591     @see TXmlEngAttr::SetValueNoEncL(const TDesC8& aNewValue); 
   527 	 * @param aNotEncText New element value
   592     
   528      *
   593 	@param aNotEncString New string value
   529      * @see TXmlEngAttr::SetValueNoEncL(const TDesC8& aNewValue); 
   594 	@leave KXmlEngErrNullNode Element is NULL
   530      */    
   595 	@leave - One of the system-wide error codes
       
   596     */    
   531     IMPORT_C void SetTextNoEncL(const TDesC8& aNotEncString);
   597     IMPORT_C void SetTextNoEncL(const TDesC8& aNotEncString);
   532 
   598 
   533     /**
   599 	/**
   534      * Appends new text node with the value exactly as presented in the string.
   600 	Appends a new text node with the value exactly as presented in the string.
   535 	 * Predefined entities are not converted into characters they represent.
   601 	Predefined entities are not converted into the characters they represent.
   536 	 * Existing child nodes are not removed.    
   602 	Existing child nodes are not removed.    
   537      *
   603 
   538      * @since S60 v3.2
   604     @see TXmlEngAttr::SetValueNoEncL(const TDesC8& aNewValue); 
   539 	 * @param aNotEncText Appended element value
   605     
   540      *
   606 	 Copies are taken of descripters passed in.
   541      * @see TXmlEngAttr::SetValueNoEncL(const TDesC8& aNewValue); 
   607 	 
   542      */  
   608 	@param aNotEncString Appended string value
       
   609 	@leave KXmlEngErrNullNode Element is NULL
       
   610 	@leave - One of the system-wide error codes
       
   611     */  
   543 	IMPORT_C void AppendTextNoEncL(const TDesC8& aNotEncString);   
   612 	IMPORT_C void AppendTextNoEncL(const TDesC8& aNotEncString);   
   544 
   613 
   545     /**
   614 	/**
   546      * Adds namespace declaration to the current element, a binding of prefix to namespace URI.
   615 	Adds a namespace declaration to the current element: a binding of prefix to namespace URI.
   547      * 
   616     
   548      * If same namespace declaration exists (same prefix and URI), redundant namespace declaration
   617 	If the same namespace declaration exists (same prefix and URI), a redundant
   549      * will not be created.
   618 	namespace declaration will not be created.
   550      * 
   619     
   551      * Both NULL or "" (empty string) may be used for "UNDEFINED URI" and "NO PREFIX" values of arguments. 
   620 	Both KNullDesC8 or an empty descriptor may be used for "UNDEFINED URI" 
   552      *
   621 	and "NO PREFIX" values of arguments.  Please refer to the class
   553      * @since S60 v3.1
   622 	documentation for more specific information.
   554 	 * @param aNsUri Namespace URI
   623 	@see TXmlEngElement
   555      * @param aPrefix Namespace prefix
   624 	@see KNullDesC8	 
   556      * @return  A handle to the created (or found, if there is such) namespace declaration node.
   625 
   557      *          If namespace undeclaration is being created, NULL handle is returned -- it can be
   626 	Note: Undeclaring of default namespace (xmlns="") is supported by
   558      *           used in node-creation methods that take namespace handle as an argument.
   627 	the SetNoDefaultNamespace() method.    
   559      * 
   628 	@see SetNoDefaulNamespace()
   560      * @note   Undeclaring of default namespace (xmlns="") is supported by
   629     
   561      *         SetNoDefaultNamespace() method
   630 	Note:   Adding a namespace declaration that rebinds the prefix mapping (or
   562      * 
   631 	default namespace) used by nodes lower in the tree may damage the document
   563      * @see SetNoDefaulNamespace()
   632 	tree because references to namespace declarations are not updated.
   564      * 
   633 	However, after serialization, the document will have the desired structure.
   565      * @note   By adding namespace declaration that rebinds prefix mapping (or default namespace)
   634 	Use this method with care!
   566      *         used by nodes lower in the tree, document tree may become
   635     
   567      *         wrongly constructed, because references to namespace declaration are
   636 	Copies are taken of descripters passed in.
   568      *         not updated. However, after serialization the document will have
   637 	 
   569      *         desired structure.
   638 	@param aNsUri Namespace URI, KNullDesC8 or an empty descriptor.
   570      *         Use this method with care!
   639 	@param aPrefix Namespace prefix, KNullDesC8 or an empty descriptor.
   571      */ 
   640 	@return The namespace that was created or found or a NULL namespace if the
       
   641 	namespace is being undeclared.
       
   642 	@leave KXmlEngErrNullNode Element is NULL
       
   643 	@leave KXmlEngErrWrongUseOfAPI URI or prefix is not specified
       
   644 	@leave - One of the system-wide error codes
       
   645     */ 
   572     IMPORT_C TXmlEngNamespace AddNamespaceDeclarationL(const TDesC8& aNsUri, const TDesC8& aPrefix);
   646     IMPORT_C TXmlEngNamespace AddNamespaceDeclarationL(const TDesC8& aNsUri, const TDesC8& aPrefix);
   573 
   647 
   574     /**
   648     /**
   575      * Adds default namespace declaration.
   649     Adds a default namespace declaration.
   576      *
   650 
   577      * @since S60 v3.1
   651 1
   578 	 * @param aNsUri   Namespace URI;  both NULL and "" (empty string) are allowed to represent UNDEFINED NAMSPACE
   652 	This achieves the same result as with AddNamespaceDeclarationL(aNsUri,
   579      * @return    Handle to the created namespace declaration (NULL for UNDEFINED NAMESPACE)
   653 	KNullDesC8), but additionally the element's namespace is modified (if it has no
   580      *
   654 	prefix and there were no default namespace declaration in the scope) to the
   581      * Same result as with AddNamespaceDeclarationL(aNsUri, NULL), but additionally
   655 	new default one.
   582      * element's namespace modified (if it has no prefix and there were no default
   656      
   583      * namespace declaration in the scope) to the new default one.
   657 	 Copies are taken of descripters passed in.
   584      */
   658 	 @see KNullDesC8
       
   659 	 
       
   660 	@param aNsUri   Namespace URI;  KNullDesC8 and empty descriptor are allowed to represent UNDEFINED NAMSPACE
       
   661 	@return The created namespace declaration (NULL for UNDEFINED NAMESPACE)
       
   662 	@leave KXmlEngErrNullNode Element is NULL
       
   663 	@leave KXmlEngErrWrongUseOfAPI URI is not specified
       
   664 	@leave - One of the system-wide error codes
       
   665     */
   585     IMPORT_C TXmlEngNamespace SetDefaultNamespaceL(const TDesC8& aNsUri);
   666     IMPORT_C TXmlEngNamespace SetDefaultNamespaceL(const TDesC8& aNsUri);
   586 
   667 
   587     /**
   668     /**
   588      * Undeclares any default namespace for current element and its descendants.
   669     Undeclares any default namespace for this element and its descendants.
   589      * 
   670     
   590      * If there is already some default namespace,  <i>xmlns=""</i> namespace
   671     If there is already a default namespace, a @c xmlns="" namespace
   591      * declaration is added. Otherwise, nothing happens, since element with no
   672     declaration is added. Otherwise, nothing happens, since elements with no
   592      * prefix in such scope is automaticaly considered as out of any namespace.
   673     prefix in such scope are automaticaly considered outside of any namespace.
   593      * 
   674     
   594      * The side effect of this method is that namespace of the current element
   675 	The side effect of this method is that the namespace of the current element
   595      * may change from previous <b>default</b> namespace to NULL TXmlEngNamespace, which is
   676 	may change from the previous default namespace to a NULL TXmlEngNamespace,
   596      * considered an absence of namespace.
   677 	which is considered an absence of namespace.
   597      * 
   678     
   598      * If the element has prefix (i.e. not having default namespace), 
   679 	If the element has a prefix (i.e. not having default namespace), then the
   599      * then the only effect for the element is undeclaration of existing default namespace. 
   680 	only effect for the element is undeclaration of existing default namespace. 
   600      * 
   681     
   601      * If element is in the scope of another <i>xmlns=""</i> undeclaration, no
   682     If the element is in the scope of another @c xmlns="" undeclaration, no
   602      * actions are taken.
   683     action is taken.
   603      * 
   684     
   604      * @note
   685 	Note: Use AddNamespaceDeclarationL(KNullDesC8,KNullDesC8) to force the creation of a @c
   605      *     Use AddNamespaceDeclarationL(NULL,NULL) to force creation of
   686 	xmlns="" declaration within the scope of another such declaration
   606      *     xmlns=""  declaration within scope of another such declaration 
   687 	(otherwise unneccessary/duplicate declarations are not created).
   607      *     (otherwise unneccessary/duplicate declarations are not created)
   688     
   608      * 
   689 	Note: This method should be called on elements before adding children,
   609      * @note
   690 	because default namespace undeclaration is not spread into its subtree and
   610      *     This method should be called on elements before adding children,
   691 	descendants' default namespaces are not reset to NULL. This should be taken
   611      *     because default namespace undeclaration is not spread into its subtree and 
   692 	into account if later some processing on the subtree occurs.  However,
   612      *     descedants' default namespaces are not reset to NULL. This should be taken into 
   693 	after serialization and deserialization, undeclared default namespace will
   613      *     account if later some processing on the subtree occurs.
   694 	affect whole element's subtree correctly.
   614      *     However, after serialization and deserialization, undeclared default namespace will
   695 
   615      *     affect whole element's subtree correctly.
   696 	 @see KNullDesC8
   616      *
   697 		 
   617      * @since S60 v3.1
   698 	@leave KXmlEngErrNullNode Element is NULL
   618 	 */
   699 	@leave - One of the system-wide error codes
   619     IMPORT_C void SetNoDefaultNamespaceL();
   700 	*/
   620 
   701 	IMPORT_C void SetNoDefaultNamespaceL();
   621     /**
   702 
   622      * Finds namespace declaration that has specific prefix in the scope for given node
   703 	/**
   623      *
   704 	Finds the namespace declaration that has a specific prefix in the list of parents for
   624      * Prefix "" or NULL are considered the same, meaning "<b>NO PREFIX</b>".
   705 	this element.
   625      * If namespace declaration for "no prefix" is searched, then default namespace is returned. 
   706     
   626      *
   707 	If no prefix is specified (an empty descriptor or KNullDesC8) then it is 
   627      * @since S60 v3.1
   708 	considered to be a "NO PREFIX" search.  Therefore, if the namespace 
   628 	 * @param aPrefix Namespace prefix
   709 	declaration for "no prefix" is searched, then the default namespace is 
   629      * @return Namespace handler, which may be NULL if prefix is not bound.
   710 	returned.
   630      * 
   711     
   631      * NULL result for "no prefix" means that default namespace is undefined.
   712 	Copies are taken of descripters passed in.
   632      */
   713 	@see KNullDesC8 
       
   714 	 
       
   715 	@param aPrefix Namespace prefix.
       
   716 	@return The namespace, which may be NULL if prefix is not found; NULL result for "no prefix" means that default namespace is undefined.
       
   717 	@leave - One of the system-wide error codes
       
   718     */
   633     IMPORT_C TXmlEngNamespace LookupNamespaceByPrefixL(const TDesC8& aPrefix) const;
   719     IMPORT_C TXmlEngNamespace LookupNamespaceByPrefixL(const TDesC8& aPrefix) const;
   634 
   720 
   635     /**
   721 	/**
   636      * Finds namespace declaration that has specific namespace URI
   722 	Finds a namespace declaration that has a specific namespace URI in the
   637      * in the scope for the given node.
   723 	scope for the given node.
   638      *
   724      
   639      * @since S60 v3.1
   725 	KNullDesC8 value of aUri is equivalent to an empty descriptor and means
   640 	 * @param aUri  Namespace URI, for which namespace declaration is searched
   726 	"UNDEFINED NAMESPACE".
   641      * @return Handler to the namespace declaration that binds given namespace URI to some prefix 
   727 	For such URI's a NULL namespace handle is always returned even if there is
   642      *          or sets it a default namespace.
   728 	a namespace undeclaration, which has an empty descriptor URI (and KNullDesC8 
   643      * 
   729 	prefix).
   644      * NULL value of aUri is equivalent to "" and means "<b>UNDEFINED NAMESPACE</b>". 
   730     
   645      * For such URI  a NULL namespace handle is always returned even if there is
   731 	Hint: Use the returned instance of TXmlEngNamespace as the aNsDef argument
   646      * namespace undeclaration, which has "" URI (and NULL prefix).
   732 	to an element's methods that create new child elements and attributes. The
   647      * 
   733 	same TXmlEngNamespace may be used on deeper descentants of the reference
   648      * <b>Hint:</b><p>
   734 	element (and doing this way will generally increase performance of DOM tree
   649      * Use returned instance of TXmlEngNamespace as aNsDef argument to element's methods
   735 	construction). However, if namespace bindings are not controlled for the
   650      * that create new element's child elements and attributes. The same handler
   736 	element's children and the prefix (which is bound to the search namespace)
   651      * may be used on more deep descentants of the reference element (and doing
   737 	is rebound to some other namespace URI, then reusing the namespace may lead
   652      * this way will generally increase performance of DOM tree construction).<br />
   738 	to unwanted result.
   653      * <span class="color:red;">However</span>, if namespace bindings are not controlled
   739     
   654      * for element's children and prefix, which is bound to the search namespace, is
   740 	Note: At the moment it is possible to retrieve namespace declaration nodes
   655      * rebound to some other namespace URI, then reusing namespace may lead to
   741 	whose prefixes were rebound. Be careful when using returned
   656      * unwanted result.
   742 	TXmlEngNamespace objects for creation of new elements.
   657      * 
   743 	 
   658      * Consider an example:
   744 	Copies are taken of descripters passed in.
   659      * @code
   745 	 
   660      *     TXmlEngElement root = doc.DocumentElement();
   746 	@param aUri  Namespace URI, for which the namespace declaration is searched
   661      *     TXmlEngNamespace targetNs = root.AddNamespaceDeclarationL("http://example.com/","ex");
   747 	@return The namespace declaration that binds the given namespace URI to a
   662      *     TXmlEngElement el_1 = root.AddNewElementL("outer", targetNs);
   748 	prefix or sets it as a default namespace
   663      *     TXmlEngElement el_2 = el_1.AddNewElementL("inner"); // element without prefix
   749 	@leave - One of the system-wide error codes
   664      * 
   750     */
   665      *     // NOTE: prefix "ex" is not bound to "http://example.com/" anymore!
       
   666      *     el_2.AddNamespaceDeclarationL("http://whatever.com/","ex");
       
   667      *     TXmlEngElement el_3 = el_2.AddNewElementL("problem", targetNs);
       
   668      *     ...
       
   669      * @endcode
       
   670      * 
       
   671      * The sought result was (showing expanded names of elements):
       
   672      * @code
       
   673      *     --> "root"
       
   674      *         --> {"http://example.com/","outer"}
       
   675      *         --> "inner"
       
   676      *             -->{"http://example.com/","problem"}
       
   677      *                 ...
       
   678      *             <--
       
   679      *         <-- "inner"
       
   680      *         <-- {"http://example.com/","outer"}
       
   681      *         ...
       
   682      *     <-- </root>
       
   683      * @endcode
       
   684      * and it may look that it has been achieved. Indeed, if namespace of element "problem"
       
   685      * was queried, it would have URI "http://example.com/" and prefix "ex".
       
   686      * However, if namespace URI was looked up by "problem"'s prefix, it would be
       
   687      * "http://whatever.com/". We have created illegal DOM tree.
       
   688      * 
       
   689      * The actual DOM tree in serialized form will be:
       
   690      * @code
       
   691      *     <root>
       
   692      *         <ex:outer xmlns:ex="http://example.com/">
       
   693      *             <inner xmlns:ex="http://whatever.com/">
       
   694      *                 <ex:problem>
       
   695      *                 ...
       
   696      *                 </ex:problem>
       
   697      *             </inner>
       
   698      *         </ex:outer>
       
   699      *         ...
       
   700      *     </root>
       
   701      * @endcode
       
   702      * 
       
   703      * So, reuse of namespace handlers should be performed with special care.
       
   704      * 
       
   705      * @note
       
   706      * At the moment it is possible to retrieve namespace declaration nodes
       
   707      * whose prefixes were rebound. Be careful when use returned TXmlEngNamespace object
       
   708      * for creation of new elements. In later releases, this method will perform
       
   709      * safe lookup. And so far, it is better to make check that prefix of returned
       
   710      * namespace declaration has not rebound:
       
   711      * @code
       
   712      *     TXmlEngNamespace ns = element.LookupNamespaceByUri("a_uri");
       
   713      *     if (element.LookupNamespaceByPrefix(ns.Prefix()).IsSameNode(ns)){
       
   714      *         ... // now it is safe to create new elements by using "ns"
       
   715      *         element.AddNewElementL("product",ns);
       
   716      *         ...
       
   717      *     }
       
   718      * @endcode
       
   719      */
       
   720     IMPORT_C TXmlEngNamespace LookupNamespaceByUriL(const TDesC8& aUri) const;
   751     IMPORT_C TXmlEngNamespace LookupNamespaceByUriL(const TDesC8& aUri) const;
   721 
   752 
   722     /**
   753 	/**
   723      * Retrieves implicitly declared on every XML infoset binding
   754 	Retrieves the implicitly declared XML infoset binding of the 'xml' prefix
   724      * of 'xml' prefix to XML's namespace URI:
   755 	to XML's namespace URI: "http://www.w3.org/XML/1998/namespace"
   725      * "http://www.w3.org/XML/1998/namespace"
   756      
   726      *
   757     The result should be used for creating attributes beloging to the XML namespace
   727      * @since S60 v3.1
   758     (xml:lang, xml:space, xml:id , etc.)
   728 	 * @return Handler to {xml,"http://www.w3.org/XML/1998/namespace"} prefix
   759     
   729      *            binding in the current document
   760 	DO NOT USE the methods LookupNamespaceByUriL(const TDesC8&) and
   730      *
   761 	LookupNamespaceByPrefixL(const TDesC8&) (with the arguments
   731      * The result should be used for creating attributes beloging to the XML namespace
   762 	"http://www.w3.org/XML/1998/namespace" and "xml" respectively) for
   732      * (xml:lang, xml:space, xml:id , etc.)
   763 	retrieving the namespace node, since in the case of a memory allocation
   733      *
   764 	fault, a NULL result is returned (and breaks your program silently)
   734      * DO NOT USE methods LookupNamespaceByUriL(const TDesC8&) and LookupNamespaceByPrefixL(const TDesC8&)
   765     
   735      * (with "http://www.w3.org/XML/1998/namespace" and "xml" arguments) for retrieving
   766 	Note:  Normally the 'xml' prefix is bound to the XML namespace URI in the
   736      * namespace node, since in a case of [possible] memory allocation fault
   767 	document node, BUT if this element is not a part of the document tree yet,
   737      * NULL result is returned (and breaks your program silently)
   768 	the requested namespace declaration WILL BE ADDED to the current node.
   738      * 
   769 	This is the reason why the method may fail in OOM conditions.
   739      * @note   Normally 'xml' prefix is bound to XML namespace URI in the document
   770 
   740      *        node, BUT if current node is not a part of the document tree yet,
   771 	@return The namespace matching the prefix binding
   741      *        the requested namespace declaration WILL BE ADDED to the current node.
   772 	{xml,"http://www.w3.org/XML/1998/namespace"} in the current document
   742      *        This is the reason why the method may fail in OOM conditions.
   773 	@leave KErrNoMemory The element is NULL or there was a memory allocation error
   743      */
   774 	@leave - One of the system-wide error codes
       
   775     */
   744     IMPORT_C TXmlEngNamespace TheXMLNamespaceL() const;
   776     IMPORT_C TXmlEngNamespace TheXMLNamespaceL() const;
   745 
   777 
   746     /**
   778 	/**
   747      * Get default namespace for element.
   779 	Get the default namespace for the element.
   748      *
   780      
   749      * @since S60 v3.1
   781 	A NULL TXmlEngNamespace means that an element with no prefix
   750 	 * @return Default namespace in the scope of the element
   782 	has no namespace associated with it because no default namespace was declared or
   751      *
   783 	the default namespace was undeclared with @c xmlns=""
   752      * NULL TXmlEngNamespace means that element with no prefix have no namespace associated
   784     
   753      * because no default namespace was declared or default namespace was undeclared with <b>xmlns=""</b>
   785 	This function is equivalent to LookupNamespaceByPrefixL(KNullDesC8).
   754      *
   786 	@see KNullDesC8
   755      * Equivalent to LookupNamespaceByPrefixL(const TDesC8&) with NULL (or "") prefix provided
   787 	
   756      */
   788 	@return The default namespace in the scope of the element
       
   789 	@leave - One of the system-wide error codes
       
   790     */
   757     inline   TXmlEngNamespace DefaultNamespaceL() const;
   791     inline   TXmlEngNamespace DefaultNamespaceL() const;
   758 
   792 
   759     /**
   793 	/**
   760      * Performs search of namespace handler in the scope of the element. This method will
   794 	Performs a search for the namespace in the scope of the element. This
   761      * create new namespace declaration on the element if such namespace is not available.
   795 	method will create new namespace declaration on the element if such
   762      *
   796 	namespace is not found.
   763      * @since S60 v3.1
   797 
   764 	 * @param aNsUri   Searched namespace
   798 	Note: Be sure not to use the result of this method for non-descendants of
   765      * @param aPrefix  Prefix to use for <b>new</b> namespace declaration (if it is to be created)
   799 	the element or in situations when prefix overlapping might occur.
   766      * @return    TXmlEngNamespace handler that may be used to create new attributes and child elements of
   800 	@see TXmlEngAttr
   767      *            the element. The namespace may be one of those existed previously or was created
   801 	@see TXmlEngNamespace
   768      *
   802   Please read the documentation for this class:
   769      * @note
   803 	@see TXmlEngElement
   770      *    Be sure not to use the result of this method for non-descendants of the element or in situations
   804      
   771      *    when prefix overlapping might occur (read also about general general considerations of attributes
   805 	Copies are taken of descripters passed in.
   772      *    and elements creation using namespace handlers)
   806 
   773      */
   807 	@param aNsUri   Namespace to search for
       
   808 	@param aPrefix  Prefix to use for the new namespace declaration (if it is to be created)
       
   809 	@return The namespace found or created
       
   810 	@leave KXmlEngErrNullNode Element is NULL
       
   811 	@leave KXmlEngErrWrongUseOfAPI URI is not specified
       
   812 	@leave - One of the system-wide error codes
       
   813 	
       
   814 	@see LookupNamespacebyUriL
       
   815     */
   774     IMPORT_C TXmlEngNamespace FindOrCreateNsDeclL(const TDesC8& aNsUri, const TDesC8& aPrefix);
   816     IMPORT_C TXmlEngNamespace FindOrCreateNsDeclL(const TDesC8& aNsUri, const TDesC8& aPrefix);
   775 
   817 
   776     /**
   818 	/**
   777      * Performs search on the element and its ascendants for any namespace declaration
   819 	Performs a search on the element and its ascendants for any namespace
   778      * with given URI and create a new namespace declaration with some (unique) prefix
   820 	declaration with a given URI.  Creates a new namespace declaration with a
   779      * if the search was not successful.
   821 	(unique) prefix if the search was not successful.		 
   780      *
   822 	@see AddNamespaceDeclarationL
   781      * @since S60 v3.1
   823      
   782 	 * @param aNsUri   Searched namespace
   824 	 Copies are taken of descripters passed in.
   783      * @return    TXmlEngNamespace handler that may be used to create new attributes and child elements of
   825 	 
   784      *            the element. The namespace may be one of those existed previously or was created
   826 	@param aNsUri Namespace to search for
   785      */
   827 	@return The namespace found or created
       
   828 	@leave KXmlEngErrNullNode Element is NULL
       
   829 	@leave KXmlEngErrWrongUseOfAPI URI is not specified
       
   830 	@leave - One of the system-wide error codes
       
   831     */
   786     IMPORT_C TXmlEngNamespace FindOrCreateNsDeclL(const TDesC8& aNsUri);
   832     IMPORT_C TXmlEngNamespace FindOrCreateNsDeclL(const TDesC8& aNsUri);
   787 
   833 
   788     /**
   834     /**
   789      * Checks whether a prefix has been bound in this element (not in one of its ascendants)
   835     Checks whether a prefix has been bound in this element (not in one of its ascendants)
   790      * 
   836     
   791      * Use this method for preventig prefix-name collision in a element node
   837     Use this method for preventing prefix-name collision in a element node
   792      *
   838      
   793      * @since S60 v3.1
   839 	 Copies are taken of descripters passed in.
   794 	 * @param aPrefix Namespace prefix
   840 	 
   795      * @return TRUE if there is already namespace declaration that uses aPrefix on this element
   841 	@param aPrefix Namespace prefix
   796      */
   842     @return ETrue if there is already a namespace declaration that uses aPrefix on this element
       
   843 	@leave - One of the system-wide error codes
       
   844     */
   797     IMPORT_C TBool HasNsDeclarationForPrefixL(const TDesC8& aPrefix) const;
   845     IMPORT_C TBool HasNsDeclarationForPrefixL(const TDesC8& aPrefix) const;
   798     
   846     
   799     /**
   847     /**
   800      * Copies the element with its attributes, but not child nodes
   848     Copies the element with its attributes, but not child nodes
   801      * 
   849     
   802      * If context is preserved, then all namespace declarations that are in the element are
   850 	If the context is preserved (preserveNsContent), then all namespace
   803      * writen to element's start tag too.
   851 	declarations that are in the element are writen to the <element ...> tag.
   804      *
   852 
   805      * @since S60 v3.1
   853 	@param preserveNsContext Whether the namespace context should be preserved
   806 	 * @param preserveNsContext TRUE if context should be preserved
   854     @return The copied element
   807      * @return handle to copy of element
   855 	@leave KXmlEngErrNullNode The element is NULL
   808      */
   856 	@leave - One of the system-wide error codes
       
   857     */
   809     IMPORT_C TXmlEngElement ElementCopyNoChildrenL(TBool preserveNsContext) const;
   858     IMPORT_C TXmlEngElement ElementCopyNoChildrenL(TBool preserveNsContext) const;
   810     
   859     
   811     /**
   860     /**
   812      * Specialized version of TXmlEngNode::CopyL()
   861     Specialized version of TXmlEngNode::CopyL()
   813      *
   862 	@return Deep copy of the element.
   814      * @since S60 v3.1
   863 	@leave KXmlEngErrNullNode The element is NULL
   815 	 * @return Deep copy of the element.
   864 	@leave - One of the system-wide error codes
   816      */
   865     */
   817     inline   TXmlEngElement CopyL() const;
   866     inline   TXmlEngElement CopyL() const;
   818 
   867 
   819     /**
   868     /** Resets element's content: all child nodes are removed */
   820      * Resets element's content: all child nodes are removed
       
   821      *
       
   822      * @since S60 v3.1
       
   823 	 */
       
   824     IMPORT_C void RemoveChildren();
   869     IMPORT_C void RemoveChildren();
   825 
   870 
   826     /**
   871     /** Resets element's attributes */
   827      * Resets element's attributes
       
   828      *
       
   829      * @since S60 v3.1
       
   830 	 */
       
   831     IMPORT_C void RemoveAttributes();
   872     IMPORT_C void RemoveAttributes();
   832 
   873 
   833     /**
   874     /**
   834      * Resets all namespace declarations made in the element
   875     Resets all namespace declarations made in the element
   835      * 
   876     
   836      * @note There can be references to these namespace declaration from elsewhere!
   877 	Note: There can be references to these namespace declarations elsewhere!
   837      *      Use ReconcileNamespacesL() to fix that.
   878 	Use ReconcileNamespacesL() to fix that.
   838      *
   879 	*/
   839      * @since S60 v3.1
   880 	IMPORT_C void RemoveNamespaceDeclarations();
   840 	 */
   881 
   841     IMPORT_C void RemoveNamespaceDeclarations();
   882     /**
   842 
   883     Removes all element contents: child nodes, attributes and namespace declarations
   843     /**
   884     
   844      * Removes all element contents: child nodes, attributes and namespace declarations
   885   @see RemoveChildren() 
   845      *
   886 	@see RemoveAttributes()
   846      * @see RemoveChildren(), RemoveAttributes(), RemoveNamespaceDeclarations();
   887 	@see RemoveNamespaceDeclarations();
   847      *
   888 	*/
   848      * @since S60 v3.1
       
   849 	 */
       
   850     inline   void ClearElement();
   889     inline   void ClearElement();
   851 
   890 
   852     /**
   891 	/**
   853      * Copies attributes from another element
   892 	Copies attributes from another element.  It may be a very convenient method
   854      *
   893 	for initializing element with a set of predefined attributes.
   855      * It may be a very convenient method for initializing element with a set of predefined attributes.
   894 
   856      *
   895 	Note: Namespaces of the this element may need to be reconciled if the
   857      * @since S60 v3.1
   896 	copied attributes belong to any namespace that is not declared on some
   858 	 * @param aSrc source element
   897 	ascendant of this node.  @see ReconcileNamespacesL()
   859      * 
   898 
   860      * @note
   899 	@param aSrc Source element
   861      *  Namespaces of the this element may need to be reconciled if copied attributes
   900 	@leave KXmlEngErrNullNode The element is NULL
   862      *  belong to any namespace that is not declared on some ascendant of this node.
   901 	@leave - One of the system-wide error codes
   863      * @see ReconcileNamespacesL()
   902     */  
   864      */  
       
   865     IMPORT_C void CopyAttributesL(TXmlEngElement aSrc);
   903     IMPORT_C void CopyAttributesL(TXmlEngElement aSrc);
   866 
   904 
   867     /**
   905 	/**
   868      * Copies a list of elements.
   906 	Recursively copies the children (and all of it's associated information) 
   869      *
   907 	from another element.  Elements are appended to the current element's 
   870      * Elements are appended to the element's children list.
   908 	children list.
   871      *
   909     
   872      * @since S60 v3.1
   910 	Note: Namespaces of this element may need to be reconciled after copy
   873 	 * @param aSrc source element
   911 	operation 
   874      *
   912 	@see ReconcileNamespacesL()
   875      * @note Namespaces of the this element may need to be reconciled after copy operation
   913 
   876      * @see  ReconcileNamespacesL()
   914 	@param aSrc Source element
   877      */
   915 	@leave KXmlEngErrNullNode The element is NULL
       
   916 	@leave KXmlEngWrongUseOfAPI The source element is NULL
       
   917 	@leave - One of the system-wide error codes
       
   918     */
   878     IMPORT_C void CopyChildrenL(TXmlEngElement aSrc);
   919     IMPORT_C void CopyChildrenL(TXmlEngElement aSrc);
   879 
   920 
   880     /**
   921 	/**
   881      * Removes attribute with given name and namespace URI(if such exists).
   922 	Removes the child element with the given name and namespace URI (if it exists).
   882      * Memory allocated for the attribute is freed.
   923 	Memory allocated for the element is freed.
   883      *
   924      
   884      * @since S60 v3.1
   925 	@param aLocalName Child element name
   885 	 * @param aLocalName Element name
   926     @param aNamespaceUri Child element namespace
   886      * @param aNamespaceUri Element namespace
   927 	@leave KXmlEngErrNullNode The element is NULL
   887      */
   928 	@leave - One of the system-wide error codes
       
   929     */
   888     IMPORT_C void RemoveChildElementsL(const TDesC8& aLocalName,const TDesC8& aNamespaceUri);
   930     IMPORT_C void RemoveChildElementsL(const TDesC8& aLocalName,const TDesC8& aNamespaceUri);
   889 
   931 
   890     /** @} */
   932 	/**
   891 
   933 	Renames the element with the given name, namespace URI, and namespace prefix.
   892     /** 
   934 
   893     *    @name DOM Level 3 Core methods
   935 	@param aLocalName The new element name
   894     *
   936 	@param aNamespaceUri The new namespace URI
   895     *    @note
   937 	@param aPrefix The new namespace prefix
   896     *        Most methods of DOM spec operate with fully-qualified names (QNames)
   938 	@leave - One of the system-wide error codes
   897     *        of elements and attributes. It is different in this API - all methods
   939 	*/
   898     *        instead accept prefix and localName parts of QName.
   940 	IMPORT_C void RenameElementL(const TDesC8& aLocalName, const TDesC8& aNamespaceUri, const TDesC8& aPrefix);
   899     */
   941 
   900     /** @{ */
   942     /* 
   901     
   943 	DOM Level 3 Core methods
   902     /**
   944 
   903      * Returns value of attribute with given name and namespace URI
   945 	Most methods of DOM spec operate with fully-qualified names (QNames)
   904      *
   946 	of elements and attributes. It is different in this API - all methods
   905      * @since S60 v3.1
   947 	instead accept prefix and localName parts of QName.
   906 	 * @param aLocalName Local name of attribute node
   948     */
   907      * @param aNamespaceUri Namespace URI of attribute
   949     
   908      * @return Attribute value
   950     /**
   909      */
   951     Returns the value of the attribute with the given name and namespace URI.
       
   952      
       
   953 	@param aLocalName Local name of the attribute
       
   954 	@param aNamespaceUri Namespace URI of the attribute, or the default namespace if not specified.
       
   955 	@return The attribute value (for as long as the attribute exists) or 
       
   956 	NULL if not found.
       
   957 	@leave - One of the system-wide error codes
       
   958     */
   910     IMPORT_C TPtrC8 AttributeValueL(const TDesC8& aLocalName, 
   959     IMPORT_C TPtrC8 AttributeValueL(const TDesC8& aLocalName, 
   911                                     const TDesC8& aNamespaceUri = KNullDesC8) const;
   960                                     const TDesC8& aNamespaceUri = KNullDesC8) const;
   912 
   961 
   913     /**
   962     /**
   914      * Initializes list of child elements with matching name and namespace URI.
   963     Initializes list of child elements with matching names and namespace URIs.
   915      *
   964 
   916      * @since S60 v3.1
   965     Note: This method does not list all descendants of the element, only child elements
   917 	 * @param aList Node list to be initialized
   966 	@see KNullDesC8	 
   918      * @param aLocalName Element name
   967      
   919      * @param aNamespaceUri Namespace URI, default is NULL
   968 	@param aList Node list to be created
   920      *
   969     @param aLocalName Element name
   921      * @note This method does not lists all descedants of the element, only child elements
   970     @param aNamespaceUri if specified it sets the Namespace URI, default is KNullDesC8 (no namespace set).
   922      */
   971 	@leave - One of the system-wide error codes
       
   972     */
   923     IMPORT_C void  GetElementsByTagNameL(RXmlEngNodeList<TXmlEngElement>& aList, 
   973     IMPORT_C void  GetElementsByTagNameL(RXmlEngNodeList<TXmlEngElement>& aList, 
   924                                          const TDesC8& aLocalName, 
   974                                          const TDesC8& aLocalName, 
   925                                          const TDesC8& aNamespaceUri = KNullDesC8) const;
   975                                          const TDesC8& aNamespaceUri = KNullDesC8) const;
   926     
   976     
   927     /**
   977 	/**
   928      * Sets value of attribute; attribute is created if there is no such attribute yet
   978 	Sets the value of the given attribute.  The attribute is created if there
   929      *
   979 	is no such attribute yet.
   930      * @since S60 v3.1
   980 
   931 	 * @param aLocalName Attribute name
   981 	Note: If prefix is not KNullDesC8 (or an empty descriptor), 
   932      * @param aValue Attribute value
   982 	then the namespace URI may not be empty see 
   933      * @param aNamespaceUri Namespace URI - default is NULL
   983  	http://www.w3.org/TR/REC-xml-names/#ns-decl (Definition #3)
   934      * @param aPrefix Namespace prefix - default is NULL
   984      
   935      *
   985 	Copies are taken of descripters passed in.
   936      * @note
   986 	@see KNullDesC8	 
   937      *  If prefix is not NULL (or ""), then namespace URI may not be empty
   987 		 
   938      *  see http://www.w3.org/TR/REC-xml-names/#ns-decl (Definition #3)
   988 	@param aLocalName Attribute name
   939      */
   989     @param aValue Attribute value
       
   990     @param aNamespaceUri Namespace URI - default is KNullDesC8
       
   991     @param aPrefix Namespace prefix - default is KNullDesC8
       
   992 	@leave KXmlEngErrNullNode The element is NULL
       
   993 	@leave KXmlEngErrWrongUseOfAPI Attribute name not specified
       
   994 	@leave - One of the system-wide error codes
       
   995     */
   940     IMPORT_C void  SetAttributeL(const TDesC8& aLocalName, 
   996     IMPORT_C void  SetAttributeL(const TDesC8& aLocalName, 
   941                                  const TDesC8& aValue, 
   997                                  const TDesC8& aValue, 
   942                                  const TDesC8& aNamespaceUri = KNullDesC8, 
   998                                  const TDesC8& aNamespaceUri = KNullDesC8, 
   943                                  const TDesC8& aPrefix = KNullDesC8);
   999                                  const TDesC8& aPrefix = KNullDesC8);
   944 
  1000 
   945     /**
  1001 	/**
   946      * Removes attribute with given name and namespace URI(if such exists).
  1002 	Removes the attribute with the given name and namespace URI (if it exists).
   947      * Memory allocated for the attribute is freed.
  1003 	Memory allocated for the attribute is freed.
   948      *
  1004 
   949      * @since S60 v3.1
  1005 	@see KNullDesC8	 
   950 	 * @param aLocalName Name of the attribute
  1006 	 
   951      * @param aNamespaceUri Attribute namespace URI, default is NULL
  1007 	@param aLocalName Name of the attribute
   952      */
  1008 	@param aNamespaceUri Attribute namespace URI, default is KNullDesC8
       
  1009 	@leave - One of the system-wide error codes
       
  1010     */
   953     IMPORT_C void  RemoveAttributeL(const TDesC8& aLocalName, 
  1011     IMPORT_C void  RemoveAttributeL(const TDesC8& aLocalName, 
   954                                     const TDesC8& aNamespaceUri = KNullDesC8);
  1012                                     const TDesC8& aNamespaceUri = KNullDesC8);
   955 
  1013 
   956     /**
  1014 	/**
   957      * Retrieves attribute node from specific namespace by its name.
  1015 	Retrieves an attribute node with a specific namespace by its name.
   958      *
  1016 
   959      * @since S60 v3.1
  1017 	@see KNullDesC8	 
   960 	 * @param aLocalName Name of the attribute
  1018 		 
   961      * @param aNamespaceUri Attribute namespace URI, default is NULL
  1019 	@param aLocalName Name of the attribute
   962      * @return Attribute node with matching namespace URI and name
  1020 	@param aNamespaceUri Attribute namespace URI, default is KNullDesC8
   963      */
  1021 	@return Attribute node with matching namespace URI and name, NULL if not found.
       
  1022 	@leave - One of the system-wide error codes
       
  1023     */
   964     IMPORT_C TXmlEngAttr AttributeNodeL(const TDesC8& aLocalName, 
  1024     IMPORT_C TXmlEngAttr AttributeNodeL(const TDesC8& aLocalName, 
   965                                   const TDesC8& aNamespaceUri = KNullDesC8) const;
  1025                                   const TDesC8& aNamespaceUri = KNullDesC8) const;
   966 
  1026 
   967     /**
  1027     /**
   968      * Check if element has attribute with given parameters.
  1028     Check if the element has an attribute with given parameters.
   969      *
  1029 
   970      * @since S60 v3.1
  1030     This function is the same as AttributeNodeL(uri,name).NotNull().
   971 	 * @param aLocalName Name of attribute
  1031 
   972      * @param aNamespaceUri Namespace uri, default is NULL.
  1032 	@see KNullDesC8	 
   973      * @return TRUE if the element holds an attribute with such namespace URI and name.
  1033      
   974      *
  1034 	@param aLocalName Name of attribute
   975      * Same result gives AttributeNodeL(uri,name).NotNull()
  1035     @param aNamespaceUri Namespace uri, default is KNullDesC8.
   976      */
  1036     @return ETrue if the element holds an attribute with such namespace URI and name.
       
  1037 	@leave - One of the system-wide error codes
       
  1038     */
   977     inline     TBool HasAttributeL(const TDesC8& aLocalName, 
  1039     inline     TBool HasAttributeL(const TDesC8& aLocalName, 
   978                                    const TDesC8& aNamespaceUri  = KNullDesC8) const;
  1040                                    const TDesC8& aNamespaceUri  = KNullDesC8) const;
   979 
  1041 
   980     /**
  1042 	/**
   981      * Links attribute into tree
  1043 	Adds an attribute to this element.  If an attribute of the same name
   982      *
  1044 	exists, it will be destroyed.
   983      * @since S60 v3.1
  1045      
   984 	 * @param aNewAttr new attribute
  1046 	@param aNewAttr The new attribute
   985      * 
  1047 	@leave KXmlEngErrNullNode The element or attribute is NULL
   986      * The replaced attribute node is not returned and just deleted
  1048 	@leave - One of the system-wide error codes
   987      */
  1049     */
   988     IMPORT_C void  SetAttributeNodeL(TXmlEngAttr aNewAttr);
  1050     IMPORT_C void  SetAttributeNodeL(TXmlEngAttr aNewAttr);
   989 };
  1051 };
   990 
  1052 
   991 
  1053 
   992 
  1054 #include <xml/dom/xmlengelement.inl>
   993 #include "xmlengelement.inl"
  1055 
   994 
  1056 #endif /* XMLENGELEMENT_H */
   995 #endif /* XMLENGINE_ELEMENT_H_INCLUDED */
  1057