Top Description Fields Constructors Methods
org.jdom2

public Class DocType

extends Content
Class Inheritance
Known Direct Subclasses
org.jdom2.located.LocatedDocType

An XML DOCTYPE declaration. Method allow the user to get and set the root element name, public id, system id and internal subset.
Authors
Brett McLaughlin, Jason Hunter

Field Summary

Modifier and TypeField and Description
protected String
elementName

The element being constrained

protected String
internalSubset

The internal subset of the DOCTYPE

protected String
publicID

The public ID of the DOCTYPE

private static final long
protected String
systemID

The system ID of the DOCTYPE

Inherited from org.jdom2.Content:
ctypeparent

Constructor Summary

AccessConstructor and Description
protected
DocType()

Default, no-args constructor for implementations to use if needed.

public
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(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(String
String name of element being constrained.
elementName
)

This will create the DocType with the specified element name

Method Summary

Modifier and TypeMethod and Description
public DocType
clone()

Overrides org.jdom2.Content.clone.

Return a deep clone of this instance.
public DocType
detach()

Overrides org.jdom2.Content.detach.

Detaches this child from its parent or does nothing if the child has no parent.
public String

Returns:

String - element name for DOCTYPE
getElementName
()

This will retrieve the element name being constrained.

public String

Returns:

String - the internal subset
getInternalSubset
()

This returns the data for the internal subset.

public Document
getParent()

Overrides org.jdom2.Content.getParent.

Return this child's parent, or null if this child is currently not attached.
public String

Returns:

String - public ID of referenced DTD.
getPublicID
()

This will retrieve the public ID of an externally referenced DTD, or an empty String if none is referenced.

public String

Returns:

String - system ID of referenced DTD.
getSystemID
()

This will retrieve the system ID of an externally referenced DTD, or an empty String if none is referenced.

public String

Returns:

the empty string
getValue
()

Implements abstract org.jdom2.Content.getValue.

Returns the empty string since doctypes don't have an XPath 1.0 string value.
public DocType

Returns:

this DocType instance
setElementName
(String
String name of root element being constrained.
elementName
)

This will set the root element name declared by this DOCTYPE declaration.

public void
setInternalSubset(String
data for the internal subset, as a String.
newData
)

This sets the data for the internal subset.

protected DocType
setParent(Parent
new parent element
parent
)

Overrides org.jdom2.Content.setParent.

Sets the parent of this Content.
public DocType

Returns:

DocType DocType this DocType object
setPublicID
(String
id to set
publicID
)

This will set the public ID of an externally referenced DTD.

public DocType

Returns:

systemID String system ID of referenced DTD.
setSystemID
(String
id to set
systemID
)

This will set the system ID of an externally referenced DTD.

public String

Returns:

String - information about the DocType
toString
()

Overrides java.lang.Object.toString.

This returns a String representation of the DocType, suitable for debugging.
Inherited from org.jdom2.Content:
equalsgetCTypegetDocumentgetNamespacesInheritedgetNamespacesInScopegetNamespacesIntroducedgetParentElementhashCode

Field Detail

elementNameback to summary
protected String elementName

The element being constrained

Serial Fields:
The:root
element name
internalSubsetback to summary
protected String internalSubset

The internal subset of the DOCTYPE

Serial Fields:
The:InternalSubset,
may be null
publicIDback to summary
protected String publicID

The public ID of the DOCTYPE

Serial Fields:
The:PublicID,
may be null
serialVersionUIDback to summary
private static final long serialVersionUID

Hides org.jdom2.Content.serialVersionUID.

JDOM2 Serialization. In this case, DocType is simple.

systemIDback to summary
protected String systemID

The system ID of the DOCTYPE

Serial Fields:
The:SystemID,
may be null

Constructor Detail

DocTypeback to summary
protected DocType()

Default, no-args constructor for implementations to use if needed.

DocTypeback to summary
public 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

Exceptions
IllegalDataException:
if the given system ID is not a legal system literal or the public ID is not a legal public ID.
IllegalNameException:
if the given root element name is not a legal XML element name.
DocTypeback to summary
public 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

Exceptions
IllegalDataException:
if the given system ID is not a legal system literal.
IllegalNameException:
if the given root element name is not a legal XML element name.
DocTypeback to summary
public DocType(String elementName)

This will create the DocType with the specified element name

Parameters
elementName:String

String name of element being constrained.

Exceptions
IllegalNameException:
if the given root element name is not a legal XML element name.

Method Detail

cloneback to summary
public DocType clone()

Overrides org.jdom2.Content.clone.

Doc from org.jdom2.CloneBase.clone.

Return a deep clone of this instance. Even if this instance has a parent, the returned clone will not.

All JDOM core classes are Cloneable, and never throw CloneNotSupportedException. Additionally all Cloneable JDOM classes return the correct type of instance from this method and there is no need to cast the result (co-variant return value).

Subclasses of this should still call super.clone() in their clone method.

Returns:DocType

Doc from java.lang.Object.clone.

a clone of this instance.

Annotations
@Override
detachback to summary
public DocType detach()

Overrides org.jdom2.Content.detach.

Doc from org.jdom2.Content.detach.

Detaches this child from its parent or does nothing if the child has no parent.

This method can be overridden by particular Content subclasses to return a specific type of Content (co-variant return type). All overriding subclasses must call super.detach();

Returns:DocType

this child detached

Annotations
@Override
getElementNameback to summary
public String getElementName()

This will retrieve the element name being constrained.

Returns:String

String - element name for DOCTYPE

getInternalSubsetback to summary
public String getInternalSubset()

This returns the data for the internal subset.

Returns:String

String - the internal subset

getParentback to summary
public Document getParent()

Overrides org.jdom2.Content.getParent.

Doc from org.jdom2.Content.getParent.

Return this child's parent, or null if this child is currently not attached. The parent can be either an Element or a Document.

This method can be overridden by particular Content subclasses to return a specific type of Parent (co-variant return type). All overriding subclasses must call super.getParent();

Returns:Document

this child's parent or null if none

Annotations
@Override
getPublicIDback to summary
public String getPublicID()

This will retrieve the public ID of an externally referenced DTD, or an empty String if none is referenced.

Returns:String

String - public ID of referenced DTD.

getSystemIDback to summary
public String getSystemID()

This will retrieve the system ID of an externally referenced DTD, or an empty String if none is referenced.

Returns:String

String - system ID of referenced DTD.

getValueback to summary
public String getValue()

Implements abstract org.jdom2.Content.getValue.

Returns the empty string since doctypes don't have an XPath 1.0 string value.

Returns:String

the empty string

Annotations
@Override
setElementNameback to summary
public DocType setElementName(String elementName)

This will set the root element name declared by this DOCTYPE declaration.

Parameters
elementName:String

String name of root element being constrained.

Returns:DocType

this DocType instance

Exceptions
IllegalNameException:
if the given root element name is not a legal XML element name.
setInternalSubsetback to summary
public void setInternalSubset(String newData)

This sets the data for the internal subset.

Parameters
newData:String

data for the internal subset, as a String.

setParentback to summary
protected DocType setParent(Parent parent)

Overrides org.jdom2.Content.setParent.

Doc from org.jdom2.Content.setParent.

Sets the parent of this Content. The caller is responsible for removing any pre-existing parentage.

This method can be overridden by particular Content subclasses to return a specific type of Content (co-variant return type). All overriding subclasses must call super.setParent(Parent);

Parameters
parent:Parent

new parent element

Returns:DocType

the target element

Annotations
@Override
setPublicIDback to summary
public DocType setPublicID(String publicID)

This will set the public ID of an externally referenced DTD.

Parameters
publicID:String

id to set

Returns:DocType

DocType DocType this DocType object

Exceptions
IllegalDataException:
if the given public ID is not a legal public ID.
setSystemIDback to summary
public DocType setSystemID(String systemID)

This will set the system ID of an externally referenced DTD.

Parameters
systemID:String

id to set

Returns:DocType

systemID String system ID of referenced DTD.

Exceptions
IllegalDataException:
if the given system ID is not a legal system literal.
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

This returns a String representation of the DocType, suitable for debugging.

Returns:String

String - information about the DocType

Annotations
@Override