How to find whether XML response tag has attribute in it using XMl slurper
Hi,
I need to apply a check where in i need to check if particular xml node tag has attribute in it or not using XMl slurper
Can any one help me with the method for the same ?
Using below code i can find out the attribute value but need help in finding the method if there is any to check whether attribute is present for the particular xml tag or not.
String str='''<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ICOMS KEY="test:localhost-27d4e55f-13e6-4363-a3b7-310bb8eea75f" USERID="ASSS" PASSWORD="SSSSS" ENVIRONMENT="QA">
<ABC00053 SITEID="1">
<INL02072 HOUSNMBR="3333" HOUSCMNTSEQ1="7" HOUSCMNTLINE="ABC"/>
<SITEID>132132132</SITEID>
</ABC00053>
</ICOMS>'''
def parsed = new XmlParser().parseText( str )
log.info parsed.'**'*.attribute( 'HOUSNMBR' ).find()
Thanks,
Himanshu