You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commons-dev@ws.apache.org by David Illsley <da...@gmail.com> on 2007/10/11 11:21:07 UTC

[Proposal][Axiom] Add getSimpleTextContext method to OMElement interface

In recent profiling of the Axis2 Addressing implementation, it has
become clear that the OMElement.getText() method is slow for
extracting values such as wsa:Action, wsa:MessageID and wsa:To because
it parses the content of the OMText nodes and does namespace lookups
based on what it believes are prefixes. This is unnecessary in this
case.

I'd like to add the following method definition to the OMElement
interface. I've included the llom implementation for clarity. This
getSimpleTextContext() method is 50% of the path length of getText()
in the WS-Addressing scenario.

Please let me know if you have any objections, otherwise I'll assume
lazy concensus.
David

OMElement interface change:
  /**
     * Returns the exact content of the first child node if it is
     * an OMText node. NOTE: This method explicitly excludes QName
     * processing.
     */
    public String getSimpleTextContent();

llom OMElement implementation:
  /**
     * Returns the exact content of the first child node if it is
     * an OMText node. NOTE: This method explicitly excludes QName
     * processing.
     */
    public String getSimpleTextContent(){
    	String childText = null;
        OMNode child = this.getFirstOMChild();
        if (child != null && (child.getType() == OMNode.TEXT_NODE)) {
        	OMText textNode = (OMText) child;
        	childText = new String(textNode.getTextCharacters());
        }
        if(childText == null){
        	childText = "";
        }
        return childText;
    }

-- 
David Illsley - IBM Web Services Development

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


Re: [Proposal][Axiom] Add getSimpleTextContext method to OMElement interface

Posted by Glen Daniels <gl...@thoughtcraft.com>.
David Illsley wrote:
> d'oh. Looks like my axiom source checkout was from a branch. Looks
> like you fixed this up  a while back [1]. Thanks!

Cool, glad to have retroactively helped. :)

--G

> David
> [1] http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMTextImpl.java?r1=515594&r2=523075
> 
> On 11/10/2007, Glen Daniels <gl...@thoughtcraft.com> wrote:
>> Hi David!
>>
>> David Illsley wrote:
>>> In recent profiling of the Axis2 Addressing implementation, it has
>>> become clear that the OMElement.getText() method is slow for
>>> extracting values such as wsa:Action, wsa:MessageID and wsa:To because
>>> it parses the content of the OMText nodes and does namespace lookups
>>> based on what it believes are prefixes. This is unnecessary in this
>>> case.
>> Can you point me to where exactly in the code this is happening?  I just
>> walked through OMElementImpl and OMTextImpl and didn't see any namespace
>> lookups (or even colon searches) happening outside of getTextAsQName()....
>>
>> Thanks,
>> --Glen
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: commons-dev-unsubscribe@ws.apache.org
>> For additional commands, e-mail: commons-dev-help@ws.apache.org
>>
>>
> 
> 

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


Re: [Proposal][Axiom] Add getSimpleTextContext method to OMElement interface

Posted by David Illsley <da...@gmail.com>.
d'oh. Looks like my axiom source checkout was from a branch. Looks
like you fixed this up  a while back [1]. Thanks!
David
[1] http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMTextImpl.java?r1=515594&r2=523075

On 11/10/2007, Glen Daniels <gl...@thoughtcraft.com> wrote:
> Hi David!
>
> David Illsley wrote:
> > In recent profiling of the Axis2 Addressing implementation, it has
> > become clear that the OMElement.getText() method is slow for
> > extracting values such as wsa:Action, wsa:MessageID and wsa:To because
> > it parses the content of the OMText nodes and does namespace lookups
> > based on what it believes are prefixes. This is unnecessary in this
> > case.
>
> Can you point me to where exactly in the code this is happening?  I just
> walked through OMElementImpl and OMTextImpl and didn't see any namespace
> lookups (or even colon searches) happening outside of getTextAsQName()....
>
> Thanks,
> --Glen
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@ws.apache.org
> For additional commands, e-mail: commons-dev-help@ws.apache.org
>
>


-- 
David Illsley - IBM Web Services Development

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


Re: [Proposal][Axiom] Add getSimpleTextContext method to OMElement interface

Posted by Glen Daniels <gl...@thoughtcraft.com>.
Hi David!

David Illsley wrote:
> In recent profiling of the Axis2 Addressing implementation, it has
> become clear that the OMElement.getText() method is slow for
> extracting values such as wsa:Action, wsa:MessageID and wsa:To because
> it parses the content of the OMText nodes and does namespace lookups
> based on what it believes are prefixes. This is unnecessary in this
> case.

Can you point me to where exactly in the code this is happening?  I just 
walked through OMElementImpl and OMTextImpl and didn't see any namespace 
lookups (or even colon searches) happening outside of getTextAsQName()....

Thanks,
--Glen

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