+ assertEquals(
+ aMsg + "/" + aExpected.getDocumentElement().getLocalName(),
+ aExpected.getDocumentElement(), aActual.getDocumentElement());
+ }
+
+ private static <T> List<T> convertMap(NamedNodeMap aMap, Class<T> aType) {
+ List<T> result = new ArrayList<T>();
+ for (int i = 0; i < aMap.getLength(); i++) {
+ result.add((T) aMap.item(i));
+ }
+ return result;
+ }
+
+ private static List<Element> getChildElements(Element aElement) {
+ List<Element> result = new ArrayList<Element>();
+ NodeList children = aElement.getChildNodes();
+ for (int i = 0; i < children.getLength(); i++) {
+ Node node = children.item(i);
+ if (node instanceof Element) {
+ result.add((Element) node);
+ }
+ }
+ return result;
+ }
+
+ private static String getDirectText(Element aElement) {
+ String res = "";
+ NodeList children = aElement.getChildNodes();
+ for (int i = 0; i < children.getLength(); i++) {
+ Node node = children.item(i);
+ if (node instanceof Text) {
+ res += node.getTextContent() + " ";
+ }
+ }
+ return trim(res);
+ }
+
+ private static String trim(String aText) {
+ return aText.trim().replaceAll("\\n", " ").replaceAll("\\s+", " ");