Last active
October 14, 2015 15:37
-
-
Save loadster/dea010091b6d6b6e4b48 to your computer and use it in GitHub Desktop.
Parse and capture an attribute from an XML document
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
// <users> | |
// <user id="1"><fullName>Hank Hill</fullName></user> | |
// <user id="2"><fullName>Peggy Hill</fullName></user> | |
// <user id="3"><fullName>Bobby Hill</fullName></user> | |
// </users> | |
function capture(response) { | |
var users = XML.parse(response.bodyAsString); | |
return users.childrenNamed("user")[2].attr["id"]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment