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