Hi Martin,
    Thanks for your help. Based on your response, if I have the restriction:

<xsd:restriction base="xsd:decimal">
  <xsd:totalDigits value="13" />
  <xsd:fractionDigits value="3" />
</xsd:restriction>

any number between 10^-12 and 10^13, as you said, *should* work.

But, the code generated by axis, only numbers bigger than 99999999999999.0
is valid.
The generated code is:

java.lang.String totalDigitsDecimal =
org.apache.axis2.databinding.utils.ConverterUtil.convertToStandardDecimalNotation("13").toString();
if (org.apache.axis2.databinding.utils.ConverterUtil.compare(param,
totalDigitsDecimal) > 0){
    this.localI_QUANTITY_type0=param;
}
else {
    throw new java.lang.RuntimeException();
}


If I the parameter param is BigDecimal("100.00") the validation will fail
and I'll receive a RuntimeException.
The method ConverterUtil.compare(param, totalDigitsDecimal) is:

public static double compare(BigDecimal binBigDecimal, String value) {
    return binBigDecimal.doubleValue() - Double.parseDouble(value);
}

binBigDecimal = BigDecimal("100.00") and totalDigitsDecimal = "1.0E+13" and
 the return of compare is -9.9999999999E12 witch is minor than zero.

I guess the correct code of the ConverterUtil.compare(BigDecimal
binBigDecimal, String value) should be:

public static double compare(BigDecimal binBigDecimal, String value) {
    return Double.parseDouble(value) - binBigDecimal.doubleValue();
}

With this change, Double.parseDouble(value) - binBigDecimal.doubleValue(),
instead of, binBigDecimal.doubleValue() - Double.parseDouble(value) any
number between 10^-12 and 10^13 is valid.

My understanding is correct ?

Thanks,


2012/11/13 Martin Gainty <mgai...@hotmail.com>

>
>
> --Forwarded Message Attachment--
> From: mgai...@hotmail.com
> To: java-user@axis.apache.org
> Subject: RE: Restriction totalDigits
> Date: Tue, 13 Nov 2012 12:33:10 -0500
>
>  Buenas Tardes / Boa tarde
>
> the restriction of applicable values is based on the upper and lower
> limits of the xsd:decimal datatype..assuming this is your namespace
> declaration
> *xmlns*:*xsd*="http://www.w3.org/2001/XMLSchema";
> 3.2.3 decimal [Definition:]  *decimal* represents a subset of the real
> numbers, which can be represented by decimal numerals. The ·value 
> space·<http://www.w3.org/TR/xmlschema-2/#dt-value-space>of
> *decimal* is the set of numbers that can be obtained by multiplying an
> integer by a non-positive power of ten, i.e., expressible as *i × 10^-n*where
> *i* and *n* are integers and *n >= 0*. Precision is not reflected in this
> value space; the number 2.0 is not distinct from the number 2.00. The ·
> order-relation· <http://www.w3.org/TR/xmlschema-2/#dt-order-relation> on *
> decimal* is the order relation on real numbers, restricted to this
> subset.
>
>
> *Note: * All ·minimally 
> conforming·<http://www.w3.org/TR/xmlschema-2/#dt-minimally-conforming>processors
> ·must· <http://www.w3.org/TR/xmlschema-2/#dt-must> support decimal
> numbers with a minimum of 18 decimal digits (i.e., with a 
> ·totalDigits·<http://www.w3.org/TR/xmlschema-2/#dt-totalDigits>of 18). 
> However,
> ·minimally 
> conforming·<http://www.w3.org/TR/xmlschema-2/#dt-minimally-conforming>processors
> ·may· <http://www.w3.org/TR/xmlschema-2/#dt-may> set an
> application-defined limit on the maximum number of decimal digits they are
> prepared to support, in which case that application-defined maximum number
> ·must· <http://www.w3.org/TR/xmlschema-2/#dt-must> be clearly documented.
>
> so if  your decimal_number is within range 1*10^-8 >= decimal_number <=
> 1*10^+9
>
> *should* work
>
> but you *can* override the length attribute of decimal type by specifying
> totalDigits
> http://www.w3.org/TR/xmlschema-2/#rf-totalDigits
>
> if you are certain the values of your number will always be positive you
> may want to declare the element as positiveInteger
> http://www.w3.org/TR/xmlschema-2/#positiveInteger
>
> Obrigado!
> Martin Gainty
> ______________________________________________
> Porfavor..no altere ni interrumptir esta communicacion..Gracias
>  Por favor, não alterar ou interromper esta transmissão..Obrigado
>
>
>
> ------------------------------
> From: carlos.eman...@phoebustecnologia.com.br
> Date: Tue, 13 Nov 2012 08:49:47 -0300
> Subject: Restriction totalDigits
> To: java-user@axis.apache.org
>
> Hi to all,
>     I'm having problems with restriction totalDigits to type decimal.
> <xsd:restriction base="xsd:decimal">
>   <xsd:totalDigits value="13" />
>   <xsd:fractionDigits value="3" />
> </xsd:restriction>
>
> By this restriction the minor valid number is 99999999999999.0 because the
> code generate by axis. On totalDigits restriction I understand that is
> valid any number between 0 and 10^13. Am I right? Or this restriction is to
> numbers bigger than 99999999999999.0 ?
>
> Thanks,
>



-- 
------------------------------
[image: Phoebus Tecnologia]
www.phoebus.com.br *Carlos Emanuel M. de Sousa*
Desenvolvedor
Rua do Rócio, 423, Cj 1305, Vila Olímpia
São Paulo, SP, Brasil
CEP: 04552-000
+55 11 2365-9935 (Fone)
+55 11 2365-9938 (Fax)
Avenida Rui Carneiro, 300, Sala 804, Miramar
João Pessoa, PB, Brasil
CEP: 58032-100
+55 83 4009-0800 (Fone)
+55 83 4009-0801 (Fax)
[image: MPS.Br Nível G - CMMI ML nível 2]
*Esta mensagem pode conter informação confidencial e/ou privilegiada, sendo
seu sigilo protegido por lei. Se você não for o destinatário ou a pessoa
autorizada a receber esta mensagem, não pode usar, copiar ou divulgar as
informações nela contidas ou tomar qualquer ação baseada nessas
informações. Se você recebeu esta mensagem por engano, por favor, avise
imediatamente ao remetente, respondendo o e-mail e em seguida apague-a.
Agradecemos sua cooperação.

This message may contain confidential and/or privileged information and its
confidentiality is protected by law. If you are not the addressed or
authorized person to receive this message, you must not use, copy, disclose
or take any action based on it or any information herein. If you have
received this message by mistake, please advise the sender immediately by
replying the e-mail and then deleting it. Thank you for your cooperation.*

Reply via email to