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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // Inline functions specyfic for element node
15 // Default constructor
18 inline TXmlEngElement::TXmlEngElement():TXmlEngNode(NULL) {}
20 // -------------------------------------------------------------------------------------
22 // -------------------------------------------------------------------------------------
24 inline TXmlEngElement::TXmlEngElement(void* aInternal): TXmlEngNode(aInternal) {}
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
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;
35 // For more hints how to use it refer to AddNewAttributeL(const TDesC8&,const TDesC8&)
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 // -------------------------------------------------------------------------------------
45 inline TXmlEngAttr TXmlEngElement::AddNewAttributeSameNsL(const TDesC8& aName, const TDesC8& aValue)
47 return AddNewAttributeL(aName, aValue, NamespaceDeclaration());
50 // -------------------------------------------------------------------------------------
51 // @return Default namespace in the scope of the element
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>
56 // Equivalent to LookupNamespaceByPrefixL() with NULL (or "") prefix provided
57 // -------------------------------------------------------------------------------------
59 inline TXmlEngNamespace TXmlEngElement::DefaultNamespaceL() const
61 return LookupNamespaceByPrefixL(KNullDesC8);
64 // -------------------------------------------------------------------------------------
65 // Specialized version of TXmlEngNode::CopyL()
67 // @return Deep copy of the element.
68 // -------------------------------------------------------------------------------------
70 inline TXmlEngElement TXmlEngElement::CopyL() const
71 {return TXmlEngNode::CopyL().AsElement();}
73 // -------------------------------------------------------------------------------------
74 // Removes all element contents: child nodes, attributes and namespace declarations
76 // @see RemoveChildren(), RemoveAttributes(), RemoveNamespaceDeclarations();
77 // -------------------------------------------------------------------------------------
79 inline void TXmlEngElement::ClearElement()
83 RemoveNamespaceDeclarations();
86 // -------------------------------------------------------------------------------------
87 // -------------------------------------------------------------------------------------
91 // -------------------------------------------------------------------------------------
92 // Returns TRUE if the element holds an attribute with such namespace URI and name.
94 // Same result gives AttributeNodeL(uri,name).NotNull()
95 // -------------------------------------------------------------------------------------
97 inline TBool TXmlEngElement::HasAttributeL(const TDesC8& aLocalName, const TDesC8& aNamespaceUri) const
98 {return AttributeNodeL(aLocalName, aNamespaceUri).NotNull();}