I am trying to decode an XML document that has lines that are base64 encoded.
For this I first tried to read the XML document with XML Slurper and then convert it line by line and write all lines into a string. Unfortunately I didn't manage to iterate over the single elements.
Because the base64 lines always have a "==" at the end, I tried after I had all lines one after the other in a big string, to read the elements in a List. however, I get then again only a big string out and can not edit the elements again individually.
The document looks like this:
<root>
<item>
<LINE>base64encoded==</LINE>
</item>
<item>
<LINE>base64encoded==</LINE>
</item>
<item>
<LINE>base64encoded==</LINE>
</item>
<item>
<LINE>base64encoded==</LINE>
</item>
<item>
<LINE>base64encoded==</LINE>
</item>
</root>
thats my code
def root = new XmlSlurper().parseText(text)
def authorResult = root.item.LINE as String
List<String> items = Arrays.asList(authorResult.split("\\s=="));
and
root.each { thing ->
println "LINE index: ${LINE.@indexNum}"
}
}
But with noi luck, im stuck. Why both of my approaches didnt work? Pleas explain me what im doing wrong