Skip to content

Instantly share code, notes, and snippets.

@noakesey
Created January 25, 2019 16:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save noakesey/8e0ef47778ac2247410618117d2171c8 to your computer and use it in GitHub Desktop.
Save noakesey/8e0ef47778ac2247410618117d2171c8 to your computer and use it in GitHub Desktop.
Iterating an XML node list
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