You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@uima.apache.org by "Adam Lally (JIRA)" <de...@uima.apache.org> on 2010/08/13 19:43:17 UTC

[jira] Created: (UIMA-1859) XMLSerializer does not produce XML 1.1 header

XMLSerializer does not produce XML 1.1 header
---------------------------------------------

                 Key: UIMA-1859
                 URL: https://issues.apache.org/jira/browse/UIMA-1859
             Project: UIMA
          Issue Type: Bug
          Components: Core Java Framework
    Affects Versions: 2.3
            Reporter: Adam Lally
            Assignee: Adam Lally


If you create an XMLSerializer and set its output stream, and then call sax2xml.setOutputProperty(OutputKeys.VERSION, "1.1"), the output XML file will have an <?xml version="1.0"...> header instead of the desired version="1.1".

A workaround is to call sax2xml.setOutputProperty(OutputKeys.VERSION, "1.1") before setting the output stream.

Test case:
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    XMLSerializer sax2xml = new XMLSerializer(baos, false);
    sax2xml.setOutputProperty(OutputKeys.VERSION, "1.1");
    ContentHandler ch = sax2xml.getContentHandler();    
    ch.startDocument();
    ch.startElement("","foo","foo", new AttributesImpl());
    ch.endElement("", "foo", "foo");
    ch.endDocument();
    String xmlStr = new String(baos.toByteArray(), "UTF-8");
    assertEquals("<?xml version=\"1.1\" encoding=\"UTF-8\"?><foo/>", xmlStr);

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Closed: (UIMA-1859) XMLSerializer does not produce XML 1.1 header

Posted by "Adam Lally (JIRA)" <de...@uima.apache.org>.
     [ https://issues.apache.org/jira/browse/UIMA-1859?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Adam Lally closed UIMA-1859.
----------------------------

    Fix Version/s: 2.3
       Resolution: Fixed

> XMLSerializer does not produce XML 1.1 header
> ---------------------------------------------
>
>                 Key: UIMA-1859
>                 URL: https://issues.apache.org/jira/browse/UIMA-1859
>             Project: UIMA
>          Issue Type: Bug
>          Components: Core Java Framework
>    Affects Versions: 2.3
>            Reporter: Adam Lally
>            Assignee: Adam Lally
>             Fix For: 2.3
>
>
> If you create an XMLSerializer and set its output stream, and then call sax2xml.setOutputProperty(OutputKeys.VERSION, "1.1"), the output XML file will have an <?xml version="1.0"...> header instead of the desired version="1.1".
> A workaround is to call sax2xml.setOutputProperty(OutputKeys.VERSION, "1.1") before setting the output stream.
> Test case:
>     ByteArrayOutputStream baos = new ByteArrayOutputStream();
>     XMLSerializer sax2xml = new XMLSerializer(baos, false);
>     sax2xml.setOutputProperty(OutputKeys.VERSION, "1.1");
>     ContentHandler ch = sax2xml.getContentHandler();    
>     ch.startDocument();
>     ch.startElement("","foo","foo", new AttributesImpl());
>     ch.endElement("", "foo", "foo");
>     ch.endDocument();
>     String xmlStr = new String(baos.toByteArray(), "UTF-8");
>     assertEquals("<?xml version=\"1.1\" encoding=\"UTF-8\"?><foo/>", xmlStr);

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.