473,390 Members | 1,300 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,390 software developers and data experts.

Standard for decimal numbers in XML

Hello,

I am wondering, what is the standard for including decimal numbers in
XML code? What determines what is the decimal delimiter and what can
be the grouping symbol?

I have just realized that Microsoft's parser decides that based on the
regional settings, invalidating most numbers sent in XML
internationally. Is this a bug or is it correct behaviour, based on
infsufficient information?

Thank you for your help. :)

Mar 7 '07 #1
3 12186
DustWolf wrote:
I am wondering, what is the standard for including decimal numbers in
XML code? What determines what is the decimal delimiter and what can
be the grouping symbol?
XML in general does not know a number data type. You will have to look
at some XML applications. XSLT (1.0) for instance uses the number data
type from XPath 1.0 with '.' being the decimal delimiter and no grouping
symbol. That holds for all input to be parsed, for output XSLT has an
instruction xsl:decimat-format and a function format-number
<http://www.w3.org/TR/xslt#format-number>
that allows you to set various things like decimal separator, grouping
separator.

I have just realized that Microsoft's parser decides that based on the
regional settings, invalidating most numbers sent in XML
internationally. Is this a bug or is it correct behaviour, based on
infsufficient information?
Microsoft has several XML tools. MSXML 3 and later for instance have
XSLT 1.0 support and I am pretty sure they follow the specification as
explained above and do not parse input string to numbers based on
regional settings.
MSXML 4 and later also have XSD schema support and if you do schema
validation with MSXML then I am again pretty sure that '.' is the
decimal separator and regional settings are not used, the number
format(s) are defined by the W3C XML schema specification.
The Microsoft .NET framework also has XML support with XSLT 1.0, with
XSD schema validation.
Then there is XML support in SQL Server 2005.
Tell us more details on which Microsoft parser you are using for which
task, your description is too general to judge what is going on.
--

Martin Honnen
http://JavaScript.FAQTs.com/
Mar 7 '07 #2
On 7 Mar, 17:23, "DustWolf" <jure....@bia.siwrote:
Hello,

I am wondering, what is the standard for including decimal numbers in
XML code? What determines what is the decimal delimiter and what can
be the grouping symbol?

I have just realized that Microsoft's parser decides that based on the
regional settings, invalidating most numbers sent in XML
internationally. Is this a bug or is it correct behaviour, based on
infsufficient information?

Thank you for your help. :)
XML Schema Part 2 defines the format of a decimal type to have a '.'
separator, and no groupings character. You can see the details at:

http://www.w3.org/TR/xmlschema-2/#decimal

It may be as good a definition as any to use.

FWIW - A while back I heard customers say that they have had problems
interoperating with .NET applications running on German versions of
Windows, and so the problem you raise may be a common one.

HTH,

Pete.
--
=============================================
Pete Cordell
Tech-Know-Ware Ltd
for XML to C++ data binding visit
http://www.tech-know-ware.com/lmx/
http://www.codalogic.com/lmx/
=============================================

Mar 7 '07 #3
us****@tech-know-ware.com wrote:
http://www.w3.org/TR/xmlschema-2/#decimal
It may be as good a definition as any to use.
That would be my recommendation. Just record the information, using this
representation. (Or, if it really is a floating-point value, possibly,
one of the other common standard-for-computers representations such as
1.2E3)

If you want to display it differently for humans, deal with that when
you're rendering the information for display to humans.

--
() ASCII Ribbon Campaign | Joe Kesselman
/\ Stamp out HTML e-mail! | System architexture and kinetic poetry
Mar 8 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

21
by: Batista, Facundo | last post by:
Here I send it. Suggestions and all kinds of recomendations are more than welcomed. If it all goes ok, it'll be a PEP when I finish writing/modifying the code. Thank you. .. Facundo
17
by: John Bentley | last post by:
John Bentley: INTRO The phrase "decimal number" within a programming context is ambiguous. It could refer to the decimal datatype or the related but separate concept of a generic decimal number....
2
by: Steve Summit | last post by:
-----BEGIN PGP SIGNED MESSAGE----- It's often explained that the reason for some of the imprecision in C's definition is so that C can be implemented on different kinds of machines -- say, those...
10
by: Paul Sullivan | last post by:
decimal d; d = 1.1M OR d= (decimal) 1.1 Discussioon
11
by: Pieter | last post by:
Hi, I'm having some troubles with my numeric-types in my VB.NET 2005 application, together with a SQL Server 2000. - I first used Single in my application, and Decimal in my database. But a...
1
by: Twanne | last post by:
Hi, I've got some code in VBA where I calculate some numbers. Now some of them are large decimal numbers like -6,3216324E03. So in scientific notations. Now I need to add them to a table with an...
7
by: JohnC | last post by:
Hello people, I thought I was fairly proficient in websearching, but I haven't found a standard on how to encode numerical values in an XML file in a standard way. XML docs do specify character...
10
by: Jason | last post by:
I'm making a program that will convert decimal inputs (in this case, in inches) and output a fractional answer. At the moment, I'm only able to output the fractional answer in three parts: A whole...
0
Frinavale
by: Frinavale | last post by:
Convert a Hex number into a decimal number and a decimal number to Hex number This is a very simple script that converts decimal numbers into hex values and hex values into decimal numbers. The...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.