ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From co...@apache.org
Subject cvs commit: ant/src/testcases/org/apache/tools/ant/taskdefs XmlPropertyTest.java
Date Tue, 24 Jun 2003 11:29:21 GMT
conor       2003/06/24 04:29:20

  Modified:    .        WHATSNEW
               src/etc/testcases/taskdefs xmlproperty_data.xml
               src/main/org/apache/tools/ant/taskdefs XmlProperty.java
               src/testcases/org/apache/tools/ant/taskdefs
                        XmlPropertyTest.java
  Log:
  PR:	17195
  Submitted by:	Markku Saarela
  
  Revision  Changes    Path
  1.444     +5 -0      ant/WHATSNEW
  
  Index: WHATSNEW
  ===================================================================
  RCS file: /home/cvs/ant/WHATSNEW,v
  retrieving revision 1.443
  retrieving revision 1.444
  diff -u -w -u -r1.443 -r1.444
  --- WHATSNEW	24 Jun 2003 09:16:10 -0000	1.443
  +++ WHATSNEW	24 Jun 2003 11:29:19 -0000	1.444
  @@ -172,6 +172,8 @@
   * <fixcrlf> will now create the parent directories for the destination
     files if necessary.  Bugzilla Report 20840.
   
  +* <xmlproperty> now handles CDATA sections. BugZilla Report 17195  
  +  
   Other changes:
   --------------
   * Six new Clearcase tasks added.
  @@ -434,6 +436,9 @@
   
   * <mapper> has an "unpackage" mapper
     Bugzilla Report 18908
  +  
  +* Added <scriptdef> task allowing tasks to be defined using any BSF-supported
  +  scripting language.  
   
   Changes from Ant 1.5.2 to Ant 1.5.3
   ===================================
  
  
  
  1.2       +1 -0      ant/src/etc/testcases/taskdefs/xmlproperty_data.xml
  
  Index: xmlproperty_data.xml
  ===================================================================
  RCS file: /home/cvs/ant/src/etc/testcases/taskdefs/xmlproperty_data.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -w -u -r1.1 -r1.2
  --- xmlproperty_data.xml	19 Apr 2002 19:51:29 -0000	1.1
  +++ xmlproperty_data.xml	24 Jun 2003 11:29:19 -0000	1.2
  @@ -1,4 +1,5 @@
    <root-tag myattr="true">
      <inner-tag someattr="val">Text</inner-tag>
      <a2><a3><a4>false</a4></a3></a2>
  +   <cdatatag><![CDATA[<test>]]></cdatatag>
    </root-tag>
  
  
  
  1.13      +13 -2     ant/src/main/org/apache/tools/ant/taskdefs/XmlProperty.java
  
  Index: XmlProperty.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/XmlProperty.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -w -u -r1.12 -r1.13
  --- XmlProperty.java	18 Apr 2003 23:40:23 -0000	1.12
  +++ XmlProperty.java	24 Jun 2003 11:29:20 -0000	1.13
  @@ -450,14 +450,25 @@
               }
           }
   
  +        String nodeText = null;
           if (node.getNodeType() == Node.TEXT_NODE) {
  +            // For the text node, add a property.
  +            nodeText = getAttributeValue(node);
  +        } else if ((node.getNodeType() == Node.ELEMENT_NODE) 
  +            && (node.getChildNodes().getLength() == 1)
  +            && (node.getFirstChild().getNodeType() == Node.CDATA_SECTION_NODE))
{
  +
  +            nodeText = node.getFirstChild().getNodeValue();
  +        }
  +        
  +        if (nodeText != null) {
               // If the containing object was a String, then use it as the ID.
               if (semanticAttributes && id == null 
                   && container instanceof String) {
                   id = (String) container;
  +                System.out.println("Setting id = " + id);
               }
  -            // For the text node, add a property.
  -            String nodeText = getAttributeValue(node);
  +
               if (nodeText.trim().length() != 0) {
                   addProperty(prefix, nodeText, id);
               }
  
  
  
  1.6       +2 -0      ant/src/testcases/org/apache/tools/ant/taskdefs/XmlPropertyTest.java
  
  Index: XmlPropertyTest.java
  ===================================================================
  RCS file: /home/cvs/ant/src/testcases/org/apache/tools/ant/taskdefs/XmlPropertyTest.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -w -u -r1.5 -r1.6
  --- XmlPropertyTest.java	10 Feb 2003 14:14:45 -0000	1.5
  +++ XmlPropertyTest.java	24 Jun 2003 11:29:20 -0000	1.6
  @@ -90,6 +90,8 @@
           assertEquals("val", 
                        getProject().getProperty("root-tag.inner-tag(someattr)"));
           assertEquals("false", getProject().getProperty("root-tag.a2.a3.a4"));
  +        assertEquals("CDATA failed", 
  +            "<test>", getProject().getProperty("root-tag.cdatatag"));
       }
   
       public void testNone () {
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message