001    /*
002     * Copyright (c) 2004 World Wide Web Consortium,
003     *
004     * (Massachusetts Institute of Technology, European Research Consortium for
005     * Informatics and Mathematics, Keio University). All Rights Reserved. This
006     * work is distributed under the W3C(r) Software License [1] in the hope that
007     * it will be useful, but WITHOUT ANY WARRANTY; without even the implied
008     * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
009     *
010     * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
011     */
012    
013    package org.w3c.dom;
014    
015    /**
016     * This interface represents a known entity, either parsed or unparsed, in an 
017     * XML document. Note that this models the entity itself <em>not</em> the entity declaration.
018     * <p>The <code>nodeName</code> attribute that is inherited from 
019     * <code>Node</code> contains the name of the entity.
020     * <p>An XML processor may choose to completely expand entities before the 
021     * structure model is passed to the DOM; in this case there will be no 
022     * <code>EntityReference</code> nodes in the document tree.
023     * <p>XML does not mandate that a non-validating XML processor read and 
024     * process entity declarations made in the external subset or declared in 
025     * parameter entities. This means that parsed entities declared in the 
026     * external subset need not be expanded by some classes of applications, and 
027     * 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'>
028     * replacement text</a> is available, the corresponding <code>Entity</code> node's child list 
029     * represents the structure of that replacement value. Otherwise, the child 
030     * list is empty.
031     * <p>DOM Level 3 does not support editing <code>Entity</code> nodes; if a 
032     * user wants to make changes to the contents of an <code>Entity</code>, 
033     * every related <code>EntityReference</code> node has to be replaced in the 
034     * structure model by a clone of the <code>Entity</code>'s contents, and 
035     * then the desired changes must be made to each of those clones instead. 
036     * <code>Entity</code> nodes and all their descendants are readonly.
037     * <p>An <code>Entity</code> node does not have any parent.
038     * <p ><b>Note:</b> If the entity contains an unbound namespace prefix, the 
039     * <code>namespaceURI</code> of the corresponding node in the 
040     * <code>Entity</code> node subtree is <code>null</code>. The same is true 
041     * for <code>EntityReference</code> nodes that refer to this entity, when 
042     * they are created using the <code>createEntityReference</code> method of 
043     * the <code>Document</code> interface.
044     * <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>.
045     */
046    public interface Entity extends Node {
047        /**
048         * The public identifier associated with the entity if specified, and 
049         * <code>null</code> otherwise.
050         */
051        public String getPublicId();
052    
053        /**
054         * The system identifier associated with the entity if specified, and 
055         * <code>null</code> otherwise. This may be an absolute URI or not.
056         */
057        public String getSystemId();
058    
059        /**
060         * For unparsed entities, the name of the notation for the entity. For 
061         * parsed entities, this is <code>null</code>.
062         */
063        public String getNotationName();
064    
065        /**
066         * An attribute specifying the encoding used for this entity at the time 
067         * of parsing, when it is an external parsed entity. This is 
068         * <code>null</code> if it an entity from the internal subset or if it 
069         * is not known.
070         * @since DOM Level 3
071         */
072        public String getInputEncoding();
073    
074        /**
075         * An attribute specifying, as part of the text declaration, the encoding 
076         * of this entity, when it is an external parsed entity. This is 
077         * <code>null</code> otherwise.
078         * @since DOM Level 3
079         */
080        public String getXmlEncoding();
081    
082        /**
083         * An attribute specifying, as part of the text declaration, the version 
084         * number of this entity, when it is an external parsed entity. This is 
085         * <code>null</code> otherwise.
086         * @since DOM Level 3
087         */
088        public String getXmlVersion();
089    
090    }