Contents | Package | Class | Tree | Deprecated | Index | Help | XML for Java
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:

- Representing non-standard characters within an XML document (Example: an e-acute symbol)
- Holding sections or chapters from a large XML document
- Organizing DTDs into logical sub-units
- Representing shorthand notation for frequently used phrases
- Holding markup common to multiple XML documents

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:
  1.1
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
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, toString, toString

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.

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