Name
compareDocumentPosition: other(3)
Synopsis
Compares the relative position of the node on which
the method is invoked with the position of the other
node. The return value is a bit
mask that indicates the relative position between the two nodes in
document order. The following table lists the bit mask members and
their meanings:
Constant name | Value | Meaning |
DOCUMENT_POSITION_DISCONNECTED | 0x01 | The two nodes are disconnected (do not share a common container ancestor) and cannot be compared. |
DOCUMENT_POSITION_PRECEDING | 0x02 | The |
DOCUMENT_POSITION_FOLLOWING | 0x04 | The |
DOCUMENT_POSITION_CONTAINS | 0x08 | The |
DOCUMENT_POSITION_CONTAINED_BY | 0x010 | The |
DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC | 0x020 | The relative positions are implementation-specific, such as in the case of disconnected nodes. |
Argument
- other: Node
The other node to use in the position comparison.
Exception
- NOT_SUPPORTED_ERR
Raised if the two nodes are from incompatible DOM implementations and their relative positions cannot be determined.
Java binding
public static final short DOCUMENT_POSITION_DISCONNECTED = 0x01; public static final short DOCUMENT_POSITION_PRECEDING = 0x02; public static final short DOCUMENT_POSITION_FOLLOWING = 0x04; public static final short DOCUMENT_POSITION_CONTAINS = 0x08; public static final short DOCUMENT_POSITION_CONTAINED_BY = 0x10; public static final short ...
Get XML in a Nutshell, 3rd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.