Class DocType

  • DocType represents an XML DocumentType node.

  • It provides methods to get and set various properties of the DocType, such as the element name, internal and external subset data, and its parent element.

  • Thedetach() method removes the DocType node from its parent.

DocType

A representation of an XMLDocumentType node.

Methods

MethodReturn typeBrief description
detach()ContentDetaches the node from its parentElement node.
getElementName()StringGets the name of the rootElement node specified in theDocType declaration.
getInternalSubset()StringGets the internal subset data for theDocumentType node.
getParentElement()ElementGets the node's parentElement node.
getPublicId()StringGets the public ID of the external subset data for theDocumentType node.
getSystemId()StringGets the system ID of the external subset data for theDocumentType node.
getValue()StringGets the text value of all nodes that are direct or indirect children of the node, in the orderthey appear in the document.
setElementName(name)DocTypeSets the name of the rootElement node to specify in theDocTypedeclaration.
setInternalSubset(data)DocTypeSets the internal subset data for theDocumentType node.
setPublicId(id)DocTypeSets the public ID of the external subset data for theDocumentType node.
setSystemId(id)DocTypeSets the system ID of the external subset data for theDocumentType node.

Detailed documentation

detach()

Detaches the node from its parentElement node. If the node does not have a parent,this method has no effect.

Return

Content — the detached node


getElementName()

Gets the name of the rootElement node specified in theDocType declaration.

Return

String — the name of the rootElement node specified in theDocType declaration


getInternalSubset()

Gets the internal subset data for theDocumentType node.

Return

String — the internal subset data


getParentElement()

Gets the node's parentElement node. If the node does not have a parent, this methodreturnsnull.

Return

Element — the parentElement node


getPublicId()

Gets the public ID of the external subset data for theDocumentType node.

Return

String — the public ID of the external subset data


getSystemId()

Gets the system ID of the external subset data for theDocumentType node.

Return

String — the system ID of the external subset data


getValue()

Gets the text value of all nodes that are direct or indirect children of the node, in the orderthey appear in the document.

Return

String — the text value of all nodes that are direct or indirect children of the node


setElementName(name)

Sets the name of the rootElement node to specify in theDocTypedeclaration.

Parameters

NameTypeDescription
nameStringthe name of the rootElement node to specify in theDocType declaration

Return

DocType — theDocumentType node, for chaining


setInternalSubset(data)

Sets the internal subset data for theDocumentType node.

Parameters

NameTypeDescription
dataStringthe internal subset data to set

Return

DocType — theDocumentType node, for chaining


setPublicId(id)

Sets the public ID of the external subset data for theDocumentType node.

Parameters

NameTypeDescription
idStringthe public ID of the external subset data to set

Return

DocType — theDocumentType node, for chaining


setSystemId(id)

Sets the system ID of the external subset data for theDocumentType node.

Parameters

NameTypeDescription
idStringthe system ID of the external subset data to set

Return

DocType — theDocumentType node, for chaining

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-12-11 UTC.