Package org.apache.wiki.parser

# Class WikiDocument

java.lang.Object
org.jdom2.Document
org.apache.wiki.parser.WikiDocument

All Implemented Interfaces:
  `Serializable`, `Cloneable`, `org.jdom2.NamespaceAware`, `org.jdom2.Parent`

public class WikiDocument extends org.jdom2.Document
Stores the DOM tree of a rendered WikiPage. This class extends the org.jdom.Document to provide some extra metadata specific to JSPWiki.

The document is not stored as metadata in the WikiPage because otherwise it could not be cached separately.

Since:
  2.4
See Also:
  - Serialized Form

## Field Summary

### Fields inherited from class org.jdom2.Document

`baseURI`

## Constructor Summary

Constructors
Constructor
Description
`WikiDocument(org.apache.wiki.api.core.Page page)`
Creates a new WikiDocument for a specific page.

## Method Summary

Modifier and Type
Method
Description
`org.apache.wiki.api.core.Context`
`getContext()`
Returns the wiki context for this document.
`org.apache.wiki.api.core.Page`
`getPage()`
Return the WikiPage for whom this WikiDocument exists.
`String`
`getPageData()`
Returns the wikimarkup used to render this document.
`void`
`setContext(org.apache.wiki.api.core.Context ctx)`
Set the WikiContext in which the WikiDocument is rendered.
`void`
`setPageData(String data)`
Set the WikiMarkup for this document.

### Methods inherited from class org.jdom2.Document

`addContent, addContent, addContent, addContent, canContainContent, clone, cloneContent, detachRootElement, equals, getBaseURI, getContent, getContent, getContent, getContentSize, getDescendants, getDescendants, getDocType, getDocument, getNamespacesInherited, getNamespacesInScope, getNamespacesIntroduced, getParent, getProperty, getRootElement, hashCode, hasRootElement, indexOf, removeContent, removeContent, removeContent, removeContent, setBaseURI, setContent, setContent, setContent, setContent, setDocType, setProperty, setRootElement, toString`

### Methods inherited from class java.lang.Object

`finalize, getClass, notify, notifyAll, wait, wait, wait`

## Constructor Details

### WikiDocument

public WikiDocument(org.apache.wiki.api.core.Page page)
Creates a new WikiDocument for a specific page.

Parameters:
  `page` - The page to which this document refers to.

## Method Details

### setPageData

public void setPageData(String data)
Set the WikiMarkup for this document.

Parameters:
  `data` - The WikiMarkup

### getPageData

public String getPageData()
Returns the wikimarkup used to render this document.

Returns:
  The WikiMarkup

### getPage

public org.apache.wiki.api.core.Page getPage()
Return the WikiPage for whom this WikiDocument exists.

Returns:
  The WikiPage

### setContext

public void setContext(org.apache.wiki.api.core.Context ctx)
Set the WikiContext in which the WikiDocument is rendered. The WikiContext is stored in a WeakReference, which means that it can be garbagecollected away. This is to allow for caching of the WikiDocument without having to carry the WikiContext around for a long time.

Parameters:
  `ctx` - A WikiContext.

### getContext

public org.apache.wiki.api.core.Context getContext()
Returns the wiki context for this document. This method may return `null` if the associated wiki session had previously been garbage-collected.

Returns:
  the wiki context