1 Reply Latest reply on Apr 2, 2009 3:16 PM by Newsgroup_User

    Preserving leading whitespace when parsing XML

    paulv410
      I am having trouble parsing XML that intentionally contains leading or trailing whitespace. The toXMLString and toString methods always trim the whitespace. I've tried setting XML.ignoreWhitespace = false and XML.prettyPrinting = false. This doesn't work. Below is an example of what the XML may contain. It's essentially preformatted text. The spaces are required to display the output correctly. However, Flex keeps trimming the spaces. Does anyone know of a way to preserve the whitespace and retrieve the value from the node?

      <Span> * </Span>
      <Span>*******</Span>
      <Span> * </Span>
        • 1. Re: Preserving leading whitespace when parsing XML
          Level 7

          "paulv410" <webforumsuser@macromedia.com> wrote in message
          news:gr2b2d$7g9$1@forums.macromedia.com...
          >I am having trouble parsing XML that intentionally contains leading or
          >trailing
          > whitespace. The toXMLString and toString methods always trim the
          > whitespace.
          > I've tried setting XML.ignoreWhitespace = false and XML.prettyPrinting =
          > false.
          > This doesn't work. Below is an example of what the XML may contain. It's
          > essentially preformatted text. The spaces are required to display the
          > output
          > correctly. However, Flex keeps trimming the spaces. Does anyone know of
          > a way
          > to preserve the whitespace and retrieve the value from the node?
          >
          > <Span> * </Span>
          > <Span>*******</Span>
          > <Span> * </Span>
          >

          Look at CDATA