public class TextDef extends Object implements NodeDef
TextDef
represents piece of textual data in an XML document.
Free text (such as Some text
) is represented by an actual
TextDef
; comments (such as <-- a comment -->
)
by derived class CommentDef
; and CDATA sections (such as
<![CDATA[Some text]]>
) by derived class CdataDef
.Modifier and Type | Field and Description |
---|---|
(package private) boolean |
asIs
Whether to print the data as is -- never quote as a CDATA
section.
|
String |
s |
Constructor and Description |
---|
TextDef() |
TextDef(DOMWrapper _def) |
TextDef(String s) |
TextDef(String s,
boolean asIs) |
TextDef(String s,
boolean asIs,
Location location) |
Modifier and Type | Method and Description |
---|---|
void |
display(PrintWriter pw,
int indent)
Outputs this node to any PrintWriter,
in a formatted fashion with automatic indenting.
|
void |
displayXML(XMLOutput out,
int indent)
Outputs this element definition in XML to any XMLOutput.
|
NodeDef[] |
getChildren()
Returns the children of this node.
|
Location |
getLocation()
Returns the location of this element in its document.
|
String |
getName()
Returns the name of this node's tag.
|
String |
getText()
Returns the text inside this node.
|
int |
getType()
Returns the type of this element.
|
DOMWrapper |
getWrapper()
Retrieves the
DOMWrapper which was used to create this
node. |
boolean asIs
public TextDef()
public TextDef(DOMWrapper _def) throws XOMException
XOMException
public String getName()
NodeDef
public String getText()
NodeDef
public NodeDef[] getChildren()
NodeDef
getChildren
in interface NodeDef
public DOMWrapper getWrapper()
NodeDef
DOMWrapper
which was used to create this
node. Only works if this nodes's MetaDef.Element.keepDef
was
true (or, if it is not set, if the default
MetaDef.Model.defaultKeepDef
is true);
otherwise, returns null
.getWrapper
in interface NodeDef
public int getType()
NodeDef
DOMWrapper.getType()
.public void display(PrintWriter pw, int indent)
NodeDef
public void displayXML(XMLOutput out, int indent)
NodeDef
displayXML
in interface NodeDef
out
- the XMLOutput class to display the XMLpublic Location getLocation()
NodeDef
getLocation
in interface NodeDef