public class XmlField extends ConfigurableStringTransformer implements CharTransformer
| Modifier and Type | Class and Description |
|---|---|
(package private) static class |
XmlField.ErrorHandler |
protected static class |
XmlField.FormatException |
| Modifier and Type | Field and Description |
|---|---|
static int |
ASCII |
static int |
HTML_BLOCK |
static int |
HTML_BLOCK_BR |
static int |
HTML_BLOCK_BR_NOSURROUNDINGP |
static int |
HTML_BLOCK_LIST |
static int |
HTML_BLOCK_LIST_BR |
static int |
HTML_BLOCK_LIST_BR_NOSURROUNDINGP |
static int |
HTML_BLOCK_LIST_NOSURROUNDINGP |
static int |
HTML_BLOCK_NOSURROUNDINGP |
static int |
HTML_INLINE |
protected static boolean |
LEAVE_NEWLINES |
protected static boolean |
LISTS_INSIDE_P |
protected static boolean |
LISTS_OUTSIDE_P |
protected static boolean |
NO_SECTIONS |
protected static boolean |
NO_SURROUNDING_P |
static int |
POORBODY |
protected static boolean |
REMOVE_NEWLINES |
static int |
RICHBODY |
protected static boolean |
SECTIONS
Constant for use as argument of
handleRich(org.mmbase.util.StringObject, boolean, boolean, boolean) |
protected static boolean |
SURROUNDING_P |
static int |
XHTML |
to| Modifier and Type | Method and Description |
|---|---|
(package private) static void |
cleanupText(StringObject obj)
Removes all new lines and space which are too much.
|
String |
getEncoding()
Returns the encoding that is currently active
|
(package private) static void |
handleEmph(StringObject obj,
char ch,
String tag)
If you want to add a _ in your text, that should be possible too...
|
protected static void |
handleFormat(StringObject obj,
boolean format)
Only escape, clean up.
|
(package private) static void |
handleHeaders(StringObject obj)
Some paragraphs are are really \sections.
|
(package private) static void |
handleList(StringObject obj)
Takes a string object, finds list structures and changes those to XML
|
protected static void |
handleNewlines(StringObject obj) |
(package private) static void |
handleParagraphs(StringObject obj,
boolean leaveExtraNewLines,
boolean surroundingP)
Make
|
(package private) static void |
handleParagraphs(StringObject obj,
boolean leaveExtraNewLines,
boolean surroundingP,
boolean placeListsInsideP)
Make <p> </p> tags.
|
protected static void |
handleRich(StringObject obj,
boolean sections,
boolean leaveExtraNewLines,
boolean surroundingP) |
protected static void |
handleRich(StringObject obj,
boolean sections,
boolean leaveExtraNewLines,
boolean surroundingP,
boolean placeListsInsideP) |
(package private) static void |
handleTables(StringObject obj)
Wikipedia syntax for tables.
|
static String |
poorToHTMLInline(String data)
So poor, that it actually generates pieces of XHTML 1.1 inlines (so, no use of section, br, p).
|
static String |
poorToXML(String data) |
static String |
poorToXML(String data,
boolean format) |
static String |
poorToXML(String data,
boolean format,
boolean placeListsInsideP)
As richToXML but a little less rich.
|
(package private) static void |
preHandleHeaders(StringObject obj)
Makes sure that lines indicating headers (starting with $), are followed by at least 2
newlines, if followed by some list.
|
protected static StringObject |
prepareData(String data) |
protected static String |
prepareDataString(String data) |
static String |
richToHTMLBlock(String data) |
static String |
richToHTMLBlock(String data,
boolean multipibleBrs,
boolean surroundingP) |
static String |
richToHTMLBlock(String data,
boolean multipibleBrs,
boolean surroundingP,
boolean placeListsInsideP)
So poor, that it actually generates pieces of XHTML 1.1 blocks (so, no use of sections).
|
static String |
richToXML(String data) |
static String |
richToXML(String data,
boolean format) |
static String |
richToXML(String data,
boolean format,
boolean placeListsInsideP)
Defines a kind of 'rich' text format.
|
String |
transform(String data) |
String |
transformBack(String r) |
Map<String,Config> |
transformers()
Returns which transformations can be done by an object of this class.
|
protected static void |
validate(String incoming) |
protected static String |
XSLTransform(String xslFile,
String data)
Base function for XSL conversions.
|
configure, toStringtransform, transform, transformBack, transformBackclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waittransform, transform, transformBack, transformBacktoStringpublic static final int POORBODY
public static final int RICHBODY
public static final int HTML_INLINE
public static final int HTML_BLOCK
public static final int HTML_BLOCK_BR
public static final int HTML_BLOCK_NOSURROUNDINGP
public static final int HTML_BLOCK_BR_NOSURROUNDINGP
public static final int HTML_BLOCK_LIST
public static final int HTML_BLOCK_LIST_BR
public static final int HTML_BLOCK_LIST_NOSURROUNDINGP
public static final int HTML_BLOCK_LIST_BR_NOSURROUNDINGP
public static final int ASCII
public static final int XHTML
protected static final boolean SECTIONS
handleRich(org.mmbase.util.StringObject, boolean, boolean, boolean)protected static final boolean NO_SECTIONS
protected static final boolean LEAVE_NEWLINES
protected static final boolean REMOVE_NEWLINES
protected static final boolean SURROUNDING_P
protected static final boolean NO_SURROUNDING_P
protected static final boolean LISTS_INSIDE_P
protected static final boolean LISTS_OUTSIDE_P
static void handleList(StringObject obj)
static void handleEmph(StringObject obj, char ch, String tag)
ch - This is '_' or e.g. '*'tag - The tag to produce, e.g. "em" or "strong"static void preHandleHeaders(StringObject obj)
static void handleHeaders(StringObject obj)
static void handleParagraphs(StringObject obj, boolean leaveExtraNewLines, boolean surroundingP)
tags.
leaveExtraNewLines - (defaults to false) if false, 2 or more newlines starts a new p. If true, every 2 newlines starts new p, and every extra new line simply stays (inside the p).surroundingP - (defaults to true) wether the surrounding <p> should be included too.static void handleParagraphs(StringObject obj, boolean leaveExtraNewLines, boolean surroundingP, boolean placeListsInsideP)
false, the code generated with lists becomes akin to:
<p>...</p><ul>...</ul><p>...</p>
If placeListsInsideP is true, the code becomes:
<p>...<ul>...</ul>...</p>
If there is no content in front of the first list, or after the last list, those paragraphs are empty and may not be
added.leaveExtraNewLines - (defaults to false) if false, 2 or more newlines starts a new p. If true, every 2 newlines starts new p, and every extra new line simply stays (inside the p).surroundingP - (defaults to true) wether the surrounding <p> should be included too.placeListsInsideP - (defaults to false) wether a list should be placed inside a <p> (as allowed by xhtml2).static void handleTables(StringObject obj)
{|
| a || b || c
|-
| d || e || f
|}
or e.g.
{|-
|+ caption
! A !! B !! C
|-
| d
| e
| f
|}
static void cleanupText(StringObject obj)
protected static void handleFormat(StringObject obj, boolean format)
protected static StringObject prepareData(String data)
protected static void handleRich(StringObject obj, boolean sections, boolean leaveExtraNewLines, boolean surroundingP)
protected static void handleRich(StringObject obj, boolean sections, boolean leaveExtraNewLines, boolean surroundingP, boolean placeListsInsideP)
protected static void handleNewlines(StringObject obj)
public static String richToXML(String data, boolean format, boolean placeListsInsideP)
data - text to convertformat - if the resulting XML must be nicely formatted (default: false)public static String poorToXML(String data, boolean format, boolean placeListsInsideP)
public static String richToHTMLBlock(String data, boolean multipibleBrs, boolean surroundingP, boolean placeListsInsideP)
richToXML(java.lang.String, boolean, boolean)public static String richToHTMLBlock(String data, boolean multipibleBrs, boolean surroundingP)
public static String poorToHTMLInline(String data)
protected static String XSLTransform(String xslFile, String data)
protected static void validate(String incoming) throws XmlField.FormatException
XmlField.FormatExceptionpublic Map<String,Config> transformers()
ConfigurableTransformertransformers in interface ConfigurableTransformertransformers in class ConfigurableStringTransformerpublic String transform(String data)
transform in interface CharTransformertransform in class StringTransformerpublic String transformBack(String r)
transformBack in interface CharTransformertransformBack in class StringTransformerpublic String getEncoding()
ConfigurableTransformergetEncoding in interface ConfigurableTransformergetEncoding in class ConfigurableStringTransformerMMBase 1.9-SNAPSHOT - ${javadoctimestamp}