Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.xmlbeans
Class XmlCursor.XmlBookmark

    java.lang.Object
      org.apache.xmlbeans.XmlCursor.XmlBookmark

Direct Known Subclasses:
  CDataBookmark, SchemaBookmark, XmlLineNumber

Enclosing interface:
  XmlCursor

    public abstract static class XmlCursor.XmlBookmark

extends java.lang.Object

Subclasses of XmlBookmark can be used to annotate an XML document. This class is abstract to prevent parties from inadvertently interfering with each others' bookmarks without explicitly sharing a bookmark class.

Field Summary
`XmlCursor.XmlMark` | `_currentMark` The mark is set by the host document; it is capable of returning an XmlCursor implementation at the location of the bookmark.
`java.lang.ref.Reference` | `_ref` If non-null, the ref is used by the host document to maintain a reference to the bookmark.

Constructor Summary
`XmlCursor.XmlBookmark()` Constructs a strongly-referenced bookmark.
`XmlCursor.XmlBookmark(boolean weak)` Constructs a bookmark.

Method Summary
`XmlCursor` | `createCursor()` Call the createCursor method to create a new cursor which is positioned at the same splace as the bookmark.
`java.lang.Object` | `getKey()` The default key for bookmarks is the class which implements them.
`XmlCursor` | `toBookmark(XmlCursor c)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### _currentMark

    public XmlCursor.XmlMark _currentMark

  The mark is set by the host document; it is capable of returning an XmlCursor implementation at the location of the bookmark.

### _ref

    public final java.lang.ref.Reference _ref

  If non-null, the ref is used by the host document to maintain a reference to the bookmark. If it is a weak reference, the host document will not prevent the Bookmark from being garbage collected.

Constructor Detail

### XmlCursor.XmlBookmark

    public XmlCursor.XmlBookmark()

  Constructs a strongly-referenced bookmark.

### XmlCursor.XmlBookmark

    public XmlCursor.XmlBookmark(boolean weak)

  Constructs a bookmark.

  Parameters:
    `weak` - true if the document's reference to the bookmark should be a WeakReference

Method Detail

### createCursor

    public final XmlCursor createCursor()

  Call the createCursor method to create a new cursor which is positioned at the same splace as the bookmark. It is much more efficient to call toBookmark on an existing cursor than it is to create a new cursor. However, toBookmark may fail if the bookmark is in a different document than the cursor. It is under these circumstances where createCursor needs to be called on the bookmark. Subsequent navigations to bookmark positions should attempt to reuse the last cursor to improve performace.

  Returns:
    the new cursor

### toBookmark

    public final XmlCursor toBookmark(XmlCursor c)

  Parameters:
    `c` - the cursor to be moved
  Returns:
    the given cursor moved to this bookmark

### getKey

    public java.lang.Object getKey()

  The default key for bookmarks is the class which implements them. This way, multiple parties using bookmarks in the same instance document will not interfere with eachother. One can, however, override getKey() to use a key other than the class.

  Returns:
    default key for bookmarks

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD