org.cdmckay.coffeedom
Class DocType

java.lang.Object
  extended by org.cdmckay.coffeedom.Content
      extended by org.cdmckay.coffeedom.DocType
All Implemented Interfaces:
Serializable, 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
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
protected  String systemID
          The system ID of the DOCTYPE
 
Fields inherited from class org.cdmckay.coffeedom.Content
parent
 
Constructor Summary
protected DocType()
          Default, no-args constructor for implementations to use if needed.
  DocType(String elementName)
          This will create the DocType with the specified element name
  DocType(String elementName, String systemID)
          This will create the DocType with the specified element name and reference to an external DTD.
  DocType(String elementName, String publicID, String systemID)
          This will create the DocType with the specified element name and a reference to an external DTD.
 
Method Summary
 DocType clone()
          Returns a deep, unattached copy of this child and its descendants detached from any parent or document.
 DocType detach()
          Detaches this child from its parent or does nothing if the child has no parent.
 String getElementName()
          This will retrieve the element name being constrained.
 String getInternalSubset()
          This returns the data for the internal subset.
 Document getParent()
          Get the parent of the DocType, which has to be a Document (or null).
 String getPublicID()
          This will retrieve the public ID of an externally referenced DTD, or an empty String if none is referenced.
 String getSystemID()
          This will retrieve the system ID of an externally referenced DTD, or an empty String if none is referenced.
 String getValue()
          Returns the empty string since doctypes don't have an XPath 1.0 string value.
 DocType setElementName(String elementName)
          This will set the root element name declared by this DOCTYPE declaration.
 void setInternalSubset(String newData)
          This sets the data for the internal subset.
protected  DocType setParent(Parent parent)
          Sets the parent of this Content.
 DocType setPublicID(String publicID)
          This will set the public ID of an externally referenced DTD.
 DocType setSystemID(String systemID)
          This will set the system ID of an externally referenced DTD.
 String toString()
          This returns a String representation of the DocType, suitable for debugging.
 
Methods inherited from class org.cdmckay.coffeedom.Content
equals, getDocument, getParentElement, hashCode
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

elementName

protected String elementName
The element being constrained


publicID

protected String publicID
The public ID of the DOCTYPE


systemID

protected String systemID
The system ID of the DOCTYPE


internalSubset

protected 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(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 name of element being constrained.
publicID - String public ID of referenced DTD
systemID - String system 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(String elementName,
               String systemID)
This will create the DocType with the specified element name and reference to an external DTD.

Parameters:
elementName - String name of element being constrained.
systemID - String system 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(String elementName)
This will create the DocType with the specified element name

Parameters:
elementName - name of element being constrained.
Throws:
IllegalNameException - if the given root element name is not a legal XML element name.
Method Detail

getElementName

public String getElementName()
This will retrieve the element name being constrained.

Returns:
element name for DOCTYPE.

setElementName

public DocType setElementName(String elementName)
This will set the root element name declared by this DOCTYPE declaration.

Parameters:
elementName - String name of root element being constrained.
Returns:
DocType DocType this DocType object
Throws:
IllegalNameException - if the given root element name is not a legal XML element name.

getPublicID

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

Returns:
String - public ID of referenced DTD.

setPublicID

public DocType setPublicID(String publicID)
This will set the public ID of an externally referenced DTD.

Parameters:
publicID - id to set
Returns:
DocType DocType this DocType object
Throws:
IllegalDataException - if the given public ID is not a legal public ID.

getSystemID

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

Returns:
String - system ID of referenced DTD.

setSystemID

public DocType setSystemID(String systemID)
This will set the system ID of an externally referenced DTD.

Parameters:
systemID - id to set
Returns:
systemID String system ID of referenced DTD.
Throws:
IllegalDataException - if the given system ID is not a legal system literal.

getValue

public String getValue()
Returns the empty string since doctypes don't have an XPath 1.0 string value.

Specified by:
getValue in class Content
Returns:
the empty string

setInternalSubset

public void setInternalSubset(String newData)
This sets the data for the internal subset.

Parameters:
newData - data for the internal subset, as a String.

getInternalSubset

public String getInternalSubset()
This returns the data for the internal subset.

Returns:
String - the internal subset

getParent

public Document getParent()
Get the parent of the DocType, which has to be a Document (or null).

Overrides:
getParent in class Content
Returns:
The Document that the DocType is attached to.

setParent

protected DocType setParent(Parent parent)
Description copied from class: Content
Sets the parent of this Content. The caller is responsible for removing any pre-existing parentage.

Overrides:
setParent in class Content
Parameters:
parent - new parent element
Returns:
the target element

clone

public DocType clone()
Description copied from class: Content
Returns a deep, unattached copy of this child and its descendants detached from any parent or document.

Overrides:
clone in class Content
Returns:
a detached deep copy of this child and descendants

detach

public DocType detach()
Description copied from class: Content
Detaches this child from its parent or does nothing if the child has no parent.

Overrides:
detach in class Content
Returns:
this child detached

toString

public String toString()
This returns a String representation of the DocType, suitable for debugging.

Overrides:
toString in class Object
Returns:
String - information about the DocType


Copyright © 2011. All Rights Reserved.