Package org.eigenbase.xom

## Class TextDef

- java.lang.Object
- - org.eigenbase.xom.TextDef

All Implemented Interfaces:
  `NodeDef`

Direct Known Subclasses:
  `CdataDef`, `CommentDef`

    public class TextDef
    extends java.lang.Object
    implements NodeDef

A `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`.

Since:
  5 October, 2001
Version:
  $Id: //open/util/resgen/src/org/eigenbase/xom/TextDef.java#4 $
Author:
  jhyde

### Field Summary

Fields
`(package private) boolean` `asIs` Whether to print the data as is -- never quote as a CDATA section.
`java.lang.String` `s`

### Constructor Summary

Constructors
`TextDef()`
`TextDef​(java.lang.String s)`
`TextDef​(java.lang.String s, boolean asIs)`
`TextDef​(java.lang.String s, boolean asIs, Location location)`
`TextDef​(DOMWrapper _def)`

### Method Summary

All Methods Instance Methods Concrete Methods
`void` `display​(java.io.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.
`java.lang.String` `getName()` Returns the name of this node's tag.
`java.lang.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.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### s

    public java.lang.String s

#### asIs

    boolean asIs

Whether to print the data as is -- never quote as a CDATA section. Useful if the fragment contains a valid XML string.

### Constructor Detail

#### TextDef

    public TextDef()

#### TextDef

    public TextDef​(java.lang.String s)

#### TextDef

    public TextDef​(java.lang.String s,
                   boolean asIs)

#### TextDef

    public TextDef​(java.lang.String s,
                   boolean asIs,
                   Location location)

#### TextDef

    public TextDef​(DOMWrapper _def)
            throws XOMException

Throws:
  `XOMException`

### Method Detail

#### getName

    public java.lang.String getName()

Description copied from interface: `NodeDef`
Returns the name of this node's tag.

Specified by:
  `getName` in interface `NodeDef`

#### getText

    public java.lang.String getText()

Description copied from interface: `NodeDef`
Returns the text inside this node.

Specified by:
  `getText` in interface `NodeDef`

#### getChildren

    public NodeDef[] getChildren()

Description copied from interface: `NodeDef`
Returns the children of this node.

Specified by:
  `getChildren` in interface `NodeDef`

#### getWrapper

    public DOMWrapper getWrapper()

Description copied from interface: `NodeDef`
Retrieves the `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`.

Specified by:
  `getWrapper` in interface `NodeDef`
Returns:
  wrapper underlying this node

#### getType

    public int getType()

Description copied from interface: `NodeDef`
Returns the type of this element. Values are as for `DOMWrapper.getType()`.

Specified by:
  `getType` in interface `NodeDef`

#### display

    public void display​(java.io.PrintWriter pw,
                        int indent)

Description copied from interface: `NodeDef`
Outputs this node to any PrintWriter, in a formatted fashion with automatic indenting.

Specified by:
  `display` in interface `NodeDef`
Parameters:
  `pw` - the PrintWriter to which to write this NodeDef.
  `indent` - the indentation level for the printout.

#### displayXML

    public void displayXML​(XMLOutput out,
                           int indent)

Description copied from interface: `NodeDef`
Outputs this element definition in XML to any XMLOutput.

Specified by:
  `displayXML` in interface `NodeDef`
Parameters:
  `out` - the XMLOutput class to display the XML

#### getLocation

    public Location getLocation()

Description copied from interface: `NodeDef`
Returns the location of this element in its document.

Specified by:
  `getLocation` in interface `NodeDef`
Returns:
  location of this element, or null if location is not available