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 | |
|
9 | |
|
10 | 0 | public class XMLUtil { |
11 | |
|
12 | |
|
13 | |
|
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 | |
} |