org.cdmckay.coffeedom
Class EntityRef

java.lang.Object
  extended by org.cdmckay.coffeedom.Content
      extended by org.cdmckay.coffeedom.EntityRef
All Implemented Interfaces:
Serializable, Cloneable

public class EntityRef
extends Content

An XML entity reference. Methods allow the user to manage its name, public id, and system id.

Author:
Brett McLaughlin, Jason Hunter, Philip Nelson
See Also:
Serialized Form

Field Summary
protected  String name
          The name of the EntityRef
protected  String publicID
          The PublicID of the EntityRef
protected  String systemID
          The SystemID of the EntityRef
 
Fields inherited from class org.cdmckay.coffeedom.Content
parent
 
Constructor Summary
protected EntityRef()
          Default, no-args constructor for implementations to use if needed.
  EntityRef(String name)
          This will create a new EntityRef with the supplied name.
  EntityRef(String name, String systemID)
          This will create a new EntityRef with the supplied name and system id.
  EntityRef(String name, String publicID, String systemID)
          This will create a new EntityRef with the supplied name, public id, and system id.
 
Method Summary
 EntityRef clone()
          Returns a deep, unattached copy of this child and its descendants detached from any parent or document.
 EntityRef detach()
          Detaches this child from its parent or does nothing if the child has no parent.
 String getName()
          This returns the name of the EntityRef.
 Element getParent()
          Return this child's parent, or null if this child is currently not attached.
 String getPublicID()
          This will return the publid ID of this EntityRef.
 String getSystemID()
          This will return the system ID of this EntityRef.
 String getValue()
          Returns the empty string since entity references don't have an XPath 1.0 string value.
 EntityRef setName(String name)
          This will set the name of this EntityRef.
protected  EntityRef setParent(Parent parent)
          Sets the parent of this Content.
 EntityRef setPublicID(String publicID)
          This will set the public ID of this EntityRef.
 EntityRef setSystemID(String systemID)
          This will set the system ID of this EntityRef.
 String toString()
          This returns a String representation of the EntityRef, 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

name

protected String name
The name of the EntityRef


publicID

protected String publicID
The PublicID of the EntityRef


systemID

protected String systemID
The SystemID of the EntityRef

Constructor Detail

EntityRef

protected EntityRef()
Default, no-args constructor for implementations to use if needed.


EntityRef

public EntityRef(String name)
This will create a new EntityRef with the supplied name.

Parameters:
name - String name of element.
Throws:
IllegalNameException - if the given name is not a legal XML name.

EntityRef

public EntityRef(String name,
                 String systemID)
This will create a new EntityRef with the supplied name and system id.

Parameters:
name - String name of element.
systemID - system id of the entity reference being constructed
Throws:
IllegalNameException - if the given name is not a legal XML name.
IllegalDataException - if the given system ID is not a legal system literal.

EntityRef

public EntityRef(String name,
                 String publicID,
                 String systemID)
This will create a new EntityRef with the supplied name, public id, and system id.

Parameters:
name - String name of element.
publicID - public id of the entity reference being constructed
systemID - system id of the entity reference being constructed
Throws:
IllegalDataException - if the given system ID is not a legal system literal or the the given public ID is not a legal public ID
IllegalNameException - if the given name is not a legal XML name.
Method Detail

getName

public String getName()
This returns the name of the EntityRef.

Returns:
String - entity name.

getValue

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

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

getPublicID

public String getPublicID()
This will return the publid ID of this EntityRef. If there is no public ID, then this returns null.

Returns:
public ID of this EntityRef

getSystemID

public String getSystemID()
This will return the system ID of this EntityRef. If there is no system ID, then this returns null.

Returns:
system ID of this EntityRef

setName

public EntityRef setName(String name)
This will set the name of this EntityRef.

Parameters:
name - new name of the entity
Returns:
this EntityRef modified.
Throws:
IllegalNameException - if the given name is not a legal XML name.

setPublicID

public EntityRef setPublicID(String publicID)
This will set the public ID of this EntityRef.

Parameters:
publicID - new public id
Returns:
this EntityRef modified.
Throws:
IllegalDataException - if the given public ID is not a legal public ID.

setSystemID

public EntityRef setSystemID(String systemID)
This will set the system ID of this EntityRef.

Parameters:
systemID - new system id
Returns:
this EntityRef modified.
Throws:
IllegalDataException - if the given system ID is not a legal system literal.

getParent

public Element getParent()
Description copied from class: Content
Return this child's parent, or null if this child is currently not attached. The parent can be either an Element or a Document.

Overrides:
getParent in class Content
Returns:
this child's parent or null if none

setParent

protected EntityRef 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 EntityRef 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 EntityRef 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 EntityRef, suitable for debugging.

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


Copyright © 2011. All Rights Reserved.