Created
January 25, 2019 16:03
-
-
Save noakesey/8e0ef47778ac2247410618117d2171c8 to your computer and use it in GitHub Desktop.
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