Top Description Methods
org.jdom2

public Interface JDOMFactory

Known Direct Implementers
org.jdom2.DefaultJDOMFactory
Imports
java.util.*

An interface to be used by builders when constructing JDOM objects. The DefaultJDOMFactory creates the standard top-level JDOM classes (Element, Document, Comment, etc). Another implementation of this factory could be used to create custom classes.
Authors
Ken Rune Holland, Phil Nelson, Bradley S. Huffman, Rolf Lear

Method Summary

Modifier and TypeMethod and Description
public void
addContent(Parent
The Parent to add the content to.
parent
,
Content
The Content to add
content
)

This will add the specified content to the specified parent instance

public void
addNamespaceDeclaration(Element
The Element to add the Namespace to
element
,
Namespace
The Namespace to add.
additional
)

Adds a namespace declaration to an Element

public Attribute

Returns:

the created Attribute instance
attribute
(String
String name of Attribute.
name
,
String
String value for new attribute.
value
,
Namespace
Namespace of the new Attribute
namespace
)

This will create a new Attribute with the specified (local) name and value, and in the provided org.jdom2.Namespace.

public Attribute

Returns:

the created Attribute instance
attribute
(String
String name of Attribute.
name
,
String
String value for new attribute.
value
,
int
int type for new attribute.
type
,
Namespace
Namespace namespace for new attribute.
namespace
)

This will create a new Attribute with the specified (local) name, value, and type, and in the provided org.jdom2.Namespace.
public Attribute

Returns:

the created Attribute instance
attribute
(String
String name of Attribute.
name
,
String
String value for new attribute.
value
,
AttributeType
AttributeType type for new attribute.
type
,
Namespace
Namespace namespace for new attribute.
namespace
)

This will create a new Attribute with the specified (local) name, value, and type, and in the provided org.jdom2.Namespace.

public Attribute

Returns:

the created Attribute instance
attribute
(String
String name of Attribute.
name
,
String
String value for new attribute.
value
)

This will create a new Attribute with the specified (local) name and value, and does not place the attribute in a org.jdom2.Namespace.

public Attribute

Returns:

the created Attribute instance
attribute
(String
String name of Attribute.
name
,
String
String value for new attribute.
value
,
int
int type for new attribute.
type
)

This will create a new Attribute with the specified (local) name, value and type, and does not place the attribute in a org.jdom2.Namespace.
public Attribute

Returns:

the created Attribute instance
attribute
(String
String name of Attribute.
name
,
String
String value for new attribute.
value
,
AttributeType
AttributeType type for new attribute.
type
)

This will create a new Attribute with the specified (local) name, value and type, and does not place the attribute in a org.jdom2.Namespace.

public CDATA

Returns:

the created CDATA instance
cdata
(String
String content of CDATA.
str
)

This creates the CDATA with the supplied text.

public CDATA

Returns:

the created CDATA instance
cdata
(int
The line on which this content begins.
line
,
int
The column on the line at which this content begins.
col
,
String
String content of CDATA.
str
)

This creates the CDATA with the supplied text.

public Comment

Returns:

the created Comment instance
comment
(String
String content of comment.
text
)

This creates the comment with the supplied text.

public Comment

Returns:

the created Comment instance
comment
(int
The line on which this content begins.
line
,
int
The column on the line at which this content begins.
col
,
String
String content of comment.
text
)

This creates the comment with the supplied text.

public DocType

Returns:

the created DocType instance
docType
(String
String name of element being constrained.
elementName
,
String
String public ID of referenced DTD
publicID
,
String
String system ID of referenced DTD
systemID
)

This will create the DocType with the specified element name and a reference to an external DTD.

public DocType

Returns:

the created DocType instance
docType
(String
String name of element being constrained.
elementName
,
String
String system ID of referenced DTD
systemID
)

This will create the DocType with the specified element name and reference to an external DTD.

public DocType

Returns:

the created DocType instance
docType
(String
String name of element being constrained.
elementName
)

This will create the DocType with the specified element name

public DocType

Returns:

the created DocType instance
docType
(int
The line on which this content begins.
line
,
int
The column on the line at which this content begins.
col
,
String
String name of element being constrained.
elementName
,
String
String public ID of referenced DTD
publicID
,
String
String system ID of referenced DTD
systemID
)

This will create the DocType with the specified element name and a reference to an external DTD.

public DocType

Returns:

the created DocType instance
docType
(int
The line on which this content begins.
line
,
int
The column on the line at which this content begins.
col
,
String
String name of element being constrained.
elementName
,
String
String system ID of referenced DTD
systemID
)

This will create the DocType with the specified element name and reference to an external DTD.

public DocType

Returns:

the created DocType instance
docType
(int
The line on which this content begins.
line
,
int
The column on the line at which this content begins.
col
,
String
String name of element being constrained.
elementName
)

This will create the DocType with the specified element name

public Document

Returns:

the created Document instance
document
(Element
Element for document root.
rootElement
,
DocType
DocType declaration.
docType
)

This will create a new Document, with the supplied org.jdom2.Element as the root element and the supplied org.jdom2.DocType declaration.

public Document

Returns:

the created Document instance
document
(Element
Element for document root.
rootElement
,
DocType
DocType declaration.
docType
,
String
the URI from which this document was loaded.
baseURI
)

This will create a new Document, with the supplied org.jdom2.Element as the root element and the supplied org.jdom2.DocType declaration.

public Document

Returns:

the created Document instance
document
(Element
Element for document root
rootElement
)

This will create a new Document, with the supplied org.jdom2.Element as the root element, and no org.jdom2.DocType declaration.

public Element

Returns:

the created Element instance
element
(String
String name of element.
name
,
Namespace
Namespace to put element in.
namespace
)

This will create a new Element with the supplied (local) name, and define the org.jdom2.Namespace to be used.

public Element

Returns:

the created Element instance
element
(String
String name of element.
name
)

This will create an Element in no org.jdom2.Namespace.

public Element

Returns:

the created Element instance
element
(String
String name of element.
name
,
String
String URI for Namespace element should be in.
uri
)

This will create a new Element with the supplied (local) name, and specifies the URI of the org.jdom2.Namespace the Element should be in, resulting it being unprefixed (in the default namespace).

public Element

Returns:

the created Element instance
element
(String
String name of element.
name
,
String
the NamespacePrefic to use for this Element
prefix
,
String
String URI for Namespace element should be in.
uri
)

This will create a new Element with the supplied (local) name, and specifies the prefix and URI of the org.jdom2.Namespace the Element should be in.

public Element

Returns:

the created Element instance
element
(int
The line on which this content begins.
line
,
int
The column on the line at which this content begins.
col
,
String
String name of element.
name
,
Namespace
Namespace to put element in.
namespace
)

This will create a new Element with the supplied (local) name, and define the org.jdom2.Namespace to be used.

public Element

Returns:

the created Element instance
element
(int
The line on which this content begins.
line
,
int
The column on the line at which this content begins.
col
,
String
String name of element.
name
)

This will create an Element in no org.jdom2.Namespace.

public Element

Returns:

the created Element instance
element
(int
The line on which this content begins.
line
,
int
The column on the line at which this content begins.
col
,
String
String name of element.
name
,
String
String URI for Namespace element should be in.
uri
)

This will create a new Element with the supplied (local) name, and specifies the URI of the org.jdom2.Namespace the Element should be in, resulting it being unprefixed (in the default namespace).

public Element

Returns:

the created Element instance
element
(int
The line on which this content begins.
line
,
int
The column on the line at which this content begins.
col
,
String
String name of element.
name
,
String
the NamespacePrefic to use for this Element
prefix
,
String
String URI for Namespace element should be in.
uri
)

This will create a new Element with the supplied (local) name, and specifies the prefix and URI of the org.jdom2.Namespace the Element should be in.

public EntityRef

Returns:

the created EntityRef instance
entityRef
(String
String name of element.
name
)

This will create a new EntityRef with the supplied name.

public EntityRef

Returns:

the created EntityRef instance
entityRef
(String
String name of element.
name
,
String
String public ID of element.
publicID
,
String
String system ID of element.
systemID
)

This will create a new EntityRef with the supplied name, public ID, and system ID.

public EntityRef

Returns:

the created EntityRef instance
entityRef
(String
String name of element.
name
,
String
String system ID of element.
systemID
)

This will create a new EntityRef with the supplied name and system ID.

public EntityRef

Returns:

the created EntityRef instance
entityRef
(int
The line on which this content begins.
line
,
int
The column on the line at which this content begins.
col
,
String
String name of element.
name
)

