[ 
https://issues.apache.org/jira/browse/WSCOMMONS-279?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Rich Scheuerle resolved WSCOMMONS-279.
--------------------------------------

    Resolution: Fixed

Committed Revision 595335

> Performance: Avoid overuse of XMLStreamWriter.getNamespaceContext()
> -------------------------------------------------------------------
>
>                 Key: WSCOMMONS-279
>                 URL: https://issues.apache.org/jira/browse/WSCOMMONS-279
>             Project: WS-Commons
>          Issue Type: Bug
>          Components: AXIOM
>            Reporter: Rich Scheuerle
>            Assignee: Rich Scheuerle
>
> History:
> An XMLStreamWriter is used to serialize Axiom trees.  The NamespaceContext of 
> the XMLStreamWriter is queried to determine if a {prefix, namespace} pair is 
> associated.
> If not,"setPrefix(..)" or "setDefaultNamespace(...)" is invoked, which will 
> cause the writer to write a namespace declaration.  
> This code is complicated by the determination of whether setPrefix occurs 
> before or after the start tag.
> Problem:
> Calling getNamespaceContext() is expensive.  Some XMLStreamWriter 
> implementations construct new NamespaceContext objects.  Creating and garbage 
> collection of these objects can cause performance degradations.
> Solution:
> I wrote an isAssociated(String prefix, String namespace) method in 
> OMSerializerUtil.  This method has a two stage "association" check.  First it 
> uses the writer.getPrefix(uri) call.  If this check fails, it falls back to 
> the getNamespaceContext() check.  This two stage approach avoids unnecessary 
> NamespaceContext construction.  It is also a convenient utility for 
> debugging/support.

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


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to