jira.codehaus.org

  • Log In Access more options
    • Online Help
    • Keyboard Shortcuts
    • About JIRA
    • JIRA Credits
    • What?s New
  • Dashboards Access more options (Alt+d)
  • Projects Access more options (Alt+p)
  • Issues Access more options (Alt+i)
  • XStream
  • XSTR-209

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

  • Log In
  • Views
    • XML
    • Word
    • Printable

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

relates to

Bug - A problem which impairs or prevents the functions of the product. XSTR-147 String "\0" serialized as inavlid XML

  • Closed - The issue is considered finished, the resolution is correct. Issues which are not closed can be reopened.

Activity

Ascending order - Click to sort in descending order
  • All
  • Comments
  • History
  • Activity
Hide
Permalink
Joerg Schaible added a comment - 30/Nov/05 1:47 AM

Well, the DomDriver is correct, XML 1.0 specifies in Chapter 2.2 only tabs, carriage return and line feed as valid characters in the non-printable area from 0-31. This is changed in XML 1.1 though, here only a \0 is invalid. I added support at least for this character.

Show
Joerg Schaible added a comment - 30/Nov/05 1:47 AM Well, the DomDriver is correct, XML 1.0 specifies in Chapter 2.2 only tabs, carriage return and line feed as valid characters in the non-printable area from 0-31. This is changed in XML 1.1 though, here only a \0 is invalid. I added support at least for this character.
Hide
Permalink
Joerg Schaible added a comment - 13/Apr/06 5:44 PM

Ben, please reopen if you still have issues with it.

Show
Joerg Schaible added a comment - 13/Apr/06 5:44 PM Ben, please reopen if you still have issues with it.

People

  • Assignee:
    Unassigned
    Reporter:
    Ben Walding
Vote (0)
Watch (0)

Dates

  • Created:
    26/Mar/05 7:49 PM
    Updated:
    07/Aug/06 9:28 PM
    Resolved:
    13/Apr/06 5:44 PM
  • Atlassian JIRA (v5.0.4#731-sha1:3aa7374)
  • Report a problem
  • Powered by a free Atlassian JIRA open source license for Codehaus. Try JIRA - bug tracking software for your team.