Forum Discussion

kevman's avatar
kevman
Occasional Contributor
12 years ago

[Resolved] XML node from Response of JDBC has dot(.)

Hi,

I have a JDBC request using join query and it returns XML node containing dot(.) rather than having alias name.
How can I get the value using XML slurper?
My query is like this;

select a.name as name, b.street as street from person a, address b

Then the result back from JDBC looks like this;

<resultset>
<a.name>xxx</a.name>
<b.street>yyy</b.street>
</resultset>


, which I expected like this;


<resultset>
<name>xxx</name>
<street>yyy</street>
</resultset>


So I cannot get values for each node with groovy script like following. Is there something I can use like quotation like ..Row[0]."a.name"?


def response = context.expand(...#responseAsxml})

def result = new XmlSlurper.parseText(response)

log.info result.ResultSet.Row[0].a.name
log.info result.ResultSet.Row[0].b.street

3 Replies

  • SmartBear_Suppo's avatar
    SmartBear_Suppo
    SmartBear Alumni (Retired)
    Hi,

    Just posting here to let you know that your issue has been acknowledged. We're a bit swamped right now, but we'll get back to you as soon as possible.

    --
    Regards,

    Arian
    SmartBear Sweden
  • kevman's avatar
    kevman
    Occasional Contributor
    Hi,

    I think I found how to parse with quotation like following;

    log.info result.ResultSet.Row[0]."a.name".text()


    But still wonder why JDBC doesn't return the result with alias column name.
  • SmartBear_Suppo's avatar
    SmartBear_Suppo
    SmartBear Alumni (Retired)
    Good to hear you found a workaround. This behavior seems odd - I'll make sure to create a ticket in our internal issue tracking system for further investigation. Thanks for the heads up!

    Regards,

    Arian
    SmartBear Sweden