oracle.security.xmlsec.util
Class DocOrderComparator
java.lang.Object
oracle.security.xmlsec.util.DocOrderComparator
- All Implemented Interfaces:
- java.util.Comparator
- public class DocOrderComparator
- extends java.lang.Object
- implements java.util.Comparator
Comparator for sorting nodes into document order as defined by XPath 1.0, and extended for attributes and namespaces by Canonical XML 1.0.
- Since:
- 2.0
Method Summary |
int |
compare(java.lang.Object o1, java.lang.Object o2)
Compares the two given nodes' document order. |
static int |
compareNodes(org.w3c.dom.Node n1, org.w3c.dom.Node n2)
|
boolean |
equals(java.lang.Object obj)
|
Methods inherited from class java.lang.Object |
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DocOrderComparator
public DocOrderComparator()
- Creates a new
DocOrderComparator
.
compare
public int compare(java.lang.Object o1,
java.lang.Object o2)
- Compares the two given nodes' document order.
-
- Specified by:
compare
in interface java.util.Comparator
-
- Parameters:
o1
- The first Node
to compare.
o2
- The second Node
to compare.
- Returns:
-1
if o1
precedes o2
in document order; returns 0
if they have the same document order; returns 1
if o2
precedes o1
.
- Throws:
java.lang.ClassCastException
- If either o1
or o2
is not an instance of org.w3c.dom.Node
.
java.lang.IllegalArgumentException
- If the two nodes cannot legitimately be compared for document order (e.g., they are not in the same document).
equals
public boolean equals(java.lang.Object obj)
-
- Specified by:
equals
in interface java.util.Comparator
compareNodes
public static int compareNodes(org.w3c.dom.Node n1,
org.w3c.dom.Node n2)
throws XPathException
-
- Throws:
XPathException
Copyright © 2005 , Oracle. All rights reserved.