williamr@2: /* williamr@2: * Copyright (c) 2004-2006 Nokia Corporation and/or its subsidiary(-ies). williamr@2: * All rights reserved. williamr@2: * This component and the accompanying materials are made available williamr@2: * 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 williamr@2: * which accompanies this distribution, and is available williamr@2: * at the URL "http://www.symbianfoundation.org/legal/licencesv10.html". williamr@2: * williamr@2: * Initial Contributors: williamr@2: * Nokia Corporation - initial contribution. williamr@2: * williamr@2: * Contributors: williamr@2: * williamr@2: * Description: Inline functions specyfic for element node williamr@2: * williamr@2: */ williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: // ------------------------------------------------------------------------------------- williamr@2: // Default constructor williamr@2: // ------------------------------------------------------------------------------------- williamr@2: // williamr@2: inline TXmlEngElement::TXmlEngElement():TXmlEngNode(NULL) {} williamr@2: williamr@2: // ------------------------------------------------------------------------------------- williamr@2: // Constructor williamr@2: // ------------------------------------------------------------------------------------- williamr@2: // williamr@2: inline TXmlEngElement::TXmlEngElement(void* aInternal): TXmlEngNode(aInternal) {} williamr@2: williamr@2: williamr@2: // ------------------------------------------------------------------------------------- williamr@2: // Creates new attribute node using namespace of its parent element (this element), williamr@2: // sets attribute's value and links it as the last attribute of the element williamr@2: // williamr@2: // @param aName - Local name of attribute williamr@2: // @param aValue - Value to set for new attribute or NULL (sets value to "") williamr@2: // @return A handler to the newly created attribute node; williamr@2: // williamr@2: // For more hints how to use it refer to AddNewAttributeL(const TDesC8&,const TDesC8&) williamr@2: // williamr@2: // @note williamr@2: // - No checks are made that attribute with such name exists williamr@2: // - if namespace of the parent element is default (i.e. bound prefix is NULL), williamr@2: // then temporary prefix will be used and bound to the same namespace URI as elements williamr@2: // (It is due to the fact that default namespaces do not spread on unprefixed attributes, williamr@2: // see http://w3.org/TR/REC-xml-names/#defaulting) williamr@2: // ------------------------------------------------------------------------------------- williamr@2: // williamr@2: inline TXmlEngAttr TXmlEngElement::AddNewAttributeSameNsL(const TDesC8& aName, const TDesC8& aValue) williamr@2: { williamr@2: return AddNewAttributeL(aName, aValue, NamespaceDeclaration()); williamr@2: } williamr@2: williamr@2: // ------------------------------------------------------------------------------------- williamr@2: // @return Default namespace in the scope of the element williamr@2: // williamr@2: // NULL TXmlEngNamespace means that element with no prefix have no namespace associated williamr@2: // because no default namespace was declared or default namespace was undeclared with xmlns="" williamr@2: // williamr@2: // Equivalent to LookupNamespaceByPrefixL() with NULL (or "") prefix provided williamr@2: // ------------------------------------------------------------------------------------- williamr@2: // williamr@2: inline TXmlEngNamespace TXmlEngElement::DefaultNamespaceL() const williamr@2: { williamr@2: return LookupNamespaceByPrefixL(KNullDesC8); williamr@2: } williamr@2: williamr@2: // ------------------------------------------------------------------------------------- williamr@2: // Specialized version of TXmlEngNode::CopyL() williamr@2: // williamr@2: // @return Deep copy of the element. williamr@2: // ------------------------------------------------------------------------------------- williamr@2: // williamr@2: inline TXmlEngElement TXmlEngElement::CopyL() const williamr@2: {return TXmlEngNode::CopyL().AsElement();} williamr@2: williamr@2: // ------------------------------------------------------------------------------------- williamr@2: // Removes all element contents: child nodes, attributes and namespace declarations williamr@2: // williamr@2: // @see RemoveChildren(), RemoveAttributes(), RemoveNamespaceDeclarations(); williamr@2: // ------------------------------------------------------------------------------------- williamr@2: // williamr@2: inline void TXmlEngElement::ClearElement() williamr@2: { williamr@2: RemoveChildren(); williamr@2: RemoveAttributes(); williamr@2: RemoveNamespaceDeclarations(); williamr@2: } williamr@2: williamr@2: // ------------------------------------------------------------------------------------- williamr@2: // ------------------------------------------------------------------------------------- williamr@2: // williamr@2: williamr@2: williamr@2: // ------------------------------------------------------------------------------------- williamr@2: // Returns TRUE if the element holds an attribute with such namespace URI and name. williamr@2: // williamr@2: // Same result gives AttributeNodeL(uri,name).NotNull() williamr@2: // ------------------------------------------------------------------------------------- williamr@2: // williamr@2: inline TBool TXmlEngElement::HasAttributeL(const TDesC8& aLocalName, const TDesC8& aNamespaceUri) const williamr@2: {return AttributeNodeL(aLocalName, aNamespaceUri).NotNull();} williamr@2: williamr@2: williamr@2: williamr@2: