org.eigenbase.xom
Class TextDef

java.lang.Object
  extended by org.eigenbase.xom.TextDef
All Implemented Interfaces:
NodeDef
Direct Known Subclasses:
CdataDef, CommentDef

public class TextDef
extends 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
Author:
jhyde
 

Field Summary
(package private)  boolean asIs
          Whether to print the data as is -- never quote as a CDATA section.
 String s
           
 
Constructor Summary
TextDef()
           
TextDef(DOMWrapper _def)
           
TextDef(String s)
           
TextDef(String s, boolean asIs)
           
TextDef(String s, boolean asIs, Location location)
           
 
Method Summary
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

s

public 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(String s)

TextDef

public TextDef(String s,
               boolean asIs)

TextDef

public TextDef(String s,
               boolean asIs,
               Location location)

TextDef

public TextDef(DOMWrapper _def)
        throws XOMException
Throws:
XOMException
Method Detail

getName

public String getName()
Description copied from interface: NodeDef
Returns the name of this node's tag.

Specified by:
getName in interface NodeDef

getText

public 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.FullDefinition.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(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

SourceForge.net_Logo