Decimal comma/point standard?

Discussion in 'XML' started by JohnC, Jun 5, 2008.

  1. JohnC

    JohnC Guest

    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 set encoding, but not a locale. So if I generate a
    data file, should I use decimal commas or points?

    Should I encode the locale in the document to ensure correct reading
    of the values? Is there
    some standard way to do this?

    This probably doesn't belong to the XML issue in itself, but I suspect
    this to be a fairly
    popular problem.

    Sorry if this is some FAQ - I haven't found it...

    John
    JohnC, Jun 5, 2008
    #1
    1. Advertising

  2. JohnC

    Ron Peterson Guest

    On Jun 5, 1:03 pm, JohnC <> wrote:
    > 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 set encoding, but not a locale. So if I generate a
    > data file, should I use decimal commas or points?


    > Should I encode the locale in the document to ensure correct reading
    > of the values? Is there
    > some standard way to do this?


    You want to use <number-grouping-separator> and <decimal-separator>.

    --
    Ron
    Ron Peterson, Jun 5, 2008
    #2
    1. Advertising

  3. If you're using XML Schema to define your document's format, it has a
    standard for this.
    Joseph J. Kesselman, Jun 5, 2008
    #3
  4. JohnC

    JohnC Guest

    On Jun 5, 6:35 pm, Ron Peterson <> wrote:
    > On Jun 5, 1:03 pm, JohnC <> wrote:
    >
    > > 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 set encoding, but not a locale. So if I generate a
    > > data file, should I use decimal commas or points?
    > > Should I encode the locale in the document to ensure correct reading
    > > of the values? Is there
    > > some standard way to do this?

    >
    > You want to use <number-grouping-separator> and <decimal-separator>.


    Hi Rob, Thanks for the hint. I did a search for both names, and found
    _very_ few references.
    Is this really a standard, or was this specified by Oracle (the first
    references I found
    pointed there)? Is there any document on this?

    Thanks again.
    John
    JohnC, Jun 6, 2008
    #4
  5. JohnC

    JohnC Guest

    On Jun 5, 7:24 pm, "Joseph J. Kesselman" <>
    wrote:
    > If you're using XML Schema to define your document's format, it has a
    > standard for this.


    Hi Joseph.
    Thanks for the reply. As far as I can see in the W3C Schema
    definition, things are simple -
    decimal numbers use decimal points, and no option seems to be present
    for allowing
    decimal commas. ( at least the regular expression in the w3c docs is
    definite about that).
    It _is_ the simplest solution.

    John
    JohnC, Jun 6, 2008
    #5
  6. > Thanks for the reply. As far as I can see in the W3C Schema
    > definition, things are simple -
    > decimal numbers use decimal points, and no option seems to be present
    > for allowing
    > decimal commas. ( at least the regular expression in the w3c docs is
    > definite about that).
    > It _is_ the simplest solution.


    For data interchange purposes, you want to pick *one* convention. No
    matter which one you pick it's going to disappoint someone, so the
    question winds up being which one's natural for the folks writing the
    spec. And since most spec authors are programmers and most programmers
    (and languages) already expect . as the decimal separator... More
    directly: There was an existing standard Schema could reference, so they
    referenced it rather than reinventing the wheel.

    Of course user interfaces are free to render the data in other ways. And
    you can use the other convention in XML if you're willing to be
    nonstandard or to simply treat it as text rather than expecting other
    tools to recognize it as the intended number.

    (Someday I should look up how , and . wound up with their functions
    being swapped in some cultures, and check which convention is actually
    older... just for historical interest.)
    Joseph J. Kesselman, Jun 6, 2008
    #6
  7. JohnC

    Ron Peterson Guest

    On Jun 5, 11:29 pm, JohnC <> wrote:
    > On Jun 5, 6:35 pm, Ron Peterson <> wrote:


    > > You want to use <number-grouping-separator> and <decimal-separator>.


    > Hi Rob, Thanks for the hint. I did a search for both names, and found
    > _very_ few references.
    > Is this really a standard, or was this specified by Oracle (the first
    > references I found pointed there)? Is there any document on this?


    The Oracle document is where I got that information. I was thinking
    that entities would be a good approach but since Oracle has already
    proposed a solution using tags, that seemed to have less conflict with
    established practices.

    I noticed that France uses spaces for number grouping separators
    compared to Germany which uses commas. That makes the tagging method
    best for document appearance where the W3C Schema omitting the
    grouping separators is best for input to software.

    --
    Ron
    Ron Peterson, Jun 6, 2008
    #7
  8. JohnC

    Peter Flynn Guest

    Joseph J. Kesselman wrote:
    >> Thanks for the reply. As far as I can see in the W3C Schema
    >> definition, things are simple -
    >> decimal numbers use decimal points, and no option seems to be present
    >> for allowing
    >> decimal commas. ( at least the regular expression in the w3c docs is
    >> definite about that).
    >> It _is_ the simplest solution.

    >
    > For data interchange purposes, you want to pick *one* convention. No
    > matter which one you pick it's going to disappoint someone, so the
    > question winds up being which one's natural for the folks writing the
    > spec. And since most spec authors are programmers and most programmers
    > (and languages) already expect . as the decimal separator... More
    > directly: There was an existing standard Schema could reference, so they
    > referenced it rather than reinventing the wheel.
    >
    > Of course user interfaces are free to render the data in other ways. And
    > you can use the other convention in XML if you're willing to be
    > nonstandard or to simply treat it as text rather than expecting other
    > tools to recognize it as the intended number.
    >
    > (Someday I should look up how , and . wound up with their functions
    > being swapped in some cultures, and check which convention is actually
    > older... just for historical interest.)


    There is a good thread about the pros and cons of choosing one format
    over others in the TEI discussions at:
    http://lists.village.virginia.edu/pipermail/tei-council/2005/005397.html

    Joe is quite right: pick one, but *document* what you picked, so that
    those who come after you can understand it.

    ///Peter
    Peter Flynn, Jun 7, 2008
    #8
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Rasool
    Replies:
    3
    Views:
    518
    mikeb
    Mar 3, 2004
  2. ibiza
    Replies:
    6
    Views:
    10,492
    ibiza
    Jan 20, 2006
  3. Guru
    Replies:
    1
    Views:
    6,897
    Michael Borgwardt
    Jul 30, 2004
  4. Saraswati lakki
    Replies:
    0
    Views:
    1,298
    Saraswati lakki
    Jan 6, 2012
  5. PERO
    Replies:
    4
    Views:
    448
    Brian McCauley
    Apr 13, 2007
Loading...

Share This Page