XML Parser for Java 1.1.9

com.ibm.xml.parser
Class EntityDecl

java.lang.Object
  |
  +--com.ibm.xml.parser.Child
        |
        +--com.ibm.xml.parser.Parent
              |
              +--com.ibm.xml.parser.EntityDecl
Direct Known Subclasses:
TreeFactory.TreeEntity

public class EntityDecl
extends Parent

The EntityDecl class represents entity declrations. 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: 71 1.7 src/com/ibm/xml/parser/EntityDecl.java, xml4jsrc, xml4j-jtcsv, xml4j_1_1_9
See Also:
ExternalID, Parent, Entity, Serialized Form

Fields inherited from class com.ibm.xml.parser.Child
ATTDEF, ATTLIST, ELEMENT_DECL, NAME_ATTDEF, NAME_ATTLIST, NAME_CDATA, NAME_COMMENT, NAME_DOCFRAGMENT, NAME_DOCUMENT, NAME_ELEMENT_DECL, NAME_PSEUDONODE, NAME_TEXT, PSEUDONODE
 
Constructor Summary
EntityDecl(java.lang.String name, ExternalID externalID, boolean isParameter, java.lang.String ndata)
          Constructor for external Entities.
EntityDecl(java.lang.String name, java.lang.String value, boolean isParameter)
          Constructor for internal 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.
protected  void checkChildType(Node child)
          Check whether child is allowed to be insered in this node or not.
 java.lang.Object clone()
          Clone this EntityDecl using the appropriate factory.
 Node cloneNode(boolean deep)
           
 boolean equals(Node arg, boolean deep)
          Always return false.
protected  Entity getEntityImpl()
          Wrapper for DOM.
 ExternalID getExternalID()
          Returns the external ID of this Entity.
 java.lang.String getName()
          Deprecated. Use getNodeName()
 java.lang.String getNDATAType()
          Deprecated. This method will be removed in future release. Use getNotationName().
 java.lang.String getNodeName()
          Returns the name associated with this Entity.
 short getNodeType()
          Returns that this object is an Entity Node.
 java.lang.String getNotationName()
          Returns the notation associated with this Entity.
 java.lang.String getPublicId()
          Returns the public identifier of the Notation.
 java.lang.String getSystemId()
          Returns the system identifier of the Notation.
 java.lang.String getValue()
          Returns the value of this Entity.
 boolean isExternal()
          Returns whether this entity value is external.
 boolean isNDATA()
          Deprecated. This method will be removed in future release.
 boolean isParameter()
          Returns whether this Entity is a parameter Entity.
 
Methods inherited from class com.ibm.xml.parser.Parent
addElement, appendChild, elements, expandEntityReferences, getChildNodes, getChildrenArray, getFirstChild, getFirstWithoutReference, getLastChild, getLastWithoutReference, getText, hasChildNodes, insert, insertAfter, insertBefore, insertFirst, insertLast, processAfterRemove, realInsert, removeChild, replaceChild
 
Methods inherited from class com.ibm.xml.parser.Child
clearDigest, getAttributes, getDigest, getFactory, getNextSibling, getNextWithoutReference, getNodeValue, getOwnerDocument, getParentNode, getParentWithoutReference, getPreviousSibling, getPreviousWithoutReference, makeXPointer, print, print, searchAncestors, searchAncestors, setFactory, setNodeValue, toXMLString, toXMLString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EntityDecl

public EntityDecl(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.

EntityDecl

public EntityDecl(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 EntityDecl using the appropriate factory.

This method is defined by Child.

Returns:
Cloned EntityDecl.
Overrides:
clone in class Child
See Also:
Child.clone()

cloneNode

public Node cloneNode(boolean deep)
Overrides:
cloneNode in class Child

equals

public boolean equals(Node arg,
                      boolean deep)
Always return false.

CURRENTLY NOT IMPLEMNTED.

Parameters:
deep - Ignored.
Overrides:
equals in class Child

getNodeType

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

This method is defined by DOM.

Returns:
Entity Node indicator.

getNodeName

public java.lang.String getNodeName()
Returns the name associated with this Entity.

This method is defined by DOM.


getName

public java.lang.String getName()
Deprecated. Use getNodeName()
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.

getSystemId

public java.lang.String getSystemId()
Returns the system identifier of the Notation. A system identifier is a URI, which may be used to retrieve an external entity's content.

This method is defined by DOM.

Returns:
The system identifier, or null if the identifier is not defined.
See Also:
ExternalID.getSystemLiteral()

getPublicId

public java.lang.String getPublicId()
Returns the public identifier of the Notation. This value is only valid if the identifier is defined as public (as opposed to system). Public identifiers may be used to try to generate an alternative URI in order to retrieve the an external entities content. If retrieval fails using the public identifier, an attempt must be made to retrieve content using the system identifier.

This method is defined by DOM.

Returns:
The public identifier, or null if the identifier is not defined.
See Also:
ExternalID

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()
Deprecated. This method will be removed in future release. Use getNotationName().
Returns the notation associated with this Entity.
Returns:
The notation associated with the external binary Entity, otherwise, null.

getNotationName

public java.lang.String getNotationName()
Returns the notation associated with this Entity.

This method is defined by DOM.

Returns:
The notation associated with the external binary Entity, otherwise, null.

isNDATA

public boolean isNDATA()
Deprecated. This method will be removed in future release.
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

checkChildType

protected void checkChildType(Node child)
                       throws DOMException
Check whether child is allowed to be insered in this node or not. When not allowed, a DOMException with HIERARCHY_REQUEST_ERR is thrown.
Overrides:
checkChildType in class Parent

getEntityImpl

protected Entity getEntityImpl()
Wrapper for DOM.

XML Parser for Java 1.1.9