Skip to content

Instantly share code, notes, and snippets.

@Fabszn
Last active December 21, 2015 04:58
Show Gist options
  • Save Fabszn/6252955 to your computer and use it in GitHub Desktop.
Save Fabszn/6252955 to your computer and use it in GitHub Desktop.
L'idée du bout de code est de parser un ensemble de fichier XML. Pour chaque fichier on récupère l'ensemble des balises 'value'. Pour chaque balise value on regarde si l'attribut 'name' est égale à un chaine, dans l'exemple : returnType. Si on trouve une égalité alors on affiche le nom du fichier avec le contenu de la balise sinon on ne fait rien.
object Parser {
def main(args: Array[String]) {
new File(/*[DIRECTORY_PATH"*/).listFiles() foreach (f => {
val xml = XML.loadFile(f.getPath)
(xml \\ "value") foreach (v =>
(v \ "@name").text match {
case "returnType" => println( f.getName.split('.')(0) + " , " + v.text)
case _ =>
}
)
})
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment