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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to