Forum Discussion

RJanecek's avatar
RJanecek
Regular Contributor
14 years ago

xml holder

hi, I have this xml:
def response = "<note><to>Tove</to><from>Jani</from><heading>Reminder</heading><body>Don't forget me this weekend!</body></note>"

and I wanna map of values
def holderResponse = groovyUtils.getXmlHolder( response )
println holderResponse.values()
why this return null ??
thx for help

4 Replies

  • RJanecek's avatar
    RJanecek
    Regular Contributor
    or there is another way how to get map of values from xml ?
  • Hi!

    In soapUI Groovy Scripts, you should never use println("some text"), but rather log.info("some text"). Replacing println with log.info makes the script work for me.

    Hope this helps!

    Henrik
    SmartBear Software
  • Hi,

    hehe.. good point.. I'm not sure why we even put this method there initially - maybe as you suggest to just get all text values in the contained text document!?

    Anyhow for now you could try a call to

    for( value in holder.getNodeValues( "//text()" ))
    log.info value

    Does that work?

    regards,

    /Ole
    SmartBear Software