Standard for decimal numbers in XML

Discussion in 'XML' started by DustWolf, Mar 7, 2007.

  1. DustWolf

    DustWolf Guest

    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. :)
    DustWolf, Mar 7, 2007
    #1
    1. Advertising

  2. 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/
    Martin Honnen, Mar 7, 2007
    #2
    1. Advertising

  3. DustWolf

    Guest

    On 7 Mar, 17:23, "DustWolf" <> wrote:
    > 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, 2007
    #3
  4. 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
    Joe Kesselman, Mar 7, 2007
    #4
    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. Ven
    Replies:
    3
    Views:
    1,303
  2. Gilbert Fine
    Replies:
    8
    Views:
    885
    Zentrader
    Aug 1, 2007
  3. Vitaliy
    Replies:
    1
    Views:
    460
    Peter Otten
    May 29, 2008
  4. valpa
    Replies:
    11
    Views:
    1,486
    Steven D'Aprano
    Mar 24, 2009
  5. Replies:
    0
    Views:
    272
Loading...

Share This Page