You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ws.apache.org by "Hudson (JIRA)" <ji...@apache.org> on 2012/08/16 20:25:38 UTC

[jira] [Commented] (AXIOM-419) Multiple issues in OMDataSourceExtBase

    [ https://issues.apache.org/jira/browse/AXIOM-419?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13436195#comment-13436195 ] 

Hudson commented on AXIOM-419:
------------------------------

Integrated in ws-axiom-trunk #1165 (See [https://builds.apache.org/job/ws-axiom-trunk/1165/])
    AXIOM-419: Updated user guide to take into account the introduction of AbstractPullOMDataSource. (Revision 1373934)

     Result = SUCCESS
veithen : 
Files : 
* /webservices/commons/trunk/modules/axiom/src/docbkx/userguide.xml

                
> Multiple issues in OMDataSourceExtBase
> --------------------------------------
>
>                 Key: AXIOM-419
>                 URL: https://issues.apache.org/jira/browse/AXIOM-419
>             Project: Axiom
>          Issue Type: Bug
>          Components: API
>    Affects Versions: 1.2.13
>            Reporter: Andreas Veithen
>            Assignee: Andreas Veithen
>            Priority: Minor
>             Fix For: 1.2.14
>
>
> OMDataSourceExtBase has multiple issues and we should probably deprecate it in favor of a cleaner implementation:
> (1) The default implementation of serialize(OutputStream, OMOutputFormat) relies on getXMLBytes:
>             output.write(getXMLBytes(format.getCharSetEncoding()));
> This is probably the worst choice from a performance point of view.
> (2) The default implementation of serialize(Writer, OMOutputFormat) is even worse:
>             String text = new String(getXMLBytes(format.getCharSetEncoding()));
>             writer.write(text);
> (3) serialize(XMLStreamWriter) tries to optimize the serialization by using serialize(OutputStream, OMOutputFormat) if the XMLStreamWriter is a MTOMXMLStreamWriter, i.e. it attempts to bypass the XMLStreamWriter. However, as noted in the Axiom 1.3 roadmap, this kind of optimization is non trivial and the serialize(OutputStream, OMOutputFormat) is not well designed for this. The issues that may arise can be demonstrated using the InputStreamDataSource (which extends OMDataSourceExtBase):
>         OMFactory factory = OMAbstractFactory.getOMFactory();
>         OMElement parent = factory.createOMElement("root", factory.createOMNamespace("urn:parent", ""));
>         OMSourcedElement child = factory.createOMElement(new InputStreamDataSource(new ByteArrayInputStream("<child/>".getBytes("utf-8")), "utf-8"), new QName("child"));
> //        child.getFirstOMChild();
>         parent.addChild(child);
>         parent.serializeAndConsume(System.out, new OMOutputFormat());
> The output of this code is:
> <root xmlns="urn:parent"><child/></root>
> This is incorrect because the namespace of the child element in the output is urn:parent while the original element has no namespace. If the line forcing the expansion of the OMSourcedElement is uncommented, then the result is correct:
> <root xmlns="urn:parent"><child xmlns=""/></root>
> (4) The class contains code (see the private reader2writer method) that copies events from the XMLStreamReader produced by getReader() to an XMLStreamWriter. However, that code actually fully builds an Axiom tree, which is the least optimal approach.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ws.apache.org
For additional commands, e-mail: dev-help@ws.apache.org