Below is a def statement from one of my Groovy Scripts:
def MESSAGE4 = holder.getNodeValue("/S:Envelope/S:Body/ns2:getSubscriptionInformationWithInterpretedContentResponse/resultData/interpretedFilesList/interpretedFile/ns2:defaultInterpretedTransparentFileContent/hexaContent")
How do I break this line into two to improve readability?
Go to Solution.
If 'hexaContent' is unique node in the xml, you can directly use ''//hexaContent" instead of absolute path (which you used)
View solution in original post
Yes, it works. Thanks, nmrao.
The new def statement:
def MESSAGE4 = holder.getNodeValue("/S:Envelope/S:Body/ns2:getSubscriptionInformationWithInterpretedContentResponse/resultData//hexaContent")
Just for my learning, what if hexaContent is not an unique field under resultData? Is there a way to split the line into 2 lines?
Have to find a unique way to find xpath to get the get the data.To get more info on xpath, referhttps://www.tutorialspoint.com/xpath/index.htm
What is the issue if it is in a line?
One can use multi-line string in groovy, please see the example.