Hi,

I am trying to add text to an OMElement so it is surrounded by CData tags. However, when I add my created OMElement as a child to another element, the wrapped text is lost.

As far as I can see this should work:

OMElementImpl displayNameNode = new OMElementImpl("displayName", ns, null);
        if(cf.getDisplayName() != null){
OMTextImpl text = (OMTextImpl)factory.createOMText("test", OMTextImpl.CDATA_SECTION_NODE);
            logger.debug(text.getText());
            displayNameNode.addChild(text);
            logger.debug(displayNameNode);
        }
        fieldNode.addChild(displayNameNode);
        logger.debug(fieldNode);

Checking the logs, I can see the correct text coming out from the debug:

        07 Jan 2009 14:32:56,168 DEBUG [CampaignDataAccessWS:398]  test

Again, when I check that the displayNameNode has been created properly I can see the text fine:

<ao:displayName xmlns:ao="http://xxx/WS/v0.1";><![CDATA[test]]></ ao:displayName>

When I add this node as a child I get the problem:

<ao:field xmlns:ao="http://xxx/WS/v0.1"; ao:columnName="Mod_Date" ao:type="8" ao:order="5"><ao:displayName><![CDATA[]]></ ao:displayName></ao:field>

I am assuming I am doing something wrong here, but I cannot see what it is.

Any help would be much appreciated.

Chris

Reply via email to