Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » XML Schema Definition (XSD) » getValue getEffectiveValue
getValue getEffectiveValue [message #59526] Mon, 25 April 2005 10:23 Go to next message
Eclipse User
Originally posted by: aaudevart.genigraph.fr

Hello,

I would like to extract the integer value of this restriction :

<xs:element name="NombreExemplaires">
<xs:simpleType>
<xs:restriction base="xs:integer">
<xs:minInclusive value="1"/>
</xs:restriction>
</xs:simpleType>
</xs:element>

I don't know what methods used.
If I used getValue(), that returns a BigInteger and I don't know how to
cast it in integer.
XSDMinInclusiveFacet aMininclusive =
aSimpleType.getMinInclusiveFacet();
BigInteger value = (BigInteger) aMininclusive.getValue();
int minValue = value.intValue(); // that don't work!

If I used getEffectiveValue(), that returns a Elist.

May be they are another way to do that?

Thanks for your help !
Re: getValue getEffectiveValue [message #59550 is a reply to message #59526] Mon, 25 April 2005 11:18 Go to previous messageGo to next message
Eclipse User
Originally posted by: merks.ca.ibm.com

This is a multi-part message in MIME format.
--------------010400060608080305030404
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit

Alexia,

If intValue doesn't return the right value, which I find hard to
believe, then you have a problem with your JDK. Perhaps you are just
assuming that the value will always be a BigInteger when it's only
BigInteger in this particular case because the type is xsd:integer; if
the type were xsd:float, you'd get a Float value...

I'm not sure about your comment about getEffectiveValue returning a
list; for an XSDMinInclusiveFacetImpl, that method is implemented like this:

public Object getEffectiveValue()
{
return getValue();
}

It should always return the same value as getValue...


alexia wrote:

> Hello,
>
> I would like to extract the integer value of this restriction :
> <xs:element name="NombreExemplaires">
> <xs:simpleType>
> <xs:restriction base="xs:integer">
> <xs:minInclusive value="1"/>
> </xs:restriction>
> </xs:simpleType>
> </xs:element>
>
> I don't know what methods used.
> If I used getValue(), that returns a BigInteger and I don't know how
> to cast it in integer.
> XSDMinInclusiveFacet aMininclusive =
> aSimpleType.getMinInclusiveFacet();
> BigInteger value = (BigInteger) aMininclusive.getValue();
> int minValue = value.intValue(); // that don't work!
>
> If I used getEffectiveValue(), that returns a Elist.
>
> May be they are another way to do that?
>
> Thanks for your help !
>


--------------010400060608080305030404
Content-Type: text/html; charset=ISO-8859-15
Content-Transfer-Encoding: 8bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-15"
http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
Alexia,<br>
<br>
If intValue doesn't return the right value, which I find hard to
believe, then you have a problem with your JDK.
Re: getValue getEffectiveValue [message #59574 is a reply to message #59550] Mon, 25 April 2005 11:58 Go to previous message
Eclipse User
Originally posted by: aaudevart.genigraph.fr

Hi,

I find a solution. In effect, getValue() and getEffectiveValue() return
the same value which is here a BigDecimal Type. I've just cast the Object
in the BigDecimal type and apply the function intValue which convert a
BigDecimal in int.

int minValue = ((BigDecimal) aMininclusive.getValue()).intValue();

Thanks for your help
Re: getValue getEffectiveValue [message #594909 is a reply to message #59526] Mon, 25 April 2005 11:18 Go to previous message
Ed Merks is currently offline Ed Merks
Messages: 26126
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------010400060608080305030404
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit

Alexia,

If intValue doesn't return the right value, which I find hard to
believe, then you have a problem with your JDK. Perhaps you are just
assuming that the value will always be a BigInteger when it's only
BigInteger in this particular case because the type is xsd:integer; if
the type were xsd:float, you'd get a Float value...

I'm not sure about your comment about getEffectiveValue returning a
list; for an XSDMinInclusiveFacetImpl, that method is implemented like this:

public Object getEffectiveValue()
{
return getValue();
}

It should always return the same value as getValue...


alexia wrote:

> Hello,
>
> I would like to extract the integer value of this restriction :
> <xs:element name="NombreExemplaires">
> <xs:simpleType>
> <xs:restriction base="xs:integer">
> <xs:minInclusive value="1"/>
> </xs:restriction>
> </xs:simpleType>
> </xs:element>
>
> I don't know what methods used.
> If I used getValue(), that returns a BigInteger and I don't know how
> to cast it in integer.
> XSDMinInclusiveFacet aMininclusive =
> aSimpleType.getMinInclusiveFacet();
> BigInteger value = (BigInteger) aMininclusive.getValue();
> int minValue = value.intValue(); // that don't work!
>
> If I used getEffectiveValue(), that returns a Elist.
>
> May be they are another way to do that?
>
> Thanks for your help !
>


--------------010400060608080305030404
Content-Type: text/html; charset=ISO-8859-15
Content-Transfer-Encoding: 8bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-15"
http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
Alexia,<br>
<br>
If intValue doesn't return the right value, which I find hard to
believe, then you have a problem with your JDK.
Re: getValue getEffectiveValue [message #594921 is a reply to message #59550] Mon, 25 April 2005 11:58 Go to previous message
Eclipse User
Originally posted by: aaudevart.genigraph.fr

Hi,

I find a solution. In effect, getValue() and getEffectiveValue() return
the same value which is here a BigDecimal Type. I've just cast the Object
in the BigDecimal type and apply the function intValue which convert a
BigDecimal in int.

int minValue = ((BigDecimal) aMininclusive.getValue()).intValue();

Thanks for your help
Previous Topic:getValue getEffectiveValue
Next Topic:getContent
Goto Forum:
  


Current Time: Mon Oct 20 22:49:22 GMT 2014

Powered by FUDForum. Page generated in 0.02446 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software