Details

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

      Description

      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" (http://www.w3.org/TR/xml/#AVNormalize). 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 "' (http://java.sun.com/webservices/docs/1.5/api/javax/xml/stream/XMLStreamWriter.html). 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

        Activity

        No work has yet been logged on this issue.

          People

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

            Dates

            • Created:
              Updated:

              Development