MRutten
2 years agoOccasional Contributor
Extracting value from XML element with multiple attributes using Groovy
Hello,
I want to extract the base64 encoded value of the XML element below to decode it and store the file locally.
.........
<ZKN:inhoud StUF:bestandsnaam="mail1684835925155.txt" xmime:contentType="text/plain" xmlns:xmime="http://www.w3.org/2005/05/xmlmime">VmFuOm5vcmVwbHkua.........gT2lyc2Nob3QK</ZKN:inhoud>
.........
I am extracting the element using
def docInhoudGroup = context.expand( '${geefZaakdocumentLezen_Lv01 - dundee - 623#Response#declare namespace ZKN=\'http://www.egem.nl/StUF/sector/zkn/0310\'; //ZKN:edcLa01[1]/ZKN:antwoord[1]/ZKN:object[1]/ZKN:inhoud[1]}' )
This results in object docInhoudGroup:
And I am not successful in assigning the base64 encoded value to a new variable for further processing.
I am able to extract the value of subelement 'StUF:bestandsnaam' of 'ZKN:inhoud' but as stated not the value of element 'ZKN:inhoud':
def docFileName = context.expand( '${geefZaakdocumentLezen_Lv01 - dundee - 623#Response#declare namespace StUF=\'http://www.egem.nl/StUF/StUF0301\'; declare namespace ZKN=\'http://www.egem.nl/StUF/sector/zkn/0310\'; //ZKN:edcLa01[1]/ZKN:antwoord[1]/ZKN:object[1]/ZKN:inhoud[1]/@StUF:bestandsnaam}' )
Hope someone can give me a hint.
Kind regards