This will create a new EntityRef with the supplied name.

public EntityRef

Returns:

the created EntityRef instance
entityRef
(int
The line on which this content begins.
line
,
int
The column on the line at which this content begins.
col
,
String
String name of element.
name
,
String
String public ID of element.
publicID
,
String
String system ID of element.
systemID
)

This will create a new EntityRef with the supplied name, public ID, and system ID.

public EntityRef

Returns:

the created EntityRef instance
entityRef
(int
The line on which this content begins.
line
,
int
The column on the line at which this content begins.
col
,
String
String name of element.
name
,
String
String system ID of element.
systemID
)

This will create a new EntityRef with the supplied name and system ID.

public ProcessingInstruction

Returns:

the created ProcessingInstruction instance
processingInstruction
(String
String target of PI.
target
,
Map<String, String>
Map data for PI, in name/value pairs
data
)

This will create a new ProcessingInstruction with the specified target and data.

public ProcessingInstruction

Returns:

the created ProcessingInstruction instance
processingInstruction
(String
String target of PI.
target
,
String
String data for PI.
data
)

This will create a new ProcessingInstruction with the specified target and data.

public ProcessingInstruction

Returns:

the created ProcessingInstruction instance
processingInstruction
(String
String target of PI.
target
)

This will create a new ProcessingInstruction with the specified target and no data.

public ProcessingInstruction

Returns:

the created ProcessingInstruction instance
processingInstruction
(int
The line on which this content begins.
line
,
int
The column on the line at which this content begins.
col
,
String
String target of PI.
target
,
Map<String, String>
Map data for PI, in name/value pairs
data
)

This will create a new ProcessingInstruction with the specified target and data.

public ProcessingInstruction

Returns:

the created ProcessingInstruction instance
processingInstruction
(int
The line on which this content begins.
line
,
int
The column on the line at which this content begins.
col
,
String
String target of PI.
target
,
String
String data for PI.
data
)

This will create a new ProcessingInstruction with the specified target and data.

public ProcessingInstruction

Returns:

the created ProcessingInstruction instance
processingInstruction
(int
The line on which this content begins.
line
,
int
The column on the line at which this content begins.
col
,
String
String target of PI.
target
)

This will create a new ProcessingInstruction with the specified target and no data.

public void
setAttribute(Element
The Element to set the Attribute on
element
,
Attribute
The Attribute to set
a
)

Sets a specific Attribute on an Element

public void
setRoot(Document
The Document to set the Root Element of.
doc
,
Element
The Element to set as the root.
root
)

Sets the 'root' Element for a Document.

public Text

Returns:

the created Text instance
text
(int
The line on which this content begins.
line
,
int
The column on the line at which this content begins.
col
,
String
String content of Text.
str
)

This creates the Text with the supplied text.

public Text

Returns:

the created Text instance
text
(String
String content of Text.
str
)

This creates the Text with the supplied text.

Method Detail

addContentback to summary
public void addContent(Parent parent, Content content)

This will add the specified content to the specified parent instance

Parameters
parent:Parent

The Parent to add the content to.

content:Content

The Content to add

addNamespaceDeclarationback to summary
public void addNamespaceDeclaration(Element element, Namespace additional)

Adds a namespace declaration to an Element

Parameters
element:Element

The Element to add the Namespace to

additional:Namespace

The Namespace to add.

attributeback to summary
public Attribute attribute(String name, String value, Namespace namespace)

This will create a new Attribute with the specified (local) name and value, and in the provided org.jdom2.Namespace.

Parameters
name:String

String name of Attribute.

value:String

String value for new attribute.

namespace:Namespace

Namespace of the new Attribute

Returns:Attribute

the created Attribute instance

attributeback to summary
public Attribute attribute(String name, String value, int type, Namespace namespace)

This will create a new Attribute with the specified (local) name, value, and type, and in the provided org.jdom2.Namespace.

Parameters
name:String

String name of Attribute.

value:String

String value for new attribute.

type:int

int type for new attribute.

namespace:Namespace

Namespace namespace for new attribute.

Returns:Attribute

the created Attribute instance

Annotations
@Deprecated
attributeback to summary
public Attribute attribute(String name, String value, AttributeType type, Namespace namespace)

This will create a new Attribute with the specified (local) name, value, and type, and in the provided org.jdom2.Namespace.

