Package org.jdom
Class DocType
- java.lang.Object
-
- org.jdom.Content
-
- org.jdom.DocType
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Cloneable
public class DocType extends Content
An XML DOCTYPE declaration. Method allow the user to get and set the root element name, public id, and system id.- Version:
- $Revision: 1.32 $, $Date: 2007/11/10 05:28:58 $
- Author:
- Brett McLaughlin, Jason Hunter
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.StringelementNameThe element being constrainedprotected java.lang.StringinternalSubsetThe internal subset of the DOCTYPEprotected java.lang.StringpublicIDThe public ID of the DOCTYPEprotected java.lang.StringsystemIDThe system ID of the DOCTYPE
-
Constructor Summary
Constructors Modifier Constructor Description protectedDocType()Default, no-args constructor for implementations to use if needed.DocType(java.lang.String elementName)This will create theDocTypewith the specified element nameDocType(java.lang.String elementName, java.lang.String systemID)This will create theDocTypewith the specified element name and reference to an external DTD.DocType(java.lang.String elementName, java.lang.String publicID, java.lang.String systemID)This will create theDocTypewith the specified element name and a reference to an external DTD.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetElementName()This will retrieve the element name being constrained.java.lang.StringgetInternalSubset()This returns the data for the internal subset.java.lang.StringgetPublicID()This will retrieve the public ID of an externally referenced DTD, or an emptyStringif none is referenced.java.lang.StringgetSystemID()This will retrieve the system ID of an externally referenced DTD, or an emptyStringif none is referenced.java.lang.StringgetValue()Returns the empty string since doctypes don't have an XPath 1.0 string value.DocTypesetElementName(java.lang.String elementName)This will set the root element name declared by this DOCTYPE declaration.voidsetInternalSubset(java.lang.String newData)This sets the data for the internal subset.DocTypesetPublicID(java.lang.String publicID)This will set the public ID of an externally referenced DTD.DocTypesetSystemID(java.lang.String systemID)This will set the system ID of an externally referenced DTD.java.lang.StringtoString()This returns aStringrepresentation of theDocType, suitable for debugging.-
Methods inherited from class org.jdom.Content
clone, detach, equals, getDocument, getParent, getParentElement, hashCode, setParent
-
-
-
-
Field Detail
-
elementName
protected java.lang.String elementName
The element being constrained
-
publicID
protected java.lang.String publicID
The public ID of the DOCTYPE
-
systemID
protected java.lang.String systemID
The system ID of the DOCTYPE
-
internalSubset
protected java.lang.String internalSubset
The internal subset of the DOCTYPE
-
-
Constructor Detail
-
DocType
protected DocType()
Default, no-args constructor for implementations to use if needed.
-
DocType
public DocType(java.lang.String elementName, java.lang.String publicID, java.lang.String systemID)This will create theDocTypewith the specified element name and a reference to an external DTD.- Parameters:
elementName-Stringname of element being constrained.publicID-Stringpublic ID of referenced DTDsystemID-Stringsystem ID of referenced DTD- Throws:
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.
-
DocType
public DocType(java.lang.String elementName, java.lang.String systemID)This will create theDocTypewith the specified element name and reference to an external DTD.- Parameters:
elementName-Stringname of element being constrained.systemID-Stringsystem ID of referenced DTD- Throws:
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.
-
DocType
public DocType(java.lang.String elementName)
This will create theDocTypewith the specified element name- Parameters:
elementName-Stringname of element being constrained.- Throws:
IllegalNameException- if the given root element name is not a legal XML element name.
-
-
Method Detail
-
getElementName
public java.lang.String getElementName()
This will retrieve the element name being constrained.- Returns:
String- element name for DOCTYPE
-
setElementName
public DocType setElementName(java.lang.String elementName)
This will set the root element name declared by this DOCTYPE declaration.- Parameters:
elementName-Stringname of root element being constrained.- Returns:
- DocType
DocTypethis DocType object - Throws:
IllegalNameException- if the given root element name is not a legal XML element name.
-
getPublicID
public java.lang.String getPublicID()
This will retrieve the public ID of an externally referenced DTD, or an emptyStringif none is referenced.- Returns:
String- public ID of referenced DTD.
-
setPublicID
public DocType setPublicID(java.lang.String publicID)
This will set the public ID of an externally referenced DTD.- Parameters:
publicID- id to set- Returns:
- DocType
DocTypethis DocType object - Throws:
IllegalDataException- if the given public ID is not a legal public ID.
-
getSystemID
public java.lang.String getSystemID()
This will retrieve the system ID of an externally referenced DTD, or an emptyStringif none is referenced.- Returns:
String- system ID of referenced DTD.
-
setSystemID
public DocType setSystemID(java.lang.String systemID)
This will set the system ID of an externally referenced DTD.- Parameters:
systemID- id to set- Returns:
- systemID
Stringsystem ID of referenced DTD. - Throws:
IllegalDataException- if the given system ID is not a legal system literal.
-
getValue
public java.lang.String getValue()
Returns the empty string since doctypes don't have an XPath 1.0 string value.
-
setInternalSubset
public void setInternalSubset(java.lang.String newData)
This sets the data for the internal subset.- Parameters:
newData- data for the internal subset, as aString.
-
getInternalSubset
public java.lang.String getInternalSubset()
This returns the data for the internal subset.- Returns:
String- the internal subset
-
toString
public java.lang.String toString()
This returns aStringrepresentation of theDocType, suitable for debugging.- Overrides:
toStringin classjava.lang.Object- Returns:
String- information about theDocType
-
-