kevman
12 years agoOccasional Contributor
[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;
Then the result back from JDBC looks like this;
, which I expected like this;
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"?
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