Home | History | Annotate | Download | only in dom
      1 /*
      2  * Copyright (c) 2004 World Wide Web Consortium,
      3  *
      4  * (Massachusetts Institute of Technology, European Research Consortium for
      5  * Informatics and Mathematics, Keio University). All Rights Reserved. This
      6  * work is distributed under the W3C(r) Software License [1] in the hope that
      7  * it will be useful, but WITHOUT ANY WARRANTY; without even the implied
      8  * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
      9  *
     10  * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
     11  */
     12 
     13 package org.w3c.dom;
     14 
     15 /**
     16  * This interface represents a known entity, either parsed or unparsed, in an
     17  * XML document. Note that this models the entity itself <em>not</em> the entity declaration.
     18  * <p>The <code>nodeName</code> attribute that is inherited from
     19  * <code>Node</code> contains the name of the entity.
     20  * <p>An XML processor may choose to completely expand entities before the
     21  * structure model is passed to the DOM; in this case there will be no
     22  * <code>EntityReference</code> nodes in the document tree.
     23  * <p>XML does not mandate that a non-validating XML processor read and
     24  * process entity declarations made in the external subset or declared in
     25  * parameter entities. This means that parsed entities declared in the
     26  * external subset need not be expanded by some classes of applications, and
     27  * that the replacement text of the entity may not be available. When the <a href='http://www.w3.org/TR/2004/REC-xml-20040204#intern-replacement'>
     28  * replacement text</a> is available, the corresponding <code>Entity</code> node's child list
     29  * represents the structure of that replacement value. Otherwise, the child
     30  * list is empty.
     31  * <p>DOM Level 3 does not support editing <code>Entity</code> nodes; if a
     32  * user wants to make changes to the contents of an <code>Entity</code>,
     33  * every related <code>EntityReference</code> node has to be replaced in the
     34  * structure model by a clone of the <code>Entity</code>'s contents, and
     35  * then the desired changes must be made to each of those clones instead.
     36  * <code>Entity</code> nodes and all their descendants are readonly.
     37  * <p>An <code>Entity</code> node does not have any parent.
     38  * <p ><b>Note:</b> If the entity contains an unbound namespace prefix, the
     39  * <code>namespaceURI</code> of the corresponding node in the
     40  * <code>Entity</code> node subtree is <code>null</code>. The same is true
     41  * for <code>EntityReference</code> nodes that refer to this entity, when
     42  * they are created using the <code>createEntityReference</code> method of
     43  * the <code>Document</code> interface.
     44  * <p>See also the <a href='http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407'>Document Object Model (DOM) Level 3 Core Specification</a>.
     45  */
     46 public interface Entity extends Node {
     47     /**
     48      * The public identifier associated with the entity if specified, and
     49      * <code>null</code> otherwise.
     50      */
     51     public String getPublicId();
     52 
     53     /**
     54      * The system identifier associated with the entity if specified, and
     55      * <code>null</code> otherwise. This may be an absolute URI or not.
     56      */
     57     public String getSystemId();
     58 
     59     /**
     60      * For unparsed entities, the name of the notation for the entity. For
     61      * parsed entities, this is <code>null</code>.
     62      */
     63     public String getNotationName();
     64 
     65     /**
     66      * An attribute specifying the encoding used for this entity at the time
     67      * of parsing, when it is an external parsed entity. This is
     68      * <code>null</code> if it an entity from the internal subset or if it
     69      * is not known.
     70      * @since DOM Level 3
     71      */
     72     public String getInputEncoding();
     73 
     74     /**
     75      * An attribute specifying, as part of the text declaration, the encoding
     76      * of this entity, when it is an external parsed entity. This is
     77      * <code>null</code> otherwise.
     78      * @since DOM Level 3
     79      */
     80     public String getXmlEncoding();
     81 
     82     /**
     83      * An attribute specifying, as part of the text declaration, the version
     84      * number of this entity, when it is an external parsed entity. This is
     85      * <code>null</code> otherwise.
     86      * @since DOM Level 3
     87      */
     88     public String getXmlVersion();
     89 
     90 }
     91