Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to read XML file in groovy?

I am trying to read XML file in groovy with below lines of code

def xml=new XmlSlurper().parse("C:\2011XmlLog20110524_0623")  
xml.Document.BillID.each{   
println it}

I am getting file not found error though i have the file in my C drive..is there any syntax mistake there?..

With advance thanks,

Laxmi

like image 386
laxmi Avatar asked Sep 17 '25 13:09

laxmi


1 Answers

Use any of:

  • "C:/2011XmlLog20110524_0623"
  • "C:\\2011XmlLog20110524_0623"

Backslash is an escape character.

like image 70
Tomasz Nurkiewicz Avatar answered Sep 20 '25 12:09

Tomasz Nurkiewicz