Skip to content

Instantly share code, notes, and snippets.

@jresendiz27
Last active August 29, 2015 14:08
Show Gist options
  • Save jresendiz27/5d69052dbbbff0e0df86 to your computer and use it in GitHub Desktop.
Save jresendiz27/5d69052dbbbff0e0df86 to your computer and use it in GitHub Desktop.
def xmlContent = new File("your-sat-xml-file.xml").getText()
def xml = new XmlSlurper().parseText(xmlContent).declareNamespace(
cfdi:"http://www.sat.gob.mx/cfd/3",
xsi:"http://www.w3.org/2001/XMLSchema-instance")}}
//Getting xml information.
//this will work for other xml files with other namespaces if needed
//@ for reading xml attributes, if there's no attribute just . operator will be fine
println xml.'cfdi:Receptor'.@rfc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment