コード例 #1
0
        public override bool Read()
        {
            var read = base.Read();

            switch (base.NodeType)
            {
            case XmlNodeType.Element:
                _nsManager.PushScope();
                for (var go = BaseReader.MoveToFirstAttribute(); go; go = BaseReader.MoveToNextAttribute())
                {
                    if (BaseReader.NamespaceURI != _xmlNsNamespace)
                    {
                        continue;
                    }
                    var prefix = GetNamespacePrefix();

                    // Only push if it's not already defined.
                    if (_nsManager.LookupNamespace(prefix) == null)
                    {
                        _nsManager.AddNamespace(prefix, Value);
                    }
                }
                if (BaseReader.HasAttributes)
                {
                    BaseReader.MoveToElement();
                }
                break;

            case XmlNodeType.EndElement:
                _nsManager.PopScope();
                break;
            }

            return(read);
        }
コード例 #2
0
ファイル: xpathreader.cs プロジェクト: Infarh/MathCore
        /// <devdoc>
        ///     <para>
        ///         Moves to the first attribute.
        ///     </para>
        /// </devdoc>
        public override bool MoveToFirstAttribute()
        {
            var result = BaseReader.MoveToFirstAttribute();

            if (result)
            {
                _XPathCollection.Advance(this);
            }
            return(result);
        }
コード例 #3
0
        /// <summary>
        /// See <see cref="XmlReader.Read"/>.
        /// </summary>
        public override bool Read()
        {
            bool read = base.Read();

            if (NodeType == XmlNodeType.Element)
            {
                nsManager.PushScope();
                for (bool go = BaseReader.MoveToFirstAttribute(); go; go = BaseReader.MoveToNextAttribute())
                {
                    if (BaseReader.NamespaceURI != xmlNsNamespace)
                    {
                        continue;
                    }

                    string prefix = GetNamespacePrefix();

                    // Only push if it's not already defined.
                    if (nsManager.LookupNamespace(prefix) == null)
                    {
                        nsManager.AddNamespace(prefix, Value);
                    }
                }

                // If it had attributes, we surely moved through all of them searching for namespaces
                if (BaseReader.HasAttributes)
                {
                    BaseReader.MoveToElement();
                }
            }
            else if (NodeType == XmlNodeType.EndElement)
            {
                nsManager.PopScope();
            }

            return(read);
        }
コード例 #4
0
 /// <inheritdoc/>
 public override bool MoveToFirstAttribute() => BaseReader.MoveToFirstAttribute();
コード例 #5
0
 /// <inheritdoc/>
 public override bool MoveToFirstAttribute()
 {
     return(BaseReader.MoveToFirstAttribute());
 }