Home > Default > WebRowSetImpl and & in xml output

WebRowSetImpl and & in xml output

October 11Hits:0
Advertisement
When a string column value in a table has a '&' (ampersant) sign in it, WebRowSetImpl.writeXml(OutputStream) does not escape that character in the resulting xml. A table with value Eve & Adam results in <columnValue>Eve & Adam</columnValue> instead of <columnValue>Eve & Adam</columnValue>This makes WebRowSetImpl in rowset.jar pretty much useless. I tried to file a bug report but got a 'Server Error' when I tried to log in...

Answers

The previous message was probably not clear enough, since there have not been any replies. I'll try to be more verbose
- create a database table FOO in your favorite database, with one column named BAR
- insert a few records into FOO, each containing 'strange' signs, like the ampersant, e-umlaut, o-umlaut, c-cedille and lessThan and greaterThan signs (as found around xml and html tags)
- ResultSet rs = stmt.executeQuery("SELECT * FROM FOO");
- WebRowSet wrs = new com.sun.rowset.WebRowSetImpl();
- wrs.populate(rs);
- use wrs.writeXml(OutputStream) to write to a file
- look at and try to parse the resulting XML file
My problems with the generated XML file:
1) there is no encoding specified, so the e-umlaut and similar do not get passed, since it is not valid UTF8
2) the lessThan and greaterThan signs are not escaped
Both of these cause the parser to abort.
Since this is the reference implementation I am sure a lot of ppl have looked at it, and I must have been doing something wrong. Any ideas?

Read other 8 answers

Tags:

Related Articles

Copyright (C) 2019 wisumpire.com, All Rights Reserved. webmaster#wisumpire.com 14 q. 2.109 s.