当前位置: 首页>>代码示例>>Java>>正文


Java DifferenceConstants.ATTR_VALUE_ID属性代码示例

本文整理汇总了Java中org.custommonkey.xmlunit.DifferenceConstants.ATTR_VALUE_ID属性的典型用法代码示例。如果您正苦于以下问题:Java DifferenceConstants.ATTR_VALUE_ID属性的具体用法?Java DifferenceConstants.ATTR_VALUE_ID怎么用?Java DifferenceConstants.ATTR_VALUE_ID使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.custommonkey.xmlunit.DifferenceConstants的用法示例。


在下文中一共展示了DifferenceConstants.ATTR_VALUE_ID属性的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: differenceFound

/**
 * Delegates to the nested DifferenceListener unless the
 * Difference is of type {@link DifferenceConstants#ATTR_VALUE_ID
 * ATTR_VALUE_ID}, {@link DifferenceConstants#CDATA_VALUE_ID
 * CDATA_VALUE_ID}, {@link DifferenceConstants#COMMENT_VALUE_ID
 * COMMENT_VALUE_ID} or {@link DifferenceConstants#TEXT_VALUE_ID
 * TEXT_VALUE_ID} - for those special differences {@link
 * #attributeDifference attributeDifference}, {@link
 * #cdataDifference cdataDifference}, {@link #commentDifference
 * commentDifference} or {@link #textDifference textDifference}
 * are invoked respectively.
 */
public int differenceFound(Difference difference) {
    switch (difference.getId()) {
    case DifferenceConstants.ATTR_VALUE_ID:
        return attributeDifference(difference);
    case DifferenceConstants.CDATA_VALUE_ID:
        return cdataDifference(difference);
    case DifferenceConstants.COMMENT_VALUE_ID:
        return commentDifference(difference);
    case DifferenceConstants.TEXT_VALUE_ID:
        return textDifference(difference);
    }
    return delegateTo.differenceFound(difference);
}
 
开发者ID:xmlunit,项目名称:xmlunit,代码行数:25,代码来源:TextDifferenceListenerBase.java

示例2: isCausedByLanguageSettings

/**
 * Ignores all attribute value differences for attributes marked as being language (locale) specific
 * @param difference
 * @return
 */
protected boolean isCausedByLanguageSettings(Difference difference) {
	if (difference.getId() == DifferenceConstants.ATTR_VALUE_ID && 
			languageSpecificAttributes.contains(difference.getControlNodeDetail().getNode().getLocalName())){
		return true;
	}
	return false;
}
 
开发者ID:bpmn-miwg,项目名称:bpmn-miwg-tools,代码行数:12,代码来源:AbstractXmlDifferenceListener.java

示例3: isCausedByCapitalizationOfAttributeValue

/**
 * Checks whether a difference in attribute values is caused by variations in the capitalization of textual representation of the same value
 * Example:
 * 	"true" vs. "TRUE vs. "True"
 * 
 * @param difference
 * @return
 */
protected boolean isCausedByCapitalizationOfAttributeValue(Difference difference) {
	if (difference.getId() == DifferenceConstants.ATTR_VALUE_ID) {
		String testValue = difference.getTestNodeDetail().getValue();
		String controlValue = difference.getControlNodeDetail().getValue();
		
		//check case-insensitive attributes
		String testName = difference.getTestNodeDetail().getNode().getLocalName();
		if (caseInsensitiveAttributes.contains(testName) && testValue.equalsIgnoreCase(controlValue)){
			return true;
		}
	}
	return false;
}
 
开发者ID:bpmn-miwg,项目名称:bpmn-miwg-tools,代码行数:21,代码来源:AbstractXmlDifferenceListener.java

示例4: isCausedByIgnorableDifferingId

/**
 * Editor generates different ids for some attributes.
 * If this difference is caused by such an attribute, the method checks whether the fixed part 
 * corresponds to the common id structure ({@link #REGEXP_ID}) and compares the variable part for equality 
 */
