Menu

white space condensation

2003-05-14
2003-05-19
  • Marcin Zukowski

    Marcin Zukowski - 2003-05-14

    Hi!
    TinyXML objects have a SetCondenseWhiteSpace method, which compresses all multiple whitespaces into one.
    The problem is, it also trims a text, so the following files will have the same meaning (I use [ and ] tags since I'm not sure how SF handles that):
      This is [i] italic [/i] text
      This is[i]italic[/i]text
    It would be a nice feature to have two options:
    - whitespace condensation
    - text trimming
    What's your opinion?

     
    • B Sizer

      B Sizer - 2003-05-19

      It should follow the specifications at:
      http://www.w3.org/TR/REC-xml#sec-white-space.

      Unfortunately, like other parts of the specification, it appears self-contradictory:
      "An XML processor must always pass all characters in a document that are not markup through to the application."
      and
      "A special attribute named xml:space may be attached to an element to signal an intention that in that element, white space should be preserved by applications.[..] When declared, it must be given as an enumerated type whose values are one or both of "default" and "preserve". "

      So it seems to say "you should always pass white space on", but also seems to say "we provide an attribute so you can tell the processor to pass white space on". Maybe I'm just reading it wrongly, though.

      I don't think text trimming should be done; if you strip the tags out of your example, it reads as "isitalictext" rather than "is italic text". Just as in HTML, whitespace is significant - just the amount of it usually is not.

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.