Hi,
On Tue, Jul 28, 2009 at 19:54, Mark Waschkowski<[email protected]> wrote:
> Hi Alex,
> Thanks for the info, I am also running into this issue. If I am doing an
> xpath query on a double property, does that mean I have to ensure that a
> '.0' is on the end?
correct, that will indicate to the query handler that it is of type double
> Or is there a way to 'cast' (or otherwise
> suggest) the value in the xpath?
>
> ie. something similar to:
> nodes/*...@gba> xs:double(10000)]
that's currently not supported.
> I would rather cast the double rather than appending '.0' on the end of my
> query, as some of the queries we run are generated based on user input which
> may or may not include the '.0'. My code will be more understandable with a
> cast rather than a check for a '.' and appending of a '.0' if one doesn't
> exist...
it adds some lines of code but the following should do the trick:
double value = ....
NumberFormat nf = NumberFormat.getNumberInstance();
nf.setMinimumFractionDigits(1);
nf.setMaximumFractionDigits(Integer.MAX_VALUE);
String v = nf.format(value);
regards
marcel