protected boolean isCausedByIgnorableDifferingId(Difference difference) {
	if (difference.getId() == DifferenceConstants.ATTR_VALUE_ID &&
			idsAndIdRefs.contains(difference.getControlNodeDetail().getNode().getLocalName())) {
		
		String controlId = difference.getControlNodeDetail().getValue();
		String testId = difference.getTestNodeDetail().getValue();
		return canDifferingIdBeIgnored(difference, controlId, testId);
	}
	return false;
}
 
开发者ID:bpmn-miwg,项目名称:bpmn-miwg-tools,代码行数:15,代码来源:AbstractXmlDifferenceListener.java

示例5: isCausedByAttribute

protected boolean isCausedByAttribute(Difference difference, boolean isOptional) {
		if (difference.getId() != DifferenceConstants.ATTR_NAME_NOT_FOUND_ID
				&& difference.getId() != DifferenceConstants.ELEMENT_NUM_ATTRIBUTES_ID
				&& difference.getId() != DifferenceConstants.HAS_CHILD_NODES_ID
				&& difference.getId() != DifferenceConstants.ATTR_VALUE_ID) {
			return false;
		}

		// get the nodes that are different
		// don't use 'difference.getControlNodeDetail().getNode()' because it
		// returns a node that is not even equal to ones returned by the xPath
		// parser
		Set<String> attributeSet;
		Node node;
		for (XmlDiffDocumentType type : XmlDiffDocumentType.values()) {// test whether one of
															// the document
															// nodes contains an
															// ignored attribute
			// optional attributes must have same value, if they are set
			if (!isOptional && difference.getId() == DifferenceConstants.ATTR_VALUE_ID) {
				// xpath originally points to the actual attribute node ->
				// remove attribute reference from xpath
				node = helper.getDocumentNode(difference, type, true);
				if (node != null){
//					String attributeName = difference.getControlNodeDetail().getNode().getNodeName();
					String attributeName = XPathUtil.getAttributeNameFromXPath(difference.getControlNodeDetail().getXpathLocation());
                    if (getAttributeSetForNode(node, ignoredAttributesMap)
                            .contains(attributeName)) {
						return true;
					}
				}
			}
			node = helper.getDocumentNode(difference, type, false);
			if (node == null) {
				continue;
			}

			if (isOptional) {
                attributeSet = getAttributeSetForNode(node,
                        optionalAttributesMap);
			} else {
                attributeSet = getAttributeSetForNode(node,
                        ignoredAttributesMap);
			}

			switch (difference.getId()) {
			case DifferenceConstants.ATTR_NAME_NOT_FOUND_ID:
				String attrName = difference.getControlNodeDetail().getValue();
				if (attrName == null || attrName.equals(ATTR_NULL)){
					attrName = difference.getTestNodeDetail().getValue();
					attrName = helper.addNamespacePrefixToAttribute(attrName, difference.getTestNodeDetail().getNode());
				}else{
					attrName = helper.addNamespacePrefixToAttribute(attrName, difference.getControlNodeDetail().getNode());
				}
				if (attributeSet.contains(attrName)) {
					return true;
				}
				break;
			case DifferenceConstants.ELEMENT_NUM_ATTRIBUTES_ID:
			case DifferenceConstants.HAS_CHILD_NODES_ID:
				if (attributeSet.size() > 0) {
					return true;
				}
				if (containsAttributesOfIgnoredNamespaces(node)) {
					return true;
				}
				if (containsIgnorableAttributeValues(node)) {
					return true;
				}
				break;
			}
		}
		return false;
	}
 
开发者ID:bpmn-miwg,项目名称:bpmn-miwg-tools,代码行数:74,代码来源:AbstractXmlDifferenceListener.java


注:本文中的org.custommonkey.xmlunit.DifferenceConstants.ATTR_VALUE_ID属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。