Coverage Report - liquibase.util.XMLUtil
 
Classes in this File Line Coverage Branch Coverage Complexity
XMLUtil
0%
0/8
0%
0/4
3
 
 1  
 package liquibase.util;
 2  
 
 3  
 import org.w3c.dom.Node;
 4  
 import org.w3c.dom.NodeList;
 5  
 import org.w3c.dom.Text;
 6  
 
 7  
 /**
 8  
  * Various utility methods for working with XML.
 9  
  */
 10  0
 public class XMLUtil {
 11  
     /**
 12  
      * Extracts the text from the given element. Element.getTextContet() is java5 specific, so we need to use this until
 13  
      * we drop 1.4 support.
 14  
      */
 15  
     public static String getTextContent(Node element) {
 16  0
         StringBuffer text = new StringBuffer();
 17  0
         NodeList childNodes = element.getChildNodes();
 18  0
         for (int i = 0; i < childNodes.getLength(); i++) {
 19  0
             Node child = childNodes.item(i);
 20  0
             if (child instanceof Text) {
 21  0
                 text.append(child.getNodeValue());
 22  
             }
 23  
         }
 24  
 
 25  0
         return text.toString();
 26  
     }
 27  
 }