[Geoserver-devel] XML encoding bug

Hi all,

Firstly, I noticed a bug when GML encoding string attributes with XML special characters in them. The characters, such as &, <, and > do not get encoded as XML entities such as & and <

I was also wondering if there is anyway to make a PropertyIsLike filter case insensitive? I realise this is more of a spec issue as opposed to a Geoserver issue, but maybe someone has encountered it before…

Thanks

Sean Geoghegan
Information Exploitation Group
Command and Intelligence Environments Branch
Command and Control Division
Defence Science and Technology Organisation
sean.geoghegan@anonymised.com ph +61 08 82595895

Firstly, I noticed a bug when GML encoding string attributes with XML
special characters in them. The characters, such as &, <, and > do not
get encoded as XML entities such as &amp; and &lt;

Thanks for the catch. I guess I've never had xml special characters in my
data. The fix is in cvs now.

I was also wondering if there is anyway to make a PropertyIsLike filter
case insensitive? I realise this is more of a spec issue as opposed to
a Geoserver issue, but maybe someone has encountered it before...

Yes, it is more of a spec issue, but just playing around a bit with
geotools LikeFilterImpl I was able to get it to be case insensitive.
I've attached the file, the only change is the (?i) added to pattern at
line 183 (yes, it should be inserted into the string buffer, this was just
done really fast). And in the test I did it seemed to work case
insensitive. As for getting the file into your geoserver installation,
the current problem is that geotools has still not released, and I'm still
rolling my own geotools.jar, which you may have a hard time recreating.
So I'd say the thing to do is to compile the new LikeFilterImpl in
geotools, unjar the geotools.jar file in geoserver/lib, copy the
defaultcore/target/classes/org/geotools/filter/LikeFilterImpl.class file
into the appropriate unjarred directory, and then jar it back up (jar cf
META-INF org/). Or I can send just send you a jar with the like filter
modified.

If you're interested in coming up with a better solution in geotools
that'd be great. I'm thinking something like a setCaseInsensitive method
in the LikeFilter interface in geotools, and then geoserver could have a
configuration tag for the user to set if he wants it to be case
insensitive. Hrmmm...that might be a bit annoying to put all the proper
hooks into geotools though. Another possibility could be to add an
attribute to the like filter - caseInsensitive="true", which the geotools
filter parsing could catch and set. So I'd say play with it some and see
what you come up with, talk to geotools and see what they think. I'm not
sure how you'd go about encoding it in postgis, but since the SQLEncoder
doesn't currently support like filters it doesn't really matter. And I'd
also try to contact the OGC filter spec people to get them to add it, as
having the ability to specify case insensitivity definitely seems to make
sense to me. If other people are interested in a case insensitive like
filter let the list know, and we'll help you out.

thanks,

  Chris

Thanks

Sean Geoghegan
Information Exploitation Group
Command and Intelligence Environments Branch
Command and Control Division
Defence Science and Technology Organisation
sean.geoghegan@anonymised.com ph +61 08 82595895

(attachments)

LikeFilterImpl.java (11.9 KB)