Package net.sf.saxon.functions
Class SaxonDeepEqual
- java.lang.Object
-
- net.sf.saxon.functions.AbstractFunction
-
- net.sf.saxon.functions.SystemFunction
-
- net.sf.saxon.functions.SaxonDeepEqual
-
- All Implemented Interfaces:
Callable
,FunctionItem
,GroundedValue
,Item
,Sequence
public class SaxonDeepEqual extends SystemFunction
Implements the saxon:deep-equal() function, a variant of fn:deep-equal that provides additional control over how the comparison is performed.The specification is as follows:
arg1 The first sequence to be compared
arg2 The second sequence to be compared
collation The collation to be used (null if the default collation is to be used)
flags A string whose characters select options that cause the comparison to vary from the standard fn:deep-equals() function. The flags are:
- N - take namespace nodes into account
- J - join adjacent text nodes (e.g, nodes either side of a comment)
- A - compare type annotations
- C - take comments into account
- F - take namespace prefixes into account
- I - take the is-id() and is-idref() properties into account
- P - take processing instructions into account
- S - compare string values, not typed values
- w - don't take whitespace-only text nodes into account
returns true if the sequences are deep equal, otherwise false
-
-
Field Summary
Fields Modifier and Type Field Description static int
COMPARE_ANNOTATIONS
Flag indicating that elements and attributes must have the same type annotation to be considered deep-equalstatic int
COMPARE_ID_FLAGS
Flag indicating that the is-id and is-idref flags are to be comparedstatic int
COMPARE_STRING_VALUES
Flag indicating that elements and attributes should always be compared according to their string value, not their typed valuestatic int
EXCLUDE_VARIETY
Flag indicating that the variety of the node type is to be ignored (for example, a mixed content node can compare equal to an element-only content nodestatic int
EXCLUDE_WHITESPACE_TEXT_NODES
Flag indicating that whitespace text nodes are ignored when comparing element nodesstatic int
INCLUDE_COMMENTS
Flag indicating that comment children are taken into account when comparing element or document nodesstatic int
INCLUDE_NAMESPACES
Flag indicating that two elements should only be considered equal if they have the same in-scope namespacesstatic int
INCLUDE_PREFIXES
Flag indicating that two element or attribute nodes are considered equal only if their names use the same namespace prefixstatic int
INCLUDE_PROCESSING_INSTRUCTIONS
Flag indicating that processing instruction nodes are taken into account when comparing element or document nodesstatic int
JOIN_ADJACENT_TEXT_NODES
Flag indicating that adjacent text nodes in the top-level sequence are to be mergedstatic int
WARNING_IF_FALSE
Flag indicating that a warning message explaining the reason why the sequences were deemed non-equal should be sent to the ErrorListener
-
Constructor Summary
Constructors Constructor Description SaxonDeepEqual()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description BooleanValue
call(XPathContext context, Sequence[] arguments)
Evaluate this function call at run-timestatic boolean
deepEqual(SequenceIterator op1, SequenceIterator op2, AtomicComparer comparer, XPathContext context, int flags)
Determine when two sequences are deep-equalstatic java.lang.String
deepEquals(NodeInfo n1, NodeInfo n2, AtomicComparer comparer, XPathContext context, int flags)
java.lang.String
getStreamerName()
Get a name that identifies the class that can be used to evaluate this function in streaming mode, that is, supplying one item or event at a time as it is delivered by the parser.-
Methods inherited from class net.sf.saxon.functions.SystemFunction
dependsOnContextItem, dynamicCall, equals, export, exportAdditionalArguments, exportAttributes, fixArguments, getArity, getCardinality, getContextNode, getDescription, getDetails, getElaborator, getErrorCodeForTypeErrors, getFunctionItemType, getFunctionName, getIntegerBounds, getNetCost, getOperandRoles, getRequiredType, getResultItemType, getResultItemType, getRetainedStaticContext, getSpecialProperties, getStaticBaseUriString, getUniStringArg, hashCode, importAttributes, isSequenceVariadic, isTrustedResultType, makeCall, makeFunction, makeFunction40, makeFunctionCall, makeOptimizedFunctionCall, resultIfEmpty, setArity, setDetails, setRetainedStaticContext, supplyTypeInformation, toShortString, toString, typeCheckCaller
-
Methods inherited from class net.sf.saxon.functions.AbstractFunction
atomize, deepEqual40, deepEquals, effectiveBooleanValue, getAnnotations, getUnicodeStringValue, isArray, isMap, makeNewContext, simplify, typeCheck
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface net.sf.saxon.om.FunctionItem
getGenre
-
Methods inherited from interface net.sf.saxon.om.GroundedValue
asIterable, concatenate, containsNode, materialize
-
Methods inherited from interface net.sf.saxon.om.Item
getLength, getStringValue, head, isStreamed, itemAt, iterate, reduce, subsequence
-
Methods inherited from interface net.sf.saxon.om.Sequence
makeRepeatable
-
-
-
-
Field Detail
-
INCLUDE_NAMESPACES
public static final int INCLUDE_NAMESPACES
Flag indicating that two elements should only be considered equal if they have the same in-scope namespaces- See Also:
- Constant Field Values
-
INCLUDE_PREFIXES
public static final int INCLUDE_PREFIXES
Flag indicating that two element or attribute nodes are considered equal only if their names use the same namespace prefix- See Also:
- Constant Field Values
-
INCLUDE_COMMENTS
public static final int INCLUDE_COMMENTS
Flag indicating that comment children are taken into account when comparing element or document nodes- See Also:
- Constant Field Values
-
INCLUDE_PROCESSING_INSTRUCTIONS
public static final int INCLUDE_PROCESSING_INSTRUCTIONS
Flag indicating that processing instruction nodes are taken into account when comparing element or document nodes- See Also:
- Constant Field Values
-
EXCLUDE_WHITESPACE_TEXT_NODES
public static final int EXCLUDE_WHITESPACE_TEXT_NODES
Flag indicating that whitespace text nodes are ignored when comparing element nodes- See Also:
- Constant Field Values
-
COMPARE_STRING_VALUES
public static final int COMPARE_STRING_VALUES
Flag indicating that elements and attributes should always be compared according to their string value, not their typed value- See Also:
- Constant Field Values
-
COMPARE_ANNOTATIONS
public static final int COMPARE_ANNOTATIONS
Flag indicating that elements and attributes must have the same type annotation to be considered deep-equal- See Also:
- Constant Field Values
-
WARNING_IF_FALSE
public static final int WARNING_IF_FALSE
Flag indicating that a warning message explaining the reason why the sequences were deemed non-equal should be sent to the ErrorListener- See Also:
- Constant Field Values
-
JOIN_ADJACENT_TEXT_NODES
public static final int JOIN_ADJACENT_TEXT_NODES
Flag indicating that adjacent text nodes in the top-level sequence are to be merged- See Also:
- Constant Field Values
-
COMPARE_ID_FLAGS
public static final int COMPARE_ID_FLAGS
Flag indicating that the is-id and is-idref flags are to be compared- See Also:
- Constant Field Values
-
EXCLUDE_VARIETY
public static final int EXCLUDE_VARIETY
Flag indicating that the variety of the node type is to be ignored (for example, a mixed content node can compare equal to an element-only content node- See Also:
- Constant Field Values
-
-
Method Detail
-
call
public BooleanValue call(XPathContext context, Sequence[] arguments) throws XPathException
Evaluate this function call at run-time- Parameters:
context
- The XPath dynamic evaluation contextarguments
- The values of the arguments to the function call. Each argument value (which is in general a sequence) is supplied in the form of a sequence.- Returns:
- the results of the function.
- Throws:
XPathException
- if a dynamic error occurs during evaluation of the function. The Saxon run-time code will add information about the error location.
-
deepEqual
public static boolean deepEqual(SequenceIterator op1, SequenceIterator op2, AtomicComparer comparer, XPathContext context, int flags) throws XPathException
Determine when two sequences are deep-equal- Parameters:
op1
- the first sequenceop2
- the second sequencecomparer
- the comparer to be usedcontext
- the XPathContext itemflags
- bit-significant integer giving comparison options. Always zero for standard F+O deep-equals comparison.- Returns:
- true if the sequences are deep-equal
- Throws:
XPathException
- if either sequence contains a function item
-
deepEquals
public static java.lang.String deepEquals(NodeInfo n1, NodeInfo n2, AtomicComparer comparer, XPathContext context, int flags) throws XPathException
- Throws:
XPathException
-
getStreamerName
public java.lang.String getStreamerName()
Description copied from class:SystemFunction
Get a name that identifies the class that can be used to evaluate this function in streaming mode, that is, supplying one item or event at a time as it is delivered by the parser. Special streaming support is generally available in Saxon-EE for all system functions that take a sequence as their argument.- Overrides:
getStreamerName
in classSystemFunction
- Returns:
- a name that identifies a class that supports streamed evaluation of this system
function, or null if no such class is available. The mapping of names to classes is
defined in the Saxon-EE class
StreamerMap
. In non-streaming Saxon editions (HE and PE) the method always returns null.
-
-