org.mmbase.util.transformers
Class XmlField

java.lang.Object
  extended byorg.mmbase.util.transformers.StringTransformer
      extended byorg.mmbase.util.transformers.ConfigurableStringTransformer
          extended byorg.mmbase.util.transformers.XmlField
All Implemented Interfaces:
CharTransformer, ConfigurableTransformer, Transformer

public class XmlField
extends ConfigurableStringTransformer
implements CharTransformer

XMLFields in MMBase. This class can encode such a field to several other formats.

Version:
$Id: XmlField.java,v 1.21.2.3 2004/06/04 08:18:54 michiel Exp $
Author:
Michiel Meeuwissen
To Do:
THIS CLASS NEEDS A CONCEPT! It gets a bit messy.

Field Summary
static int ASCII
           
static int BODY
           
static int HTML_BLOCK
           
static int HTML_BLOCK_BR
           
static int HTML_BLOCK_BR_NOSURROUNDINGP
           
static int HTML_BLOCK_NOSURROUNDINGP
           
static int HTML_INLINE
           
static int POOR
           
static int POORBODY
           
static int RICH
           
static int RICHBODY
           
static int XHTML
           
static int XML
           
 
Fields inherited from class org.mmbase.util.transformers.ConfigurableStringTransformer
to
 
Constructor Summary
XmlField()
           
 
Method Summary
 java.lang.String getEncoding()
          Returns the encoding that is currently active
static boolean isXmlEncoded(java.lang.String s)
           
static java.lang.String poorToHTMLInline(java.lang.String data)
          So poor, that it actually generates pieces of XHTML 1.1 inlines (so, no use of section, br, p).
static java.lang.String poorToXML(java.lang.String data)
           
static java.lang.String poorToXML(java.lang.String data, boolean format)
          As richToXML but a little less rich.
static java.lang.String richToHTMLBlock(java.lang.String data)
           
static java.lang.String richToHTMLBlock(java.lang.String data, boolean multipibleBrs, boolean surroundingP)
          So poor, that it actually generates pieces of XHTML 1.1 blocks (so, no use of sections).
static java.lang.String richToXML(java.lang.String data)
           
static java.lang.String richToXML(java.lang.String data, boolean format)
          Defines a kind of 'rich' text format.
 java.lang.String transform(java.lang.String data)
           
 java.lang.String transformBack(java.lang.String r)
           
 java.util.Map transformers()
          Returns which transformations can be done by an object of this class.
 
Methods inherited from class org.mmbase.util.transformers.ConfigurableStringTransformer
configure, toString
 
Methods inherited from class org.mmbase.util.transformers.StringTransformer
transform, transform, transformBack, transformBack
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.mmbase.util.transformers.CharTransformer
transform, transform, transformBack, transformBack
 
Methods inherited from interface org.mmbase.util.transformers.Transformer
toString
 

Field Detail

RICH

public static final int RICH
See Also:
Constant Field Values

POOR

public static final int POOR
See Also:
Constant Field Values

BODY

public static final int BODY
See Also:
Constant Field Values

XML

public static final int XML
See Also:
Constant Field Values

POORBODY

public static final int POORBODY
See Also:
Constant Field Values

RICHBODY

public static final int RICHBODY
See Also:
Constant Field Values

HTML_INLINE

public static final int HTML_INLINE
See Also:
Constant Field Values

HTML_BLOCK

public static final int HTML_BLOCK
See Also:
Constant Field Values

HTML_BLOCK_BR

public static final int HTML_BLOCK_BR
See Also:
Constant Field Values

HTML_BLOCK_NOSURROUNDINGP

public static final int HTML_BLOCK_NOSURROUNDINGP
See Also:
Constant Field Values

HTML_BLOCK_BR_NOSURROUNDINGP

public static final int HTML_BLOCK_BR_NOSURROUNDINGP
See Also:
Constant Field Values

ASCII

public static final int ASCII
See Also:
Constant Field Values

XHTML

public static final int XHTML
See Also:
Constant Field Values
Constructor Detail

XmlField

public XmlField()
Method Detail

isXmlEncoded

public static final boolean isXmlEncoded(java.lang.String s)

richToXML

public static java.lang.String richToXML(java.lang.String data,
                                         boolean format)
Defines a kind of 'rich' text format. This is a way to easily type structured text in XML. The XML tags which can be produced by this are all HTML as well. This is a generalisation of the MMBase html() functions which do similar duties, but hopefully this one is better, and more powerfull too. The following things are recognized: Test with commandline: java org.mmbase.util.Encode RICH_TEXT (reads from STDIN)

Parameters:
data - text to convert
format - if the resulting XML must be nicely formatted (default: false)
Returns:
the converted text

richToXML

public static java.lang.String richToXML(java.lang.String data)

poorToXML

public static java.lang.String poorToXML(java.lang.String data,
                                         boolean format)
As richToXML but a little less rich. Which means that only one new line is non significant.

See Also:
richToXML(java.lang.String, boolean)

poorToXML

public static java.lang.String poorToXML(java.lang.String data)

richToHTMLBlock

public static java.lang.String richToHTMLBlock(java.lang.String data,
                                               boolean multipibleBrs,
                                               boolean surroundingP)
So poor, that it actually generates pieces of XHTML 1.1 blocks (so, no use of sections).

Since:
MMBase-1.7
See Also:
richToXML(java.lang.String, boolean)

richToHTMLBlock

public static java.lang.String richToHTMLBlock(java.lang.String data)

poorToHTMLInline

public static java.lang.String poorToHTMLInline(java.lang.String data)
So poor, that it actually generates pieces of XHTML 1.1 inlines (so, no use of section, br, p).

Since:
MMBase-1.7

transformers

public java.util.Map transformers()
Description copied from interface: ConfigurableTransformer
Returns which transformations can be done by an object of this class.

Specified by:
transformers in interface ConfigurableTransformer
Specified by:
transformers in class ConfigurableStringTransformer

transform

public java.lang.String transform(java.lang.String data)
Specified by:
transform in interface CharTransformer
Specified by:
transform in class StringTransformer

transformBack

public java.lang.String transformBack(java.lang.String r)
Specified by:
transformBack in interface CharTransformer
Overrides:
transformBack in class StringTransformer

getEncoding

public java.lang.String getEncoding()
Description copied from interface: ConfigurableTransformer
Returns the encoding that is currently active

Specified by:
getEncoding in interface ConfigurableTransformer
Specified by:
getEncoding in class ConfigurableStringTransformer


MMBase build 1.7.1.20041002