ws-commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hiranya Jayathilaka (JIRA)" <>
Subject [jira] Commented: (WSCOMMONS-305) OMElementImpl.getText() returns an empty String for text in CDATA tags
Date Mon, 03 Mar 2008 11:52:51 GMT


Hiranya Jayathilaka commented on WSCOMMONS-305:

Problem is with the OMElementImpl.getText() method which performs a crude test on the type
of the element in question.

public String getText() {
        String childText = null;
        StringBuffer buffer = null;
        OMNode child = this.getFirstOMChild();

        while (child != null) {
            if (child.getType() == OMNode.TEXT_NODE) {
                OMText textNode = (OMText) child;
                String textValue = textNode.getText();

> OMElementImpl.getText() returns an empty String for text in CDATA tags
> ----------------------------------------------------------------------
>                 Key: WSCOMMONS-305
>                 URL:
>             Project: WS-Commons
>          Issue Type: Improvement
>          Components: AXIOM
>         Environment: any
>            Reporter: Hiranya Jayathilaka
> AXIOM supports building OM structures with CDATA elements. For an example something like,
> soapFactory.createOMText(parentNode, "some text",XMLStreamConstants.CDATA);
> is perfectly valid and delivers the expected result. But when traversing such an OM structure
calling parentNode.getText() returns an empty String. Instead it would have been better if
it returned the String without the CDATA tags. For an example calling getText() on an element
> <parentnode><![CDATA[some text]]></parentnode>
> should return the String, "some text".

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:
For additional commands, e-mail:

View raw message