/// <summary> Adds a prefix mapping to the next scope that will be activated.</summary>
        /// <remarks><list type="bullet">
        /// <item>The namespace URI must be a valid URI and must not be
        ///   an empty string. This is not checked.</item>
        /// <item>To undeclare a prefix mapping pass null as <c>uri</c>
        ///   argument.</item>
        /// <item>To declare a mapping for the default namespace, pass null
        ///   as <c>prefix</c> argument.</item>
        /// </list></remarks>
        /// <param name="prefix">Prefix part of namespace mapping.</param>
        /// <param name="uri">URI part of namespace mapping.</param>
        /// <returns>The new <see cref="ActiveMapping"/> instance, or <c>null</c>,
        /// if such a mapping has already been added.</returns>
        public ActiveMapping AddMapping(string prefix, string uri)
        {
            NamespaceMapping nsMapping = nextScope.AddMapping(prefix, uri);

            if (nsMapping == null)
            {
                return(null);
            }
            else
            {
                return(nsMapping.prefix);
            }
        }
Beispiel #2
0
 /* Public Interface */
 /// <summary>Initializes new instance.</summary>
 public XmlNamespaces()
 {
     nextScope = new NamespaceScope(this);
       // the 'xml' prefix is always declared
       nextScope.AddMapping("xml", Constants.XmlUri);
 }
        /* Public Interface */

        /// <summary>Initializes new instance.</summary>
        public XmlNamespaces()
        {
            nextScope = new NamespaceScope(this);
            // the 'xml' prefix is always declared
            nextScope.AddMapping("xml", Constants.XmlUri);
        }