another newbie question...

Discussion in 'XML' started by JustSomeGuy, Dec 7, 2004.

  1. JustSomeGuy

    JustSomeGuy Guest

    Is there a difference between these two xml statments?

    <stuff>1</stuff>
    vs
    <stuff>
    1
    </stuff>

    Is there something in the standard that specifies that the data parsers
    should stip leading and trailing white space?
    Just curious because i'm using the later of the two examples and it seems
    like my xml is being rejected and I was
    wondering if it was simply the white space around the '1'.

    TIA
     
    JustSomeGuy, Dec 7, 2004
    #1
    1. Advertising

  2. JustSomeGuy

    Peter Flynn Guest

    JustSomeGuy wrote:

    > Is there a difference between these two xml statments?
    >
    > <stuff>1</stuff>
    > vs
    > <stuff>
    > 1
    > </stuff>


    Yes. In the first one, the stuff element contains a single digit 1.
    In the second, it contains a linebreak, two spaces, a 1, and another
    linebreak.

    If you are outputting this to a browser, the leading and trailing
    linebreaks and spaces are probably absorbed and disappear. But if
    you are doing anything else with it, they remain there and need to
    be dealt with by your application.

    > Is there something in the standard that specifies that the data parsers
    > should strip leading and trailing white space?


    Yes, it specifies that they should NOT strip white-space, but instead
    pass it through to the application to deal with.

    > Just curious because i'm using the later of the two examples and it seems
    > like my xml is being rejected and I was
    > wondering if it was simply the white space around the '1'.


    Quite possibly, but without knowing details of the application and the
    software it's not possible to give an exact answer.

    ///Peter
    --
    "The cat in the box is both a wave and a particle"
    -- Terry Pratchett, introducing quantum physics in _The Authentic Cat_
     
    Peter Flynn, Dec 8, 2004
    #2
    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. Max
    Replies:
    2
    Views:
    467
    Ralf Hildebrandt
    Sep 1, 2003
  2. Dave Newberry
    Replies:
    0
    Views:
    673
    Dave Newberry
    Oct 17, 2004
  3. SStory
    Replies:
    1
    Views:
    297
    Kevin Spencer
    Aug 4, 2003
  4. Rob R. Ainscough
    Replies:
    3
    Views:
    374
    Rob R. Ainscough
    Jun 14, 2005
  5. Jerry C.
    Replies:
    8
    Views:
    277
    Uri Guttman
    Nov 23, 2003
Loading...

Share This Page