Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-5379

XmlParser trims text between element

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Not A Problem
    • 1.8.6
    • None
    • XML Processing
    • None

    Description

      text between elements ending with empty line or white spaces is trimmed. This is the test case that should pass:

      import groovy.xml.*
      def xml = new XmlParser().parseText("<a>x \n\t </a>")
      assert "x \n\t " == xml.text()
      

      Note, that XmlSlurper works fine:

      import groovy.xml.*
      def xml = new XmlSlurper().parseText("<a>x \n\t </a>")
      assert "x \n\t " == xml.text()
      

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            paulk Paul King
            jakub.neubauer Jakub Neubauer
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment