JDOM
2.0.5

org.jdom2.output
Enum Format.TextMode

java.lang.Object
  extended by java.lang.Enum<Format.TextMode>
      extended by org.jdom2.output.Format.TextMode
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable<Format.TextMode>
Enclosing class:
Format

public static enum Format.TextMode
extends java.lang.Enum<Format.TextMode>

Class to signify how text should be handled on output. The following table provides details.

Text Mode Resulting behavior.
PRESERVE (Default) All content is printed in the format it was created, no whitespace or line separators are are added or removed.
TRIM_FULL_WHITE Content between tags consisting of all whitespace is not printed. If the content contains even one non-whitespace character, it is all printed verbatim, whitespace and all.
TRIM All leading and trailing whitespace is trimmed.
NORMALIZE Leading and trailing whitespace is trimmed, and any 'internal' whitespace is compressed to a single space.
In most cases textual content is aligned with the surrounding tags (after the appropriate text mode is applied). In the case where the only content between the start and end tags is textual, the start tag, text, and end tag are all printed on the same line. If the document being output already has whitespace, it's wise to turn on TRIM mode so the pre-existing whitespace can be trimmed before adding new whitespace.

When an element has a xml:space attribute with the value of "preserve", all formating is turned off (actually, the TextMode is set to PRESERVE until the element and its contents have been printed. If a nested element contains another xml:space with the value "default" formatting is turned back on for the child element and then off for the remainder of the parent element.

Since:
JDOM2

Enum Constant Summary
NORMALIZE
          Mode for text normalization (left and right trim plus internal whitespace is normalized to a single space.
PRESERVE
          Mode for literal text preservation.
TRIM
          Mode for text trimming (left and right trim).
TRIM_FULL_WHITE
          Mode for text trimming of content consisting of nothing but whitespace but otherwise not changing output.
 
Method Summary
static Format.TextMode valueOf(java.lang.String name)
          Returns the enum constant of this type with the specified name.
static Format.TextMode[] values()
          Returns an array containing the constants of this enum type, in the order they are declared.
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

PRESERVE

public static final Format.TextMode PRESERVE
Mode for literal text preservation.


TRIM

public static final Format.TextMode TRIM
Mode for text trimming (left and right trim).


NORMALIZE

public static final Format.TextMode NORMALIZE
Mode for text normalization (left and right trim plus internal whitespace is normalized to a single space.

See Also:
Element.getTextNormalize()

TRIM_FULL_WHITE

public static final Format.TextMode TRIM_FULL_WHITE
Mode for text trimming of content consisting of nothing but whitespace but otherwise not changing output.

Method Detail

values

public static Format.TextMode[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
for (Format.TextMode c : Format.TextMode.values())
    System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they are declared

valueOf

public static Format.TextMode valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
name - the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
java.lang.NullPointerException - if the argument is null

JDOM
2.0.5

Copyright 2013 Jason Hunter, Brett McLaughlin. All Rights Reserved.