• Type: Bug Bug
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 1.0
    • Fix Version/s: None
    • Labels:
    • Environment:


      DdlUtils does not properly preserve content through a dump/restore cycle if the content contains newlines.

      DdlUtils takes the following approach for dumping text content:
      (1) Write as value attribute, unless it cannot be written as such
      (2) Write as "plain" element content unless it cannot be written as such
      (3) Write as CDATA unless it cannot be written as such
      (4) Write uuencoded.

      Now when can a value not be written as attribute value? Easy: when there is no valid representation that reads back the same value. And here is the problem. The XML recommendation specifies something called "attribute value normalization" ( Due to this, white space characters except space (#xD, #xA, #x9) in attribute values are not read back in the same way as they are written.

      There are two ways to circumvent this: (a) write them as character references (e.g. or (b) skip to method (2). Option (a) cannot be used here , because it is impossible to write a "&" in an attribute value when you use XMLStreamWriter. The spec says: 'However the writeCharacters method is required to escape & , < and > For attribute values the writeAttribute method will escape the above characters plus "' ( You might expect that the XMLStreamWriter.writeAttribute should handle escaping of the whitespace characters (#xD, #xA, #x9), but if you read the spec carefully it does not say so. Leaves option (b).

      The attached patch fixes this problem.

      1. patch.txt
        3 kB
        Michael Lipp
      2. patch-updated.txt
        4 kB
        Michael Lipp


        Michael Lipp made changes -
        Attachment patch-updated.txt [ 12376988 ]
        Michael Lipp made changes -
        Field Original Value New Value
        Attachment patch.txt [ 12376927 ]
        Michael Lipp created issue -


          • Assignee:
            Thomas Dudziak
            Michael Lipp
          • Votes:
            0 Vote for this issue
            1 Start watching this issue


            • Created: