epoc32/include/xmlengelement.inl
branchSymbian2
changeset 2 2fe1408b6811
parent 0 061f57f2323e
equal deleted inserted replaced
1:666f914201fb 2:2fe1408b6811
     1 xmlengelement.inl
     1 /*
       
     2 * Copyright (c) 2004-2006 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     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
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:       Inline functions specyfic for element node
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 
       
    23 
       
    24 
       
    25 // -------------------------------------------------------------------------------------
       
    26 // Default constructor
       
    27 // -------------------------------------------------------------------------------------
       
    28 //
       
    29 inline TXmlEngElement::TXmlEngElement():TXmlEngNode(NULL) {}
       
    30 
       
    31 // -------------------------------------------------------------------------------------
       
    32 // Constructor
       
    33 // -------------------------------------------------------------------------------------
       
    34 //
       
    35 inline TXmlEngElement::TXmlEngElement(void* aInternal): TXmlEngNode(aInternal) {}
       
    36 
       
    37 
       
    38 // -------------------------------------------------------------------------------------
       
    39 // Creates new attribute node using namespace of its parent element (this element),
       
    40 // sets attribute's value and links it as the last attribute of the element
       
    41 //
       
    42 // @param aName	- Local name of attribute 
       
    43 // @param aValue - Value to set for new attribute or NULL (sets value to "")
       
    44 // @return A handler to the newly created attribute node;
       
    45 //
       
    46 // For more hints how to use it refer to AddNewAttributeL(const TDesC8&,const TDesC8&)
       
    47 //		
       
    48 // @note	
       
    49 // 	- No checks are made that attribute with such name exists
       
    50 // 	- if namespace of the parent element is default (i.e. bound prefix is NULL),
       
    51 // 	  then temporary prefix will be used and bound to the same namespace URI as elements
       
    52 // 	  (It is due to the fact that default namespaces do not spread on unprefixed attributes,
       
    53 // 	   see http://w3.org/TR/REC-xml-names/#defaulting)
       
    54 // -------------------------------------------------------------------------------------
       
    55 //
       
    56 inline TXmlEngAttr TXmlEngElement::AddNewAttributeSameNsL(const TDesC8& aName, const TDesC8& aValue)
       
    57     {
       
    58     return AddNewAttributeL(aName, aValue, NamespaceDeclaration());
       
    59     }
       
    60 
       
    61 // -------------------------------------------------------------------------------------
       
    62 // @return Default namespace in the scope of the element
       
    63 //
       
    64 // NULL TXmlEngNamespace means that element with no prefix have no namespace associated
       
    65 // because no default namespace was declared or default namespace was undeclared with <b>xmlns=""</b>
       
    66 //
       
    67 // Equivalent to LookupNamespaceByPrefixL() with NULL (or "") prefix provided
       
    68 // -------------------------------------------------------------------------------------
       
    69 //
       
    70 inline TXmlEngNamespace TXmlEngElement::DefaultNamespaceL() const
       
    71     {
       
    72     return LookupNamespaceByPrefixL(KNullDesC8);
       
    73     }
       
    74 
       
    75 // -------------------------------------------------------------------------------------
       
    76 // Specialized version of TXmlEngNode::CopyL()
       
    77 //
       
    78 // @return Deep copy of the element.
       
    79 // -------------------------------------------------------------------------------------
       
    80 //
       
    81 inline TXmlEngElement TXmlEngElement::CopyL() const
       
    82     {return TXmlEngNode::CopyL().AsElement();}
       
    83 
       
    84 // -------------------------------------------------------------------------------------
       
    85 // Removes all element contents: child nodes, attributes and namespace declarations
       
    86 //
       
    87 // @see RemoveChildren(), RemoveAttributes(), RemoveNamespaceDeclarations();
       
    88 // -------------------------------------------------------------------------------------
       
    89 //
       
    90 inline void TXmlEngElement::ClearElement()
       
    91     {
       
    92     RemoveChildren();
       
    93     RemoveAttributes();
       
    94     RemoveNamespaceDeclarations();
       
    95     }
       
    96 
       
    97 // -------------------------------------------------------------------------------------
       
    98 // -------------------------------------------------------------------------------------
       
    99 //
       
   100 
       
   101 
       
   102 // -------------------------------------------------------------------------------------
       
   103 // Returns TRUE if the element holds an attribute with such namespace URI and name.
       
   104 //
       
   105 // Same result gives AttributeNodeL(uri,name).NotNull()
       
   106 // -------------------------------------------------------------------------------------
       
   107 //
       
   108 inline TBool TXmlEngElement::HasAttributeL(const TDesC8& aLocalName, const TDesC8& aNamespaceUri) const
       
   109 	{return AttributeNodeL(aLocalName, aNamespaceUri).NotNull();}
       
   110 
       
   111 
       
   112 
       
   113