ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 17195] New: - XmlPropery task does not support CDATA section
Date Wed, 19 Feb 2003 09:14:00 GMT
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

Mime
View raw message