Class EntityRef
- java.lang.Object
-
- org.jdom.Content
-
- org.jdom.EntityRef
-
- All Implemented Interfaces:
Serializable,Cloneable,NamespaceAware
- Direct Known Subclasses:
LocatedEntityRef
public class EntityRef extends Content
An XML entity reference. Methods allow the user to manage its name, public id, and system id.- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.jdom.Content
Content.CType
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedEntityRef()Default, no-args constructor for implementations to use if needed.EntityRef(String name)This will create a newEntityRefwith the supplied name.EntityRef(String name, String systemID)This will create a newEntityRefwith the supplied name and system id.EntityRef(String name, String publicID, String systemID)This will create a newEntityRefwith the supplied name, public id, and system id.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description EntityRefclone()Return a deep clone of this instance.EntityRefdetach()Detaches this child from its parent or does nothing if the child has no parent.StringgetName()This returns the name of theEntityRef.ElementgetParent()Return this child's parent, or null if this child is currently not attached.StringgetPublicID()This will return the publid ID of thisEntityRef.StringgetSystemID()This will return the system ID of thisEntityRef.StringgetValue()Returns the empty string since entity references don't have an XPath 1.0 string value.EntityRefsetName(String name)This will set the name of thisEntityRef.protected EntityRefsetParent(Parent parent)Sets the parent of this Content.EntityRefsetPublicID(String publicID)This will set the public ID of thisEntityRef.EntityRefsetSystemID(String systemID)This will set the system ID of thisEntityRef.StringtoString()This returns aStringrepresentation of theEntityRef, suitable for debugging.-
Methods inherited from class org.jdom.Content
equals, getCType, getDocument, getNamespacesInherited, getNamespacesInScope, getNamespacesIntroduced, getParentElement, hashCode
-
-
-
-
Constructor Detail
-
EntityRef
protected EntityRef()
Default, no-args constructor for implementations to use if needed.
-
EntityRef
public EntityRef(String name)
This will create a newEntityRefwith the supplied name.- Parameters:
name-Stringname 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 newEntityRefwith the supplied name and system id.- Parameters:
name-Stringname 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 newEntityRefwith the supplied name, public id, and system id.- Parameters:
name-Stringname of element.publicID- public id of the entity reference being constructedsystemID- 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 IDIllegalNameException- if the given name is not a legal XML name.
-
-
Method Detail
-
getName
public String getName()
This returns the name of theEntityRef.- Returns:
String- entity name.
-
getValue
public String getValue()
Returns the empty string since entity references don't have an XPath 1.0 string value.
-
getPublicID
public String getPublicID()
This will return the publid ID of thisEntityRef. If there is no public ID, then this returnsnull.- Returns:
- public ID of this
EntityRef
-
getSystemID
public String getSystemID()
This will return the system ID of thisEntityRef. If there is no system ID, then this returnsnull.- Returns:
- system ID of this
EntityRef
-
setName
public EntityRef setName(String name)
This will set the name of thisEntityRef.- Parameters:
name- new name of the entity- Returns:
- this
EntityRefmodified. - 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 thisEntityRef.- Parameters:
publicID- new public id- Returns:
- this
EntityRefmodified. - 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 thisEntityRef.- Parameters:
systemID- new system id- Returns:
- this
EntityRefmodified. - Throws:
IllegalDataException- if the given system ID is not a legal system literal.
-
toString
public String toString()
This returns aStringrepresentation of theEntityRef, suitable for debugging.
-
detach
public EntityRef detach()
Description copied from class:ContentDetaches this child from its parent or does nothing if the child has no parent.This method can be overridden by particular Content subclasses to return a specific type of Content (co-variant return type). All overriding subclasses must call
super.detach();
-
setParent
protected EntityRef setParent(Parent parent)
Description copied from class:ContentSets the parent of this Content. The caller is responsible for removing any pre-existing parentage.This method can be overridden by particular Content subclasses to return a specific type of Content (co-variant return type). All overriding subclasses must call
super.setParent(Parent);
-
getParent
public Element getParent()
Description copied from class:ContentReturn this child's parent, or null if this child is currently not attached. The parent can be either anElementor aDocument.This method can be overridden by particular Content subclasses to return a specific type of Parent (co-variant return type). All overriding subclasses must call
super.getParent();
-
clone
public EntityRef clone()
Return a deep clone of this instance. Even if this instance has a parent, the returned clone will not.All JDOM core classes are Cloneable, and never throw CloneNotSupportedException. Additionally all Cloneable JDOM classes return the correct type of instance from this method and there is no need to cast the result (co-variant return vaue).
Subclasses of this should still call super.clone() in their clone method.
-
-