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