fix IOUtils and Dom imports
This commit is contained in:
parent
cc7e10fb45
commit
8afacd683e
2 changed files with 29 additions and 2 deletions
|
@ -1,4 +1,12 @@
|
||||||
package de.unibremen.informatik.hets.common.io
|
package de.unibremen.informatik.hets.common.io;
|
||||||
|
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.io.OutputStream;
|
||||||
|
import java.io.Reader;
|
||||||
|
import java.io.Writer;
|
||||||
|
import java.io.StringWriter;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
|
|
||||||
public class IOUtils {
|
public class IOUtils {
|
||||||
private static final int DEFAULT_BUFFER_SIZE = 1024 * 4;
|
private static final int DEFAULT_BUFFER_SIZE = 1024 * 4;
|
||||||
|
|
|
@ -1,4 +1,9 @@
|
||||||
package de.unibremen.informatik.hets.common.xml
|
package de.unibremen.informatik.hets.common.xml;
|
||||||
|
|
||||||
|
import org.w3c.dom.Element;
|
||||||
|
import org.w3c.dom.Node;
|
||||||
|
import org.w3c.dom.NodeList;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
public class Dom {
|
public class Dom {
|
||||||
static {
|
static {
|
||||||
|
@ -8,6 +13,20 @@ public class Dom {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static ArrayList<Element> getChildElements(Node item) {
|
||||||
|
ArrayList<Element> result = new ArrayList<Element>();
|
||||||
|
NodeList list = item.getChildNodes();
|
||||||
|
|
||||||
|
for (int i = 0; i < list.getLength(); i++) {
|
||||||
|
Node child = list.item(i);
|
||||||
|
if (child.getNodeType() == Node.ELEMENT_NODE) {
|
||||||
|
result.add((Element)child);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
public static String getTextContent(Element item) {
|
public static String getTextContent(Element item) {
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
NodeList list = ((Node)item).getChildNodes();
|
NodeList list = ((Node)item).getChildNodes();
|
||||||
|
|
Loading…
Reference in a new issue