System.Xml.DocumentXPathNavigator.MoveToAttribute C# (CSharp) Méthode

MoveToAttribute() public méthode

public MoveToAttribute ( string localName, string namespaceURI ) : bool
localName string
namespaceURI string
Résultat bool
        public override bool MoveToAttribute(string localName, string namespaceURI) {
            XmlElement element = source as XmlElement;
            if (element != null
                && element.HasAttributes) { 
                XmlAttributeCollection attributes = element.Attributes;
                for (int i = 0; i < attributes.Count; i++) {
                    XmlAttribute attribute = attributes[i];
                    if (attribute.LocalName == localName
                        && attribute.NamespaceURI == namespaceURI) {
                        if (!attribute.IsNamespace) {
                            source = attribute;
                            attributeIndex = i;
                            return true;
                        }
                        else {
                            return false;
                        }
                    }
                }
            }
            return false;
        }