本文整理汇总了Java中org.custommonkey.xmlunit.Difference.getControlNodeDetail方法的典型用法代码示例。如果您正苦于以下问题:Java Difference.getControlNodeDetail方法的具体用法?Java Difference.getControlNodeDetail怎么用?Java Difference.getControlNodeDetail使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.custommonkey.xmlunit.Difference
的用法示例。
在下文中一共展示了Difference.getControlNodeDetail方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: differenceFound
import org.custommonkey.xmlunit.Difference; //导入方法依赖的package包/类
@Override
public int differenceFound(Difference difference) {
if (difference.getControlNodeDetail() == null
|| difference.getControlNodeDetail().getNode() == null
|| difference.getTestNodeDetail() == null
|| difference.getTestNodeDetail().getNode() == null) {
return RETURN_ACCEPT_DIFFERENCE;
}
if (ignoreAttributes.contains(difference.getTestNodeDetail().getNode()
.getNodeName())
|| ignoreAttributes.contains(difference.getControlNodeDetail()
.getNode().getNodeName())) {
return RETURN_IGNORE_DIFFERENCE_NODES_IDENTICAL;
}
return RETURN_ACCEPT_DIFFERENCE;
}
示例2: differentTextNotInScript
import org.custommonkey.xmlunit.Difference; //导入方法依赖的package包/类
/**
* Checks this heuristic: if a modified text is not in a script, consider it a false difference.
* This difference was introduced after finding an injection on the content of an existing script.
* Most of "modified text" differences are harmless and occur on span elements
*/
static boolean differentTextNotInScript(Difference difference) {
if (difference.getId() == 14) {
NodeDetail controlNode = difference.getControlNodeDetail();
NodeDetail testNode = difference.getTestNodeDetail();
String parentName = "script";
return checkNodeNotInParent(controlNode, parentName)
|| checkNodeNotInParent(testNode, parentName);
}
return false;
}
示例3: onBlacklistedElement
import org.custommonkey.xmlunit.Difference; //导入方法依赖的package包/类
/**
* Checks this heuristic: if a keyword that usually appears alongside a false difference is found
* as the name (value) of an added element or as the last element in the xpath, the difference is
* handled as false. This happens in particular with formatting elements.
*/
static boolean onBlacklistedElement(Difference difference) {
NodeDetail controlNode = difference.getControlNodeDetail();
NodeDetail testNode = difference.getTestNodeDetail();
String[] blacklistedKeywords =
{"style", "class", "width", "height", "sizset", "sizcache", "alt"};
return checkBlacklistedElement(controlNode, blacklistedKeywords)
|| checkBlacklistedElement(testNode, blacklistedKeywords);
}
示例4: dump
import org.custommonkey.xmlunit.Difference; //导入方法依赖的package包/类
@Override
public void dump (int id,
Difference difference)
{
print(String.format("%4d ", id));
print(difference.isRecoverable() ? "REC " : " ");
println(difference.toString());
NodeDetail controlDetail = difference.getControlNodeDetail();
Node controlNode = controlDetail.getNode();
String controlValue = stringOf(controlNode);
if (controlValue != null) {
println(" ctrl"
+ PositionalXMLReader.getRef(controlNode)
+ " " + controlValue);
}
NodeDetail testDetail = difference.getTestNodeDetail();
Node testNode = testDetail.getNode();
String testValue = stringOf(testNode);
if (testValue != null) {
println(" test"
+ PositionalXMLReader.getRef(testNode)
+ " " + testValue);
}
}
示例5: isCausedByIgnorableAttributeValue
import org.custommonkey.xmlunit.Difference; //导入方法依赖的package包/类
/**
* Server renderer removes all attributes with no values, client renderer doesn't always do this ->
* ignore missing attributes if they don't have a value.
* Also ignores missing transform attributes, when editor generates a "transform='translate(0)'"
* @param difference
* @return
*/
protected boolean isCausedByIgnorableAttributeValue(Difference difference) {
if (difference.getId() == DifferenceConstants.ATTR_NAME_NOT_FOUND_ID) {
//name is the same for both
NodeDetail detail = difference.getControlNodeDetail();
XmlDiffDocumentType type;
if (detail.getValue() == null || detail.getValue().equals(ATTR_NULL)) {
type = XmlDiffDocumentType.TEST;
detail = difference.getTestNodeDetail();
} else {
type = XmlDiffDocumentType.CONTROL;
detail = difference.getControlNodeDetail();
}
String attrName = detail.getValue();
if (attrName != null) {
attrName = helper.addNamespacePrefixToAttribute(attrName, detail.getNode());
Node attrNode = detail.getNode().getAttributes().getNamedItem(attrName);
String attrValue = (attrNode == null)? null : attrNode.getNodeValue();
if (canAttributeBeIgnored(attrName, attrValue)) {
Node node = helper.getDocumentNode(difference, type, false);
getAttributeSetForNode(node, ignoredAttributesMap).add(
attrName);
return true;
}
}
}
return false;
}