XML Quirks

Written by Joseph Ottinger

One user wrote to the forums, saying that his url in data-sources.xml was being reported as invalid, and identified it as the use of the "&" character in the url. For example, a JDBC url such as "jdbc:sybase:Tds:SYBSVRNAME:5000/DBNAME?Hostname=FOO" would work, and similarly, a JDBC url such as "jdbc:sybase:Tds:SYBSVRNAME:5000/DBNAME?APPLICATIONNAME=BAR" would work as well, but "jdbc:sybase:Tds:SYBSVRNAME:5000/DBNAME?Hostname=FOO&APPLICATIONNAME=BAR" would fail.

The problem here is that "&" has special meaning in XML, as do "<" and ">". If you need to use them in an XML configuration, you should replace them with their XML equivalents: "&" needs to be specified as "&amp;", "<" needs to be "&lt;" and ">" needs to be "&gt;". 

The corrected url here would be  "jdbc:sybase:Tds:SYBSVRNAME:5000/DBNAME?Hostname=FOO&amp;APPLICATIONNAME=BAR".

(You can also use CDATA, but that won't work in an XML attribute.) 

Copyright © 2007 IronFlare AB