Forum Discussion

fredzhu's avatar
fredzhu
New Contributor
2 years ago

How to get blank when JDBC step return xml empty element like <key/>

GetKey-JDBCRequest read data from DB, normally we get results like

<Results>

<ResultSet fetchSize="128">

<Row rowNumber="1">

<Key>123</Key>

</Row>

</ResultSet>

</Results> 

 

<Key>123</Key> means value:123, then we use  '${GetKey-JDBCRequest#ResponseAsXml#//Results[1]/ResultSet[1]/Row[1]/Key[1]}' for next step

 

But when it returns empty result, it becomes

<Key/>   instead of <Key></Key> so that  value of '${GetKey-JDBCRequest#ResponseAsXml#//Results[1]/ResultSet[1]/Row[1]/Key[1]}' is NOT "" but "</Key>"

That's not the result we want.

 

How to get correct blank/empty result and avoid the wrong one? I don't want to use Groovy to parse the value, is there any simple way to deal with it?

Like change a setting and force to output xml format as <Key></Key>, or a simple function to read out "" instead of "</Key>"

 

Thanks a lot

No RepliesBe the first to reply