public abstract class DocumentBuilder
extends java.lang.Object
Note that many methods take Attributes
to specify attributes of the element, however most of these methods
may take a more specific subclass of Attributes
.
Modifier and Type | Class and Description |
---|---|
static class |
DocumentBuilder.BlockType |
static class |
DocumentBuilder.SpanType |
Constructor and Description |
---|
DocumentBuilder() |
Modifier and Type | Method and Description |
---|---|
abstract void |
acronym(java.lang.String text,
java.lang.String definition)
Emit an acronym
|
abstract void |
beginBlock(DocumentBuilder.BlockType type,
Attributes attributes)
Begin a block of the specified type.
|
abstract void |
beginDocument()
Begin a document.
|
abstract void |
beginHeading(int level,
Attributes attributes)
Begin a heading of the specified level (usually 1-6).
|
abstract void |
beginSpan(DocumentBuilder.SpanType type,
Attributes attributes)
Begin a span of the specified type.
|
abstract void |
characters(java.lang.String text)
Emit the given text as characters where special characters are encoded according to the output format rules.
|
abstract void |
charactersUnescaped(java.lang.String literal)
Create unescaped characters, usually with some embedded HTML markup.
|
abstract void |
endBlock()
End a block that was
started . |
abstract void |
endDocument()
End a document.
|
abstract void |
endHeading()
End a span that was
started . |
abstract void |
endSpan()
End a span that was
started . |
abstract void |
entityReference(java.lang.String entity)
An XML entity reference.
|
void |
flush()
Flushes the content of the builder.
|
Locator |
getLocator()
The locator for the current session
|
void |
horizontalRule()
Create a horizontal rule (eg: hr in html).
|
abstract void |
image(Attributes attributes,
java.lang.String url)
Build the image with the given attributes
|
abstract void |
imageLink(Attributes linkAttributes,
Attributes imageAttributes,
java.lang.String href,
java.lang.String imageUrl)
Create a hyperlink whose visual representation is an image.
|
void |
imageLink(Attributes attributes,
java.lang.String href,
java.lang.String imageUrl)
Create a hyperlink whose visual representation is an image.
|
void |
imageLink(java.lang.String href,
java.lang.String imageUrl) |
abstract void |
lineBreak()
Create a line break (eg: br in html).
|
abstract void |
link(Attributes attributes,
java.lang.String hrefOrHashName,
java.lang.String text)
Create a hyperlink to the given url.
|
void |
link(java.lang.String hrefOrHashName,
java.lang.String text) |
void |
setLocator(Locator locator)
Set the locator for the current session
|
protected Locator locator
public abstract void beginDocument()
endDocument()
.endDocument()
public void flush()
flush()
should be called when done with a builder in cases where
endDocument()
is not called. Calling flush()
after endDocument()
has no effect.
Subclasses should override to provide behaviour; the default implementation does nothing.
public abstract void endDocument()
beginDocument()
,
flush()
public abstract void beginBlock(DocumentBuilder.BlockType type, Attributes attributes)
Attributes
class, in which case
the builder may attempt to apply the attributes specified. Builders may choose to ignore attributes, and should
fail silently if the given attributes are not as expected. Each call to this method must be matched by a
corresponding call to endBlock()
.type
- attributes
- the attributes to apply to the block. Callers may choose to specify a more specialized set of
attributes by providing a subclass instance.endBlock()
public abstract void endBlock()
started
.public abstract void beginSpan(DocumentBuilder.SpanType type, Attributes attributes)
endSpan()
.type
- attributes
- the attributes to apply to the spanendSpan()
public abstract void endSpan()
started
.#beginSpan(org.eclipse.mylyn.wikitext.parser.DocumentBuilder.SpanType, Attributes)
public abstract void beginHeading(int level, Attributes attributes)
endHeading()
.level
- the level of the heading, usually 1-6attributes
- the attributes to apply to the headingendHeading()
public abstract void endHeading()
started
.beginHeading(int, Attributes)
public abstract void characters(java.lang.String text)
text
- the text to emit.public abstract void entityReference(java.lang.String entity)
entity
- the entitypublic abstract void image(Attributes attributes, java.lang.String url)
attributes
- the attributes, which may be an ImageAttributes
.url
- the URL to the image, possibly relativepublic abstract void link(Attributes attributes, java.lang.String hrefOrHashName, java.lang.String text)
LinkAttributes
are used, the attributes must not have the
href
attribute set.attributes
- the attributes of the linkhrefOrHashName
- the url (which may be internal to the page if prefixed with a hash '#')text
- the text of the hyperlinkpublic abstract void imageLink(Attributes linkAttributes, Attributes imageAttributes, java.lang.String href, java.lang.String imageUrl)
<a href="..."><img src="..."/></a>
. In this case if the attributes define a css class then
the resulting HTML should look like this: <a href="..."><img src="..." class="..."/></a>
linkAttributes
- the attributes of the link, which may be LinkAttributes
imageAttributes
- the attributes of the image , which may be ImageAttributes
href
- the url (which may be internal to the page if prefixed with a hash '#')imageUrl
- the url of the image, which may be relativepublic final void imageLink(Attributes attributes, java.lang.String href, java.lang.String imageUrl)
<a href="..."><img src="..."/></a>
. In this case if the attributes define a css class then
the resulting HTML should look like this: <a href="..."><img src="..." class="..."/></a>
attributes
- the attributes of the image, which may be ImageAttributes
href
- the url (which may be internal to the page if prefixed with a hash '#')imageUrl
- the url of the image, which may be relativeimageLink(Attributes, Attributes, String, String)
public final void link(java.lang.String hrefOrHashName, java.lang.String text)
link(Attributes, String, String)
public final void imageLink(java.lang.String href, java.lang.String imageUrl)
public abstract void acronym(java.lang.String text, java.lang.String definition)
text
- the acronym to emitdefinition
- the definition of the acronym, which is typically displayed on mouse hoverpublic abstract void lineBreak()
public void horizontalRule()
public abstract void charactersUnescaped(java.lang.String literal)
literal
- the literal characters to emitpublic void setLocator(Locator locator)
locator
- the locator that provides information about the current location in the markuppublic Locator getLocator()
Copyright © 2007, 2013 David Green and others.
All rights reserved. This program and the accompanying materials
are made available under the terms of the Eclipse Public License v1.0
which accompanies this distribution, and is available at
http://www.eclipse.org/legal/epl-v10.html