[jboss-svn-commits] JBoss Common SVN: r2236 - common-core/trunk/src/main/java/org/jboss/util/xml.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Thu Jan 18 17:26:03 EST 2007


Author: scott.stark at jboss.org
Date: 2007-01-18 17:26:03 -0500 (Thu, 18 Jan 2007)
New Revision: 2236

Modified:
   common-core/trunk/src/main/java/org/jboss/util/xml/DOMUtils.java
Log:
Add public static String getTextContent(Node node, boolean replaceProps)

Modified: common-core/trunk/src/main/java/org/jboss/util/xml/DOMUtils.java
===================================================================
--- common-core/trunk/src/main/java/org/jboss/util/xml/DOMUtils.java	2007-01-16 10:05:09 UTC (rev 2235)
+++ common-core/trunk/src/main/java/org/jboss/util/xml/DOMUtils.java	2007-01-18 22:26:03 UTC (rev 2236)
@@ -37,6 +37,7 @@
 import javax.xml.parsers.ParserConfigurationException;
 
 import org.jboss.logging.Logger;
+import org.jboss.util.StringPropertyReplacer;
 import org.w3c.dom.Attr;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
@@ -385,9 +386,18 @@
     }
 
     /** Get the concatenated text content, or null.
+     * @return getTextContent(node, false).
      */
     public static String getTextContent(Node node)
     {
+       return getTextContent(node, false);
+    }
+    /** Get the concatenated text content, or null.
+     * @param the node to search for TEXT_NODE conent
+     * @param replaceProps flag indicating if ${x} property refs should be replace
+     */
+    public static String getTextContent(Node node, boolean replaceProps)
+    {
         boolean hasTextContent = false;
         StringBuffer buffer = new StringBuffer();
         NodeList nlist = node.getChildNodes();
@@ -400,7 +410,11 @@
                 hasTextContent = true;
             }
         }
-        return (hasTextContent ? buffer.toString() : null);
+        String text = (hasTextContent ? buffer.toString() : null);
+        if ( text != null && replaceProps)
+           text = StringPropertyReplacer.replaceProperties(text);
+
+        return text;
     }
 
     /** Gets the first child element




More information about the jboss-svn-commits mailing list