XStream
  1. XStream
  2. XSTR-209

DomDriver() does not handle non-printable chars very well (eg. 0x0c)

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.1.3
    • Component/s: None
    • Labels:
      None
    • JDK version and platform:
      1.5.0-beta2-b51

      Description

      When using the DomDriver(), strings with 0x0c (and probably other chars as well) do not unmarshal correctly, yielding an error:

      [Fatal Error] :1:14: An invalid XML character (Unicode: 0xc) was found in the element content of the document.

      Using the default (XPP) driver works correctly.

      It might be worth noting this in the FAQ, because I suspect it is out of your hands (i.e. error exists in DomDriver).

      Here is a test case demonstrating this behaviour:

      import junit.framework.TestCase;

      import com.thoughtworks.xstream.XStream;
      import com.thoughtworks.xstream.io.xml.DomDriver;

      public class DomTest extends TestCase
      {

      public void testDomDriver()

      { XStream xs = new XStream( new DomDriver() ); String input = "hello" + ( char ) 0x0c; assertEquals( input, xs.fromXML( xs.toXML( input ) ) ); }

      public void testDefaultDriver()

      { XStream xs = new XStream(); String input = "hello" + ( char ) 0x0c; assertEquals( input, xs.fromXML( xs.toXML( input ) ) ); }

      }

        Issue Links

          People

          • Assignee:
            Unassigned
            Reporter:
            Ben Walding
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: