Javier Irazazábal created CXF-7064:

             Summary: DelegatingXMLStreamWriter.writeCData(text) writes several 
CDATA sections for a signed XML file
                 Key: CXF-7064
                 URL: https://issues.apache.org/jira/browse/CXF-7064
             Project: CXF
          Issue Type: Bug
          Components: JAX-WS Runtime
    Affects Versions: 3.1.7
         Environment: windows 7/ linux centos 6
            Reporter: Javier Irazazábal


When implementing a CDATA interceptor in order to include a signed XML file in 
a SOAP envelope, we are getting several CDATA sections in the XML that makes 
the service reject the envelope: 

import java.util.regex.Pattern;

import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamWriter;

import org.apache.cxf.staxutils.DelegatingXMLStreamWriter;
 * Simple CDATA XML Stream Writer that exports some items as CDATA
public class CDataXMLStreamWriter extends DelegatingXMLStreamWriter {
    private static final Pattern XML_CHARS = Pattern.compile( "[&<>]" );
    private static final String CDataOpen = "<![CDATA[";
    private static final String CDataClose = "]]>";
    public CDataXMLStreamWriter(XMLStreamWriter del) { 

    public void writeCharacters(String text) throws XMLStreamException { 
        boolean useCData = XML_CHARS.matcher( text ).find();

        if (useCData) {
System.out.println("text" + text);              
        }else { 
    public void writeStartElement(String local) throws XMLStreamException { 

That's urgent to solve this for us. 

This message was sent by Atlassian JIRA

Reply via email to