Forum Discussion

cavalino's avatar
12 years ago

Pretty Print trimming spaces?

I've found that Pretty Print changes values in XML response messages and influences assertions as well, because of leading (and possibly trailing) spaces being trimmed.


<element> data</element> becomes <element>data</element> with Pretty Print turned on, and any assertion on the value including those leading spaces will fail, since they were removed by Pretty Print. With Pretty Print turned off, the spaces remain and the assertion succeeds.

I'd like to be able to use Pretty Print, without it actually influencing values in XML elements and assertions to fail because of this.

Is this intentional? Can I circumvent this behaviour without losing the Pretty Print functionality?

Thanks in advance for any help!

2 Replies

  • _Face_'s avatar
    Occasional Visitor



    Is this something that you plan to fix? There seem to be no good reason for trimming white-space within an element. It is actually altering the message data!

    • deanis74's avatar
      New Member

      I found myself searching this same issue tonight.  Turns out it's far from new, having been originally reported in 2007.


      However, the issue is with the underlying library used to perform the 'pretty printing'.  While they have no plans to change their behavior, someone did post a patch back in 2010 that could be manually applied.  I have no idea if that patch is still relevant.