Skip to content

Instantly share code, notes, and snippets.

@loadster
Last active October 14, 2015 15:37
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 loadster/dea010091b6d6b6e4b48 to your computer and use it in GitHub Desktop.
Save loadster/dea010091b6d6b6e4b48 to your computer and use it in GitHub Desktop.
Parse and capture an attribute from an XML document
// <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