Created
December 21, 2011 17:17
-
-
Save russellkt/1506835 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
def xmlFilePattern = ~/.*\.XML/ | |
def iterator = 0 | |
def itemAttributes, contentAttributes | |
def checkAttributes = [] | |
def checks = [] | |
new File('/Volumes/mac3/cleared_checks/').eachFileMatch(xmlFilePattern){ | |
def xmlFile = new XmlParser().parse(it) | |
def items = xmlFile.Item | |
if(itemAttributes == null){ | |
itemAttributes = items.ItemData[0].attributes().keySet() | |
contentAttributes = items.Content[0].attributes().keySet() | |
checkAttributes = new String[itemAttributes.size() + contentAttributes.size()] | |
itemAttributes.eachWithIndex{ att, index -> checkAttributes[index] = att } | |
contentAttributes.eachWithIndex{ att, index -> checkAttributes[index + itemAttributes.size()] = att } | |
} | |
items.eachWithIndex{ item, index -> | |
def check = [] | |
itemValues = item.ItemData[0].attributes().collect{ k,v -> v} | |
contentValues = item.Content[0].attributes().collect{ k,v -> v} | |
check = itemValues + contentValues | |
checks << check | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment