users@jaxb.java.net

Spaces in names

From: Dennis Sosnoski <dms_at_sosnoski.com>
Date: Tue, 10 Nov 2009 11:04:03 +1300

JAXB RI's schema model checks for invalid non-whitespace characters in
names, but does not check for leading or trailing whitespace. This means
that if a schema contains names like "book "or " book" they are happily
accepted and converted into annotations, then used at runtime (meaning
the output is generated with the extra whitespace, but they're never
matched on input because the whitespace is discarded by the parser).

Seems to me to be clearly an error. The schema model should check for
whitespace along with other characters not allowed by NCName, and this
should also be checked when processing the annotations.

JAXB is not alone in this handling, by the way. I saw a report by an
Axis2 user that this was happening with Axis2's ADB binding as well as
JAXB, and verified the JAXB issue myself. My own JiBX binding also
allows the spaces at present, though I'll change that for the next release.

  - Dennis

-- 
Dennis M. Sosnoski
XML and Web Services in Java
Training and Consulting
http://www.sosnoski.com - http://www.sosnoski.co.nz
Seattle, WA +1-425-939-0576 - Wellington, NZ +64-4-298-6117