Uploaded image for project: 'StAXMapper'
  1. StAXMapper
  2. STXM-12

Better handling of newlines and indentation for element content text

    XMLWordPrintable

Details

    • Feature Request
    • Resolution: Done
    • Major
    • 1.2.0.Beta1
    • None
    • core
    • None

    Description

      FormattingXMLStreamWriter.writeCharacters(String) always puts element content text on a new line, indented. This increases document size and makes it difficult for AS7 to write out a document that doesn't have unnecessary whitespace changes versus the original version of the document.

      A couple of possibilities:

      1) Have writeCharacters(String) only put in a new line and indent if the given text itself has a new line (i.e. format multiline text, but leave single line text on a single line)
      2) Have writers use the writeCharacters(char[] chars) method, but adjust the element close behavior so the closing element tag is only indented and put on a new line if the content text was.

      IMO the 2nd change should be made in any case, as the existing behavior results in output like this if the writeCharacters(char[] chars) method is used:

      <element>thetext
      </element>

      Attachments

        Issue Links

          Activity

            People

              bstansbe@redhat.com Brian Stansberry
              bstansbe@redhat.com Brian Stansberry
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: