XML Schema WSDL data type deserialization problem

W

WideBoy

Hi,

In an XML schema there is little difference between the data types
'int' and 'integer', however, if you use a tool such as WSDL.exe to
generate proxy classes to handle such schemas you find that
Xsd:int is deserialised as a 32-bit int whereas
Xsd:integer is deserialised as a string.

Which leads me to the conclusion that 'ints' should be used in XML
schemas unless your requirement really demands a humongous number so as
to avoid overheads in dealing with the string-integer representations.

Has any one else experienced this sort of issue? if so are there any
other resolutions to this problem aside from not using 'integer' unless
required.

I look forward to your comments,

Naran
 
J

Joe Kesselman

According to Schema itself,
(http://www.w3.org/TR/2004/REC-xmlschema-2-20041028/#built-in-derived),
long is derived from integer by setting the facets to constrain its
range, and int is derived from long by further constraining it. So, yes,
if you're trying to limit yourself to the 32-bit integer range, using
int is the simplest way to do that.

But the fact that integer is being returned as a string is an artifact
of the tool you're using. Other tools may return it other ways, or may
look at the facets rather than just the type -- and you can set facets
to limit an integer's values; using int is just one convenient/canned
way of doing so. They didn't make a bad choice -- but there are other
choices. (For example, integer might be returned as a "big int" type --
not as efficient if all you want to do is display it, but far more
convenient if you want to actually perform math on it.)

Decide what you're trying to express. Pick the data type that best
expresses it.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,008
Latest member
obedient dusk

Latest Threads

Top