Uploaded image for project: 'XMLBeans'
  1. XMLBeans
  2. XMLBEANS-22

xmlText trims whitespace within elements if prettyprint is on

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Won't Fix
    • Affects Version/s: Version 1
    • Fix Version/s: TBD
    • Component/s: None
    • Labels:
      None
    • Environment:
      Java 1.4.2_03, Win 2K

      Description

      When called with XmlOptions.SAVE_PRETTY_PRINT, xmlText trims whitespace within an element - e.g., ' a ' is converted to 'a'.

      Unless I'm completely missing something, the formatter shouldn't ever change the contents of an element.

      The following test snippet reveals the problem:
      XmlObject xdoc = XmlObject.Factory.parse("<test> </test>");
      Assert.assertEquals("<test> </test>", xdoc.xmlText());
      Assert.assertEquals("<test> </test>" + newLine, xdoc.toString());

      The current build from CVS returns <test/>[newline] instead of <test> <test>[newline].

      Complete testcase and patch to follow.

        Attachments

        1. whitespace-patch
          2 kB
          Aaron Dunlop

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                aaron.dunlop@transcore.com Aaron Dunlop
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: