Пример #1
0
        /// <summary>
        /// Moves to the attribute with the specified name.
        /// </summary>
        /// <param name="name">The qualified name of the attribute. </param>
        /// <returns>true if the attribute is found; otherwise, false. If false, the reader's position does not change.</returns>
        /// <remarks>After calling MoveToAttribute, the <see cref="LocalName"/>, <see cref="NamespaceURI"/>, and <see cref="Prefix"/> properties reflects the properties of that attribute.</remarks>
        public override bool MoveToAttribute(string name)
        {
            bool val = false;

            if (_currentNode != null)
            {
                int index = 0;
                for (int n = 0; n < _currentNode.AttributeCount; n++)
                {
                    FIParser.FINode.QNameValue qnameValue = _currentNode.Attributes[n];
                    if (qnameValue.qname.LocalName == name)
                    {
                        _nodeType = XmlNodeType.Attribute;
                        _currentAttributeIndex = index;
                        _currentAttributeValue = null;
                        _attributeValueIndex   = -1;
                        val = true;
                        break;
                    }
                    index++;
                }
            }

            return(val);
        }
Пример #2
0
        /// <summary>
        /// Gets the value of the attribute with the specified name.
        /// </summary>
        /// <param name="name">The qualified name of the attribute.</param>
        /// <returns>The value of the specified attribute. If the attribute is not found, a null reference (Nothing in Visual Basic) is returned.</returns>
        /// <remarks>This method does not move the reader.</remarks>
        public override string GetAttribute(string name)
        {
            // Do not move current node poition

            string val = null;

            if (_currentNode != null)
            {
                for (int n = 0; n < _currentNode.AttributeCount; n++)
                {
                    FIParser.FINode.QNameValue qnameValue = _currentNode.Attributes[n];
                    if (qnameValue.qname.LocalName == name)
                    {
                        val = qnameValue.value;
                        break;
                    }
                }
            }

            // return null if not found
            return(val);
        }