You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by bu...@apache.org on 2003/02/19 10:14:00 UTC

DO NOT REPLY [Bug 17195] New: - XmlPropery task does not support CDATA section

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=17195>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=17195

XmlPropery task does not support CDATA section

           Summary: XmlPropery task does not support CDATA section
           Product: Ant
           Version: 1.5.1
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Core tasks
        AssignedTo: dev@ant.apache.org
        ReportedBy: markku.saarela@entra.fi


If you define element with cdata section then the property value is not setted.

Here is fix for 
public Object processNode (Node node, String prefix, Object container) 
method to accept cdata section(this code is from end of method):

        if (node.getNodeType() == Node.TEXT_NODE) {
            // If the containing object was a String, then use it as the ID.
            if (semanticAttributes && id == null 
                && container instanceof String) {
                id = (String) container;
            }
            // For the text node, add a property.
            String nodeText = getAttributeValue(node);
            if (nodeText.trim().length() != 0) {
              addProperty(prefix, nodeText, id);
            }
        } else if ((node.getNodeType() == Node.ELEMENT_NODE) 
            && (node.getChildNodes().getLength() == 1)
            && (node.getFirstChild().getNodeType() == Node.CDATA_SECTION_NODE)) 
{
            // CDATA section              
            // If the containing object was a String, then use it as the ID.
            if (semanticAttributes && id == null
                && container instanceof String) {
                id = (String) container;
            }
            // For the cdata-section node, add a property.
            String nodeText = node.getFirstChild().getNodeValue();
            addProperty(prefix, nodeText, id);
        }

Regards
Markku Saarela
markku.saarela@entra.fi