Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

org.w3c.dom.CDATASection extends org.w3c.dom.Text, so remove instance… #171

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -16,7 +16,6 @@
import java.util.AbstractMap;
import java.util.Map;

import org.w3c.dom.CDATASection;
import org.w3c.dom.Element;
import org.w3c.dom.Text;
import org.w3c.dom.Node;
Expand Down Expand Up @@ -113,7 +112,7 @@ private static Map.Entry<Integer, Node> findNonText(NodeList nl, int current, in
}

private static boolean isText(Node n) {
return n instanceof Text || n instanceof CDATASection;
return n instanceof Text;
}

}
Expand Down
Expand Up @@ -13,7 +13,6 @@
*/
package org.xmlunit.diff;

import org.w3c.dom.CDATASection;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.Text;
Expand Down Expand Up @@ -110,6 +109,6 @@ private Node getFirstEligibleChild(Node parent) {
}

private static boolean isText(Node n) {
return n instanceof Text || n instanceof CDATASection;
return n instanceof Text;
}
}
7 changes: 3 additions & 4 deletions xmlunit-core/src/main/java/org/xmlunit/util/Nodes.java
Expand Up @@ -20,7 +20,6 @@
import javax.xml.XMLConstants;
import javax.xml.namespace.QName;
import org.w3c.dom.Attr;
import org.w3c.dom.CDATASection;
import org.w3c.dom.CharacterData;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
Expand Down Expand Up @@ -58,7 +57,7 @@ public static QName getQName(Node n) {
public static String getMergedNestedText(Node n) {
StringBuilder sb = new StringBuilder();
for (Node child : new IterableNodeList(n.getChildNodes())) {
if (child instanceof Text || child instanceof CDATASection) {
if (child instanceof Text) {
String s = child.getNodeValue();
if (s != null) {
sb.append(s);
Expand Down Expand Up @@ -148,7 +147,7 @@ private static void handleWsRec(Node n, boolean normalize) {
for (Node child : new IterableNodeList(n.getChildNodes())) {
handleWsRec(child, normalize);
if (!(n instanceof Attr)
&& (child instanceof Text || child instanceof CDATASection)
&& (child instanceof Text)
&& child.getNodeValue().length() == 0) {
toRemove.add(child);
}
Expand Down Expand Up @@ -200,7 +199,7 @@ private static void stripECW(Node n) {
for (Node child : new IterableNodeList(n.getChildNodes())) {
stripECW(child);
if (!(n instanceof Attr)
&& (child instanceof Text || child instanceof CDATASection)
&& (child instanceof Text)
&& child.getNodeValue().trim().length() == 0) {
toRemove.add(child);
}
Expand Down