001: /*
002: ******************************************************************
003: Copyright (c) 2001-2007, Jeff Martin, Tim Bacon
004: All rights reserved.
005:
006: Redistribution and use in source and binary forms, with or without
007: modification, are permitted provided that the following conditions
008: are met:
009:
010: * Redistributions of source code must retain the above copyright
011: notice, this list of conditions and the following disclaimer.
012: * Redistributions in binary form must reproduce the above
013: copyright notice, this list of conditions and the following
014: disclaimer in the documentation and/or other materials provided
015: with the distribution.
016: * Neither the name of the xmlunit.sourceforge.net nor the names
017: of its contributors may be used to endorse or promote products
018: derived from this software without specific prior written
019: permission.
020:
021: THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
022: "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
023: LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
024: FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
025: COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
026: INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
027: BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
028: LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
029: CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
030: LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
031: ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
032: POSSIBILITY OF SUCH DAMAGE.
033:
034: ******************************************************************
035: */
036:
037: package org.custommonkey.xmlunit;
038:
039: /**
040: * Constants for describing differences between DOM Nodes.
041: * <br />Examples and more at <a href="http://xmlunit.sourceforge.net"/>xmlunit.sourceforge.net</a>
042: */
043: public interface DifferenceConstants {
044: /** Comparing an implied attribute value against an explicit value */
045: int ATTR_VALUE_EXPLICITLY_SPECIFIED_ID = 1;
046: /** Comparing 2 elements and one has an attribute the other does not */
047: int ATTR_NAME_NOT_FOUND_ID = 2;
048: /** Comparing 2 attributes with the same name but different values */
049: int ATTR_VALUE_ID = 3;
050: /** Comparing 2 attribute lists with the same attributes in different sequence */
051: int ATTR_SEQUENCE_ID = 4;
052: /** Comparing 2 CDATA sections with different values */
053: int CDATA_VALUE_ID = 5;
054: /** Comparing 2 comments with different values */
055: int COMMENT_VALUE_ID = 6;
056: /** Comparing 2 document types with different names */
057: int DOCTYPE_NAME_ID = 7;
058: /** Comparing 2 document types with different public identifiers */
059: int DOCTYPE_PUBLIC_ID_ID = 8;
060: /** Comparing 2 document types with different system identifiers */
061: int DOCTYPE_SYSTEM_ID_ID = 9;
062: /** Comparing 2 elements with different tag names */
063: int ELEMENT_TAG_NAME_ID = 10;
064: /** Comparing 2 elements with different number of attributes */
065: int ELEMENT_NUM_ATTRIBUTES_ID = 11;
066: /** Comparing 2 processing instructions with different targets */
067: int PROCESSING_INSTRUCTION_TARGET_ID = 12;
068: /** Comparing 2 processing instructions with different instructions */
069: int PROCESSING_INSTRUCTION_DATA_ID = 13;
070: /** Comparing 2 different text values */
071: int TEXT_VALUE_ID = 14;
072: /** Comparing 2 nodes with different namespace prefixes */
073: int NAMESPACE_PREFIX_ID = 15;
074: /** Comparing 2 nodes with different namespace URIs */
075: int NAMESPACE_URI_ID = 16;
076: /** Comparing 2 nodes with different node types */
077: int NODE_TYPE_ID = 17;
078: /** Comparing 2 nodes but only one has any children*/
079: int HAS_CHILD_NODES_ID = 18;
080: /** Comparing 2 nodes with different numbers of children */
081: int CHILD_NODELIST_LENGTH_ID = 19;
082: /** Comparing 2 nodes with children whose nodes are in different sequence*/
083: int CHILD_NODELIST_SEQUENCE_ID = 20;
084: /** Comparing 2 Documents only one of which has a doctype */
085: int HAS_DOCTYPE_DECLARATION_ID = 21;
086: /** Comparing 2 nodes and one holds more childnodes than can be
087: * matched against child nodes of the other. */
088: int CHILD_NODE_NOT_FOUND_ID = 22;
089: /** Comparing 2 nodes with different xsi:schemaLocation
090: * attributes, potentially only one of the two provides such an
091: * attribute at all.
092: */
093: int SCHEMA_LOCATION_ID = 23;
094: /** Comparing 2 nodes with different xsi:noNamespaceSchemaLocation
095: * attributes, potentially only one of the two provides such an
096: * attribute at all.
097: */
098: int NO_NAMESPACE_SCHEMA_LOCATION_ID = 24;
099:
100: /** Comparing an implied attribute value against an explicit value */
101: public static final Difference ATTR_VALUE_EXPLICITLY_SPECIFIED = new Difference(
102: ATTR_VALUE_EXPLICITLY_SPECIFIED_ID,
103: "attribute value explicitly specified", true);
104:
105: /** Comparing 2 elements and one has an attribute the other does not */
106: public static final Difference ATTR_NAME_NOT_FOUND = new Difference(
107: ATTR_NAME_NOT_FOUND_ID, "attribute name");
108:
109: /** Comparing 2 attributes with the same name but different values */
110: public static final Difference ATTR_VALUE = new Difference(
111: ATTR_VALUE_ID, "attribute value");
112:
113: /** Comparing 2 attribute lists with the same attributes in different sequence */
114: public static final Difference ATTR_SEQUENCE = new Difference(
115: ATTR_SEQUENCE_ID, "sequence of attributes", true);
116:
117: /** Comparing 2 CDATA sections with different values */
118: public static final Difference CDATA_VALUE = new Difference(
119: CDATA_VALUE_ID, "CDATA section value");
120:
121: /** Comparing 2 comments with different values */
122: public static final Difference COMMENT_VALUE = new Difference(
123: COMMENT_VALUE_ID, "comment value");
124:
125: /** Comparing 2 document types with different names */
126: public static final Difference DOCTYPE_NAME = new Difference(
127: DOCTYPE_NAME_ID, "doctype name");
128:
129: /** Comparing 2 document types with different public identifiers */
130: public static final Difference DOCTYPE_PUBLIC_ID = new Difference(
131: DOCTYPE_PUBLIC_ID_ID, "doctype public identifier");
132:
133: /** Comparing 2 document types with different system identifiers */
134: public static final Difference DOCTYPE_SYSTEM_ID = new Difference(
135: DOCTYPE_SYSTEM_ID_ID, "doctype system identifier", true);
136:
137: /** Comparing 2 elements with different tag names */
138: public static final Difference ELEMENT_TAG_NAME = new Difference(
139: ELEMENT_TAG_NAME_ID, "element tag name");
140:
141: /** Comparing 2 elements with different number of attributes */
142: public static final Difference ELEMENT_NUM_ATTRIBUTES = new Difference(
143: ELEMENT_NUM_ATTRIBUTES_ID, "number of element attributes");
144:
145: /** Comparing 2 processing instructions with different targets */
146: public static final Difference PROCESSING_INSTRUCTION_TARGET = new Difference(
147: PROCESSING_INSTRUCTION_TARGET_ID,
148: "processing instruction target");
149:
150: /** Comparing 2 processing instructions with different instructions */
151: public static final Difference PROCESSING_INSTRUCTION_DATA = new Difference(
152: PROCESSING_INSTRUCTION_DATA_ID,
153: "processing instruction data");
154:
155: /** Comparing 2 different text values */
156: public static final Difference TEXT_VALUE = new Difference(
157: TEXT_VALUE_ID, "text value");
158:
159: /** Comparing 2 nodes with different namespace prefixes */
160: public static final Difference NAMESPACE_PREFIX = new Difference(
161: NAMESPACE_PREFIX_ID, "namespace prefix", true);
162:
163: /** Comparing 2 nodes with different namespace URIs */
164: public static final Difference NAMESPACE_URI = new Difference(
165: NAMESPACE_URI_ID, "namespace URI");
166:
167: /** Comparing 2 nodes with different node types */
168: public static final Difference NODE_TYPE = new Difference(
169: NODE_TYPE_ID, "node type");
170:
171: /** Comparing 2 nodes but only one has any children*/
172: public static final Difference HAS_CHILD_NODES = new Difference(
173: HAS_CHILD_NODES_ID, "presence of child nodes to be");
174:
175: /** Comparing 2 nodes with different numbers of children */
176: public static final Difference CHILD_NODELIST_LENGTH = new Difference(
177: CHILD_NODELIST_LENGTH_ID, "number of child nodes");
178:
179: /** Comparing 2 nodes with children whose nodes are in different sequence*/
180: public static final Difference CHILD_NODELIST_SEQUENCE = new Difference(
181: CHILD_NODELIST_SEQUENCE_ID, "sequence of child nodes", true);
182:
183: /** Comparing 2 Documents only one of which has a doctype */
184: public static final Difference HAS_DOCTYPE_DECLARATION = new Difference(
185: HAS_DOCTYPE_DECLARATION_ID,
186: "presence of doctype declaration", true);
187:
188: /** Comparing 2 nodes and one holds more childnodes than can be
189: * matched against child nodes of the other. */
190: public static final Difference CHILD_NODE_NOT_FOUND = new Difference(
191: CHILD_NODE_NOT_FOUND_ID, "presence of child node");
192:
193: /** Comparing 2 nodes with different xsi:schemaLocation
194: * attributes, potentially only one of the two provides such an
195: * attribute at all.
196: */
197: public static final Difference SCHEMA_LOCATION = new Difference(
198: SCHEMA_LOCATION_ID, "xsi:schemaLocation attribute", true);
199: /** Comparing 2 nodes with different xsi:noNamespaceSchemaLocation
200: * attributes, potentially only one of the two provides such an
201: * attribute at all.
202: */
203: public static final Difference NO_NAMESPACE_SCHEMA_LOCATION = new Difference(
204: NO_NAMESPACE_SCHEMA_LOCATION_ID,
205: "xsi:noNamespaceSchemaLocation attribute", true);
206: }
|