Contents | Package | Class | Tree | Deprecated | Index | Help XML for Java 1.0.4
PREV | NEXT SHOW LISTS | HIDE LISTS

Class com.ibm.xml.parser.Entity

java.lang.Object
    |
    +----com.ibm.xml.parser.Child
            |
            +----com.ibm.xml.parser.Entity
Subclasses:
TreeFactory.TreeEntity

public class Entity
extends Child
The Entity class provides support for XML entities. Entities are useful in:

Internal entities have a value that is directly given in the entity declaration. For example:

<!ENTITY IBM "International Business Machines">

External entities refer to declarations to a storage unit by means of a SYSTEM or PUBLIC identifier. For example:

<!ENTITY IBM SYSTEM "ibm.xml">

..associates the name IBM with the URL "ibm.xml". XML4J must read the file referenced in order to find out the content of that entity.

As you might expect, external Entities contain External IDs in order to provide access to the resource. External entities can can be either text or binary resources. Text resources are XML-encoded resources, and are illustrated by this example:

<!ENTITY IBM SYSTEM "ibm.xml">

Binary entities are anything that is not XML-encoded. Binary entities always include a notation (ndata) which describes the type of resource. For example:

<!ENTITY IBMLogo SYSTEM "ibm.jpg" NDATA JPEG>

Version:
Revision: 99 1.6 src/com/ibm/xml/parser/Entity.java, xml4jsrc, xml4j-jtcsv, xml4j_1_0_4
See Also:
ExternalID, Child

Fields inherited from class com.ibm.xml.parser.Child
 ATTDEF, ATTLIST, DOCUMENTTYPE, ELEMENTDEFINITION, ENTITY, GENERALREFERENCE, NOTATION, PSEUDONODE
 

Constructor Summary
 Entity(java.lang.String name, java.lang.String value, boolean isParameter)
Constructor for internal Entities.
 Entity(java.lang.String name, ExternalID externalID, boolean isParameter, java.lang.String ndata)
Constructor for external Entities.
 

Method Summary
void  acceptPost(Visitor visitor)
Implements the accept operation of the visitor design pattern when the end of an Entity Node is recognized when traversing the document object tree.
void  acceptPre(Visitor visitor)
Implements the accept operation of the visitor design pattern when the start of an Entity Node is recognized when traversing the document object tree.
java.lang.Object  clone()
Clone this Entity using the appropriate factory.
ExternalID  getExternalID()
Returns the external ID of this Entity.
java.lang.String  getName()
Returns the name associated with this Entity.
java.lang.String  getNDATAType()
Returns the notation associated with this Entity.
int  getNodeType()
Returns that this object is an Entity Node.
java.lang.String  getValue()
Returns the value of this Entity.
boolean  isExternal()
Returns whether this entity value is external.
boolean  isNDATA()
Returns whether there is a notation associated with this entity value.
boolean  isParameter()
Returns whether this Entity is a parameter Entity.
 
Methods inherited from class com.ibm.xml.parser.Child
 clearDigest, clone, getChildNodes, getDigest, getFactory, getFirstChild, getNextSibling, getParentNode, getPreviousSibling, getText, hasChildNodes, insertBefore, makeXPointer, print, print, removeChild, replaceChild, searchAncestors, searchAncestors, setFactory, toXMLString, toXMLString
 
Methods inherited from class java.lang.Object
 clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Entity

public Entity(java.lang.String name,
              java.lang.String value,
              boolean isParameter)
Constructor for internal Entities.
Parameters:
name - Name of this Entity.
value - The XML-encoded value that was directly assigned to the Entity.
isParameter - =true if a parameter Entity; otherwise =false.

Entity

public Entity(java.lang.String name,
              ExternalID externalID,
              boolean isParameter,
              java.lang.String ndata)
Constructor for external Entities.
Parameters:
name - Name of the Entity.
externalID - The reference(s) to the external entity to retrieve.
isParameter - =true if a parameter Entity; otherwise =false.
ndata - The notation associated with the binary Entity, or null if the Entity is a text Entity.
See Also:
ExternalID
Method Detail

clone

public java.lang.Object clone()
Clone this Entity using the appropriate factory.

This method is defined by Child.

Returns:
Cloned Entity.
Overrides:
clone in class Child
See Also:
clone

getNodeType

public int getNodeType()
Returns that this object is an Entity Node.

This method is defined by DOM.

Returns:
Entity Node indicator.

getName

public java.lang.String getName()
Returns the name associated with this Entity.
Returns:
Name of this entity.

isParameter

public boolean isParameter()
Returns whether this Entity is a parameter Entity.
Returns:
=true if an internal parameter Entity; otherwise =false.

getValue

public java.lang.String getValue()
Returns the value of this Entity.
Returns:
The XML-encoded value that was directly assigned to the internal Entity; otherwise, null.

getExternalID

public ExternalID getExternalID()
Returns the external ID of this Entity.
Returns:
The reference(s) to the external entity to retrieve; otherwise, null.
See Also:
ExternalID

isExternal

public boolean isExternal()
Returns whether this entity value is external.
Returns:
=true if entity is external; otherwise, =false.
See Also:
ExternalID

getNDATAType

public java.lang.String getNDATAType()
Returns the notation associated with this Entity.
Returns:
The notation associated with the external binary Entity, otherwise, null.

isNDATA

public boolean isNDATA()
Returns whether there is a notation associated with this entity value.
Returns:
=true if the external binary entity contains a notation; otherwise, =false.

acceptPre

public void acceptPre(Visitor visitor) throws java.lang.Exception
Implements the accept operation of the visitor design pattern when the start of an Entity Node is recognized when traversing the document object tree.
Parameters:
visitor - The implemention of the Visitor operation (toXMLString, digest, ...)
Throws:
java.lang.Exception - Thrown if this Node can not be visitted, or traversal modification is requested.
See Also:
Visitor, TreeTraversal, NonRecursivePreorderTreeTraversal, TreeTraversalException

acceptPost

public void acceptPost(Visitor visitor) throws java.lang.Exception
Implements the accept operation of the visitor design pattern when the end of an Entity Node is recognized when traversing the document object tree.
Parameters:
visitor - The implemention of the Visitor operation (toXMLString, digest, ...)
Throws:
java.lang.Exception - Thrown if this Node can not be visitted, or traversal modification is requested.
See Also:
Visitor, TreeTraversal, NonRecursivePreorderTreeTraversal, TreeTraversalException

Contents | Package | Class | Tree | Deprecated | Index | Help
PREV | NEXT SHOW LISTS | HIDE LISTS