Class DocType Stay organized with collections Save and categorize content based on your preferences.
Page Summary
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.
The
detach()method removes the DocType node from its parent.
A representation of an XMLDocument node.
Methods
| Method | Return type | Brief description |
|---|---|---|
detach() | Content | Detaches the node from its parentElement node. |
get | String | Gets the name of the rootElement node specified in theDoc declaration. |
get | String | Gets the internal subset data for theDocument node. |
get | Element | Gets the node's parentElement node. |
get | String | Gets the public ID of the external subset data for theDocument node. |
get | String | Gets the system ID of the external subset data for theDocument node. |
get | String | Gets the text value of all nodes that are direct or indirect children of the node, in the orderthey appear in the document. |
set | Doc | Sets the name of the rootElement node to specify in theDocdeclaration. |
set | Doc | Sets the internal subset data for theDocument node. |
set | Doc | Sets the public ID of the external subset data for theDocument node. |
set | Doc | Sets the system ID of the external subset data for theDocument node. |
Detailed documentation
detach()
getElementName()
Gets the name of the rootElement node specified in theDoc declaration.
Return
String — the name of the rootElement node specified in theDoc declaration
getInternalSubset()
Gets the internal subset data for theDocument node.
Return
String — the internal subset data
getParentElement()
getPublicId()
Gets the public ID of the external subset data for theDocument node.
Return
String — the public ID of the external subset data
getSystemId()
Gets the system ID of the external subset data for theDocument 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)
setInternalSubset(data)
Sets the internal subset data for theDocument node.
Parameters
| Name | Type | Description |
|---|---|---|
data | String | the internal subset data to set |
Return
Doc — theDocument node, for chaining
setPublicId(id)
Sets the public ID of the external subset data for theDocument node.
Parameters
| Name | Type | Description |
|---|---|---|
id | String | the public ID of the external subset data to set |
Return
Doc — theDocument node, for chaining
setSystemId(id)
Sets the system ID of the external subset data for theDocument node.
Parameters
| Name | Type | Description |
|---|---|---|
id | String | the system ID of the external subset data to set |
Return
Doc — theDocument 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.