Forum Discussion

Koopman_Interna's avatar
Koopman_Interna
Contributor
14 years ago

To entitize or not to entitize JDBC result

I am comparing the contents of 2 tables by looping through one of them (JDBC datasource) and fetching the corresponding record from the other table by key with a JDBC fetch request.

The JDBC fetch results seems to entitize the result when a & is in the string. For example:

<Results>
<ResultSet fetchSize="0">
<Row rowNumber="1">
<SUPPLIER_ID>2335</SUPPLIER_ID>
<NAME>Example Arts &amp; Crafts Imp. &amp; Exp Corp.</NAME>
</Row>
</ResultSet>
</Results>


So to get the test working, I also set Entitize to on for the JDBC Data Source.

But when an apostrophe is part of the string, the JDBC request does not entitize it:

<Results>
<ResultSet fetchSize="0">
<Row rowNumber="1">
<SUPPLIER_ID>2386</SUPPLIER_ID>
<NAME>Z's Trading Company Limited </NAME>
</Row>
</ResultSet>
</Results>


But the JDBC datasource is entitizing as follows:
Z&apos;s Trading Company Limited

Questions:
- Is this a bug in entitizing?
- Is there a way to not entitize the result of a JDBC request?
  • Hi,

    thanks for this; unfortunately there is no easy work around. Exactly how are you performing the compare? Via a script? or an assertion?

    regards!

    /Ole
    eviware.com
  • Hi, sorry for the late response. The problem appeared to me when using an XPath assertion, but today I had the same using a script.

    I have found a workaround today by using:
    nodeValue = nodeValue.replaceAll(java.util.regex.Pattern.compile("'"), "&apos;")


    Hope this helps someone.