Parameters
name:String

String name of Attribute.

value:String

String value for new attribute.

type:AttributeType

AttributeType type for new attribute.

namespace:Namespace

Namespace namespace for new attribute.

Returns:Attribute

the created Attribute instance

attributeback to summary
public Attribute attribute(String name, String value)

This will create a new Attribute with the specified (local) name and value, and does not place the attribute in a org.jdom2.Namespace.

Note

This actually explicitly puts the Attribute in the "empty" Namespace (org.jdom2.Namespace#NO_NAMESPACE).

Parameters
name:String

String name of Attribute.

value:String

String value for new attribute.

Returns:Attribute

the created Attribute instance

attributeback to summary
public Attribute attribute(String name, String value, int type)

This will create a new Attribute with the specified (local) name, value and type, and does not place the attribute in a org.jdom2.Namespace.

Note

This actually explicitly puts the Attribute in the "empty" Namespace (org.jdom2.Namespace#NO_NAMESPACE).

Parameters
name:String

String name of Attribute.

value:String

String value for new attribute.

type:int

int type for new attribute.

Returns:Attribute

the created Attribute instance

Annotations
@Deprecated
attributeback to summary
public Attribute attribute(String name, String value, AttributeType type)

This will create a new Attribute with the specified (local) name, value and type, and does not place the attribute in a org.jdom2.Namespace.

Note

This actually explicitly puts the Attribute in the "empty" Namespace (org.jdom2.Namespace#NO_NAMESPACE).

Parameters
name:String

String name of Attribute.

value:String

String value for new attribute.

type:AttributeType

AttributeType type for new attribute.

Returns:Attribute

the created Attribute instance

cdataback to summary
public CDATA cdata(String str)

This creates the CDATA with the supplied text.

Parameters
str:String

String content of CDATA.

Returns:CDATA

the created CDATA instance

cdataback to summary
public CDATA cdata(int line, int col, String str)

This creates the CDATA with the supplied text.

Parameters
line:int

The line on which this content begins.

col:int

The column on the line at which this content begins.

str:String

String content of CDATA.

Returns:CDATA

the created CDATA instance

Since
JDOM2
commentback to summary
public Comment comment(String text)

This creates the comment with the supplied text.

Parameters
text:String

String content of comment.

Returns:Comment

the created Comment instance

commentback to summary
public Comment comment(int line, int col, String text)

This creates the comment with the supplied text.

Parameters
line:int

The line on which this content begins.

col:int

The column on the line at which this content begins.

text:String

String content of comment.

Returns:Comment

the created Comment instance

Since
JDOM2
docTypeback to summary
public DocType docType(String elementName, String publicID, String systemID)

This will create the DocType with the specified element name and a reference to an external DTD.

Parameters
elementName:String

String name of element being constrained.

publicID:String

String public ID of referenced DTD

systemID:String

String system ID of referenced DTD

Returns:DocType

the created DocType instance

docTypeback to summary
public DocType docType(String elementName, String systemID)

This will create the DocType with the specified element name and reference to an external DTD.

Parameters
elementName:String

String name of element being constrained.

systemID:String

String system ID of referenced DTD

Returns:DocType

the created DocType instance

docTypeback to summary
public DocType docType(String elementName)

This will create the DocType with the specified element name

Parameters
elementName:String

String name of element being constrained.

Returns:DocType

the created DocType instance

docTypeback to summary
public DocType docType(int line, int col, String elementName, String publicID, String systemID)

This will create the DocType with the specified element name and a reference to an external DTD.

Parameters
line:int

The line on which this content begins.

col:int

The column on the line at which this content begins.

elementName:String

String name of element being constrained.

publicID:String

String public ID of referenced DTD

systemID:String

String system ID of referenced DTD

Returns:DocType

the created DocType instance

Since
JDOM2
docTypeback to summary
public DocType docType(int line, int col, String elementName, String systemID)

This will create the DocType with the specified element name and reference to an external DTD.

Parameters
line:int

The line on which this content begins.

col:int

The column on the line at which this content begins.

elementName:String

String name of element being constrained.

systemID:String

String system ID of referenced DTD

Returns:DocType

the created DocType instance

Since
JDOM2
docTypeback to summary
public DocType docType(int line, int col, String elementName)

This will create the DocType with the specified element name

Parameters
line:int

The line on which this content begins.

col:int

The column on the line at which this content begins.

elementName:String

String name of element being constrained.

Returns:DocType

the created DocType instance

Since
JDOM2
documentback to summary
public Document document(Element rootElement, DocType docType)

This will create a new Document, with the supplied org.jdom2.Element as the root element and the supplied org.jdom2.DocType declaration.

Parameters
rootElement:Element

Element for document root.

docType:DocType

DocType declaration.

Returns:Document

the created Document instance

documentback to summary
public Document document(Element rootElement, DocType docType, String baseURI)

This will create a new Document, with the supplied org.jdom2.Element as the root element and the supplied org.jdom2.DocType declaration.

Parameters
rootElement:Element

Element for document root.

docType:DocType

DocType declaration.

baseURI:String

the URI from which this document was loaded.

Returns:Document

the created Document instance

documentback to summary
public Document document(Element rootElement)

This will create a new Document, with the supplied org.jdom2.Element as the root element, and no org.jdom2.DocType declaration.

Parameters
rootElement:Element

Element for document root

Returns:Document

the created Document instance

elementback to summary
public Element element(String name, Namespace namespace)

This will create a new Element with the supplied (local) name, and define the org.jdom2.Namespace to be used.

Parameters
name:String

String name of element.

namespace:Namespace

Namespace to put element in.

Returns:Element

the created Element instance

elementback to summary
public Element element(String name)

This will create an Element in no org.jdom2.Namespace.

Parameters
name:String

String name of element.

Returns:Element

the created Element instance

elementback to summary
public Element element(String name, String uri)

This will create a new Element with the supplied (local) name, and specifies the URI of the org.jdom2.Namespace the Element should be in, resulting it being unprefixed (in the default namespace).

Parameters
name:String

String name of element.

uri:String

String URI for Namespace element should be in.

Returns:Element

the created Element instance

elementback to summary
public Element element(String name, String prefix, String uri)

This will create a new Element with the supplied (local) name, and specifies the prefix and URI of the org.jdom2.Namespace the Element should be in.

Parameters
name:String

String name of element.

prefix:String

the NamespacePrefic to use for this Element

uri:String

String URI for Namespace element should be in.

Returns:Element

the created Element instance

elementback to summary
public Element element(int line, int col, String name, Namespace namespace)

This will create a new Element with the supplied (local) name, and define the org.jdom2.Namespace to be used.

Parameters
line:int

The line on which this content begins.

col:int

The column on the line at which this content begins.

name:String

String name of element.

namespace:Namespace

Namespace to put element in.

Returns:Element

the created Element instance

Since
JDOM2
elementback to summary
public Element element(int line, int col, String name)

This will create an Element in no org.jdom2.Namespace.

Parameters
line:int

The line on which this content begins.

col:int

The column on the line at which this content begins.

name:String

String name of element.

Returns:Element

the created Element instance

Since
JDOM2
elementback to summary
public Element element(int line, int col, String name, String uri)

This will create a new Element with the supplied (local) name, and specifies the URI of the org.jdom2.Namespace the Element should be in, resulting it being unprefixed (in the default namespace).

Parameters
line:int

The line on which this content begins.

col:int

The column on the line at which this content begins.

name:String

String name of element.

uri:String

String URI for Namespace element should be in.

Returns:Element

the created Element instance

Since
JDOM2
elementback to summary
public Element element(int line, int col, String name, String prefix, String uri)

This will create a new Element with the supplied (local) name, and specifies the prefix and URI of the org.jdom2.Namespace the Element should be in.

Parameters
line:int

The line on which this content begins.

col:int

The column on the line at which this content begins.

name:String

String name of element.

prefix:String

the NamespacePrefic to use for this Element

uri:String

String URI for Namespace element should be in.

Returns:Element

the created Element instance

Since
JDOM2
entityRefback to summary
public EntityRef entityRef(String name)

This will create a new EntityRef with the supplied name.

Parameters
name:String

String name of element.

Returns:EntityRef

the created EntityRef instance

entityRefback to summary
public EntityRef entityRef(String name, String publicID, String systemID)

This will create a new EntityRef with the supplied name, public ID, and system ID.

Parameters
name:String

String name of element.

publicID:String

String public ID of element.

systemID:String

String system ID of element.

Returns:EntityRef

the created EntityRef instance

entityRefback to summary
public EntityRef entityRef(String name, String systemID)

This will create a new EntityRef with the supplied name and system ID.

Parameters
name:String

String name of element.

systemID:String

String system ID of element.

Returns:EntityRef

the created EntityRef instance

entityRefback to summary
public EntityRef entityRef(int line, int col, String name)

This will create a new EntityRef with the supplied name.

Parameters
line:int

The line on which this content begins.

col:int

The column on the line at which this content begins.

name:String

String name of element.

Returns:EntityRef

the created EntityRef instance

Since
JDOM2
entityRefback to summary
public EntityRef entityRef(int line, int col, String name, String publicID, String systemID)

This will create a new EntityRef with the supplied name, public ID, and system ID.

Parameters
line:int

The line on which this content begins.

col:int

The column on the line at which this content begins.

name:String

String name of element.

publicID:String

String public ID of element.

systemID:String

String system ID of element.

Returns:EntityRef

the created EntityRef instance

Since
JDOM2
entityRefback to summary
public EntityRef entityRef(int line, int col, String name, String systemID)

This will create a new EntityRef with the supplied name and system ID.

Parameters
line:int

The line on which this content begins.

col:int

The column on the line at which this content begins.

name:String

String name of element.

systemID:String

String system ID of element.

Returns:EntityRef

the created EntityRef instance

Since
JDOM2
processingInstructionback to summary
public ProcessingInstruction processingInstruction(String target, Map<String, String> data)

This will create a new ProcessingInstruction with the specified target and data.

Parameters
target:String

String target of PI.

data:Map<String, String>

Map data for PI, in name/value pairs

Returns:ProcessingInstruction

the created ProcessingInstruction instance

processingInstructionback to summary
public ProcessingInstruction processingInstruction(String target, String data)

This will create a new ProcessingInstruction with the specified target and data.

Parameters
target:String

String target of PI.

data:String

String data for PI.

Returns:ProcessingInstruction

the created ProcessingInstruction instance

processingInstructionback to summary
public ProcessingInstruction processingInstruction(String target)

This will create a new ProcessingInstruction with the specified target and no data.

Parameters
target:String

String target of PI.

Returns:ProcessingInstruction

the created ProcessingInstruction instance

processingInstructionback to summary
public ProcessingInstruction processingInstruction(int line, int col, String target, Map<String, String> data)

This will create a new ProcessingInstruction with the specified target and data.

Parameters
line:int

The line on which this content begins.

col:int

The column on the line at which this content begins.

target:String

String target of PI.

data:Map<String, String>

Map data for PI, in name/value pairs

Returns:ProcessingInstruction

the created ProcessingInstruction instance

Since
JDOM2
processingInstructionback to summary
public ProcessingInstruction processingInstruction(int line, int col, String target, String data)

This will create a new ProcessingInstruction with the specified target and data.

Parameters
line:int

The line on which this content begins.

col:int

The column on the line at which this content begins.

target:String

String target of PI.

data:String

String data for PI.

Returns:ProcessingInstruction

the created ProcessingInstruction instance

Since
JDOM2
processingInstructionback to summary
public ProcessingInstruction processingInstruction(int line, int col, String target)

This will create a new ProcessingInstruction with the specified target and no data.

Parameters
line:int

The line on which this content begins.

col:int

The column on the line at which this content begins.

target:String

String target of PI.

Returns:ProcessingInstruction

the created ProcessingInstruction instance

Since
JDOM2
setAttributeback to summary
public void setAttribute(Element element, Attribute a)

Sets a specific Attribute on an Element

Parameters
element:Element

The Element to set the Attribute on

a:Attribute

The Attribute to set

setRootback to summary
public void setRoot(Document doc, Element root)

Sets the 'root' Element for a Document.

Parameters
doc:Document

The Document to set the Root Element of.

root:Element

The Element to set as the root.

textback to summary
public Text text(int line, int col, String str)

This creates the Text with the supplied text.

Parameters
line:int

The line on which this content begins.

col:int

The column on the line at which this content begins.

str:String

String content of Text.

Returns:Text

the created Text instance

Since
JDOM2
textback to summary
public Text text(String str)

This creates the Text with the supplied text.

Parameters
str:String

String content of Text.

Returns:Text

the created Text instance