Iterating an XML node list
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public boolean elementExists(str elementName, str attributeName, str attributeValue) | |
{ | |
XmlNodeList nodes = xmlDocument.GetElementsByTagName(elementName); | |
XMLNodeListIterator iterator = new XMLNodeListIterator(nodes); | |
while (iterator.moreValues()) | |
{ | |
XmlElement e = iterator.value(); | |
str val = e.getAttribute(attributeName); | |
if (val == attributeValue) | |
{ | |
return true; | |
} | |
iterator.nextValue(); | |
} | |
return false; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment