java - Can generic XML by parsed as nicely as simple XML in Groovy? -


Given a good, simple XML structure, XmlSlurper () allows me to read values ​​about it very easily Could.

  def xml = " gt; Title> gt; groovy & lt; / title & gt; & lt; / head & gt; Gt; & lt; / html & gt; Def html = new XMLSler (). ParseText (xml) println html.head.title  

Is this normal tree navigation made possible for generic (type-based, etc.) XML. Ideally, in the snippet of code below, I would like to run the values ​​with my name attribute, but instead, I have to search all this:

  Gt ; Xxml & lt; / Str & gt; Gt; & Gt; & Lt; / Lst> & Lt; / Doc & gt; DTP doc = new XMLSler (). Parsext (genxml) printline doc.list.fund {this. @name == "head"}. @name == "title"}  

Is there any way to do this:

  println doc.head.title  <

There are head and title attributes.

There are disturbances and parsers:

You can do this:

  println "$ {doc.lst.str [0]} $ { Doc.lst.str [0]. @ Name} "println doc.lst.str.each {println" $ {it} $ {it .name} "}  

but output to See:

  Groove Title Gro Vy Title java xml keyword groovyjava xml  

Comments

Popular posts from this blog

c++ - Linux and clipboard -

Visual Studio 2005: How to speed up builds when a VSMDI is open? -

booting ubuntu from usb using virtualbox -