|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.cdmckay.coffeedom.Content org.cdmckay.coffeedom.Text
public class Text
Character-based XML content. Provides a modular, parentable method of representing text. Text makes no guarantees about the underlying textual representation of character data, but does expose that data as a Java String.
Field Summary | |
---|---|
protected String |
value
The actual character content |
Fields inherited from class org.cdmckay.coffeedom.Content |
---|
parent |
Constructor Summary | |
---|---|
protected |
Text()
This is the protected, no-args constructor standard in all CoffeeDOM classes. |
|
Text(String str)
This constructor creates a new Text node, with the supplied string value as it's character content. |
Method Summary | |
---|---|
void |
append(String str)
This will append character content to whatever content already exists within this Text node. |
void |
append(Text text)
This will append the content of another Text node to this node. |
Text |
clone()
This will return a clone of this Text node, with the same character content, but no parent. |
Text |
detach()
Detaches this child from its parent or does nothing if the child has no parent. |
Element |
getParent()
Return this child's parent, or null if this child is currently not attached. |
String |
getText()
This returns the value of this Text node as a Java String . |
String |
getTextNormalize()
This returns the textual content with all surrounding whitespace removed and internal whitespace normalized to a single space. |
String |
getTextTrim()
This returns the textual content with all surrounding whitespace removed. |
String |
getValue()
Returns the XPath 1.0 string value of this element, which is the text itself. |
static String |
normalizeString(String str)
This returns a new string with all surrounding whitespace removed and internal whitespace normalized to a single space. |
protected Text |
setParent(Parent parent)
Sets the parent of this Content. |
Text |
setText(String str)
This will set the value of this Text node. |
String |
toString()
This returns a String representation of the Text node, suitable for debugging. |
Methods inherited from class org.cdmckay.coffeedom.Content |
---|
equals, getDocument, getParentElement, hashCode |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected String value
Constructor Detail |
---|
protected Text()
public Text(String str)
Text
node, with the supplied string value as it's character content.
str
- the node's character content.
IllegalDataException
- if str
contains an illegal character such as a vertical tab (as
determined by Verifier.checkCharacterData(String)
)Method Detail |
---|
public String getText()
Text
node as a Java String
.
String
- character content of this node.public String getTextTrim()
public String getTextNormalize()
public static String normalizeString(String str)
Per XML 1.0 Production 3 whitespace includes: #x20, #x9, #xD, #xA
str
- string to be normalized.
public Text setText(String str)
Text
node.
str
- value for node's content.
IllegalDataException
- if str
contains an illegal character such as a vertical tab (as
determined by Verifier.checkCharacterData(String)
)public void append(String str)
Text
node.
str
- character content to append.
IllegalDataException
- if str
contains an illegal character such as a vertical tab (as
determined by Verifier.checkCharacterData(String)
)public void append(Text text)
Text
node to this node.
text
- Text node to append.public String getValue()
getValue
in class Content
public Element getParent()
Content
Element
or a Document
.
getParent
in class Content
protected Text setParent(Parent parent)
Content
setParent
in class Content
parent
- new parent element
public Text clone()
Text
node, with the same character content, but no parent.
clone
in class Content
Text
- cloned node.public Text detach()
Content
detach
in class Content
public String toString()
String
representation of the Text
node, suitable for debugging. If the
XML representation of the Text
node is desired, either getText()
or XMLOutputter.outputString(Text)
should be used.
toString
in class Object
String
- information about this node.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |