1.1 --- a/epoc32/include/xmlengnamespace.h Tue Nov 24 13:55:44 2009 +0000
1.2 +++ b/epoc32/include/xmlengnamespace.h Tue Mar 16 16:12:26 2010 +0000
1.3 @@ -1,1 +1,161 @@
1.4 -xmlengnamespace.h
1.5 +/*
1.6 +* Copyright (c) 2004-2006 Nokia Corporation and/or its subsidiary(-ies).
1.7 +* All rights reserved.
1.8 +* This component and the accompanying materials are made available
1.9 +* 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
1.10 +* which accompanies this distribution, and is available
1.11 +* at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
1.12 +*
1.13 +* Initial Contributors:
1.14 +* Nokia Corporation - initial contribution.
1.15 +*
1.16 +* Contributors:
1.17 +*
1.18 +* Description: Namespace node functions
1.19 +*
1.20 +*/
1.21 +
1.22 +
1.23 +
1.24 +
1.25 +
1.26 +
1.27 +
1.28 +#ifndef XMLENGINE_NAMESPACE_H_INCLUDED
1.29 +#define XMLENGINE_NAMESPACE_H_INCLUDED
1.30 +
1.31 +#include "xmlengnode.h"
1.32 +
1.33 +/**
1.34 + * Represents existing namespace declaration in DOM tree <b>OR</b> namespace node returned
1.35 + * in RXmlEngNodeSet as a result of some XPath expression.
1.36 + *
1.37 + * All elements and attributes may have a namespace instance associated.
1.38 + * Once put in element, a namespace declaration (instance of TXmlEngNamespace) may be
1.39 + * referred to by all attributes and descentants of the element (unless
1.40 + * prefix that this namespace-to-prefix binding uses is overriden somewhere below in the document tree)
1.41 + *
1.42 + * <b>General rules of namespace handling:</b>
1.43 + *
1.44 + * - <b>NULL</b> prefix in namespace node means NO PREFIX. ""(empty string '\\0') can be used for specifying
1.45 + * absense of prefix when setting it, however <b>NULL</b> will be stored and returned.
1.46 + *
1.47 + * - <b>NULL</b> value of namespace URI is legal only with <b>NULL</b> prefix and only met in
1.48 + * undeclaration of namespace (<i>xmlns=""</i>). <b>""</b> (empty string) can be used too, however it
1.49 + * will be returned as <b>NULL</b>.
1.50 + *
1.51 + * - <b>NULL</b> or <b>""</b> namespace <b>URI</b> with non-<b>NULL</b> prefix is illegal acording to the XML specification.
1.52 + *
1.53 + * - Namespace of a element is <b>default</b> if it is associated with some namespace declaration with <b>NULL</b> prefix.
1.54 + *
1.55 + * - Elements are never associated with namespace undeclarations (<b>xmlns=""</b>), instead, such elements have no
1.56 + * namespace declaration referred to.
1.57 + *
1.58 + * - Attributes do not have <i>default</i> namespace. Even if it is effective at element scope,
1.59 + * default namespace declaration is not applied to element's attributes (according to the XML specification)
1.60 + *
1.61 + * - Namespace of a node (element or attribute) is <b>undefined</b> if no namespace declaration is
1.62 + * associated with it.
1.63 + *
1.64 + * - Node with <i>undefined</i> namespace is serialized as having no prefix. In general,
1.65 + * DOM API handles the complexity of namespace declaration handling and creates neccessary
1.66 + * namespace declarations and undeclares default namespace. However, some node-creation methods (e.g. TXmlEngElement::AddNewElementL())
1.67 + * do not ensure that created node with undefined namespace (thus, without a prefix) will
1.68 + * actually treated after serialization as having some <i>default</i> namespace
1.69 + *
1.70 + * @note
1.71 + * Namespace nodes that are result of XPath expression have following restrictions:
1.72 + * - they cannot be used as namespace definitions, because they are not part of
1.73 + * the DOM tree, but copies of existing namespace definitions.
1.74 + * - namespace prefix is not available because it is not mandated by DOM Level 3 XPath module API,
1.75 + * so in returned copies of DOM tree, namespaces prefix strings are not preserved
1.76 + * and Prefix() returns NULL.
1.77 + *
1.78 + * @lib XmlEngineDOM.lib
1.79 + * @since S60 v3.1
1.80 + */
1.81 +class TXmlEngNamespace: public TXmlEngNode
1.82 +{
1.83 + public:
1.84 + /**
1.85 + * Default constructor
1.86 + *
1.87 + * @since S60 v3.1
1.88 + */
1.89 + inline TXmlEngNamespace();
1.90 +
1.91 + /**
1.92 + /**
1.93 + * Get namespace URI
1.94 + *
1.95 + * @since S60 v3.1
1.96 + * @return Namespace URI string
1.97 + * @note "" is never returned - it is replaced with NULL
1.98 + *
1.99 + * For TXmlEngNamespace(NULL) or namespace undeclaration (xmlns=""), which are
1.100 + * treatet as <i>undefined namespace</i> returns NULL,
1.101 + * otherwise result is not a NULL string and not a "" (empty string).
1.102 + */
1.103 + IMPORT_C TPtrC8 Uri() const;
1.104 +
1.105 + /**
1.106 + * Get namespace prefix.
1.107 + *
1.108 + * @since S60 v3.1
1.109 + * @return prefix that is bound in the namespace declaration
1.110 + * or NULL string for default namespace or if no binding exist
1.111 + */
1.112 + IMPORT_C TPtrC8 Prefix() const;
1.113 +
1.114 + /**
1.115 + * Check if namespace is default.
1.116 + *
1.117 + * @since S60 v3.1
1.118 + * @return Whether it is a definition of default namespace
1.119 + * TRUE -- is a default namespace (no prefix)
1.120 + * FALSE -- not a default namespace (bound to prefix) or empty TXmlEngNamespace(NULL) instance
1.121 + */
1.122 + IMPORT_C TBool IsDefault() const;
1.123 +
1.124 + /**
1.125 + * Check if namespace is undefined
1.126 + *
1.127 + * @since S60 v3.1
1.128 + * @return Whether the namespace is undefined
1.129 + *
1.130 + * A node's namespace is undefined if no namespace declaration associated with it.
1.131 + * @note Same as TXmlEngNode::IsNull()
1.132 + */
1.133 + IMPORT_C TBool IsUndefined() const;
1.134 +
1.135 +protected:
1.136 + /**
1.137 + * Workaround to avoid misuse of TXmlEngNode::NamespaceUri() method, which should not be
1.138 + * applied to TXmlEngNamespace node. Since the name of the inherited method from TXmlEngNode
1.139 + * is too similar to TXmlEngNamespace::Uri(), NamespaceUri() is disabled for direct
1.140 + * use.
1.141 + * If NamespaceUri() is called on the TXmlEngNamespace object that is downcasted to TXmlEngNode, then
1.142 + * NamespaceUri()'s result equals to result of Uri() method.
1.143 + *
1.144 + * @since S60 v3.1
1.145 + * @return NULL
1.146 + */
1.147 + inline TPtrC8 NamespaceUri();
1.148 +
1.149 +protected:
1.150 + /**
1.151 + * Constructor
1.152 + *
1.153 + * @since S60 v3.1
1.154 + * @param aPtr Namespace pointer
1.155 + */
1.156 + inline TXmlEngNamespace(void* aPtr);
1.157 +
1.158 + friend class TXmlEngElement;
1.159 + friend class TXmlEngNode;
1.160 +};
1.161 +
1.162 +#include "xmlengnamespace.inl"
1.163 +
1.164 +#endif /* XMLENGINE_NAMESPACE_H_INCLUDED */
1.165 +