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
013package org.w3c.dom.xpath;
014
015import org.w3c.dom.Element;
016import org.w3c.dom.Node;
017
018/**
019 * The <code>XPathNamespace</code> interface is returned by 
020 * <code>XPathResult</code> interfaces to represent the XPath namespace node 
021 * type that DOM lacks. There is no public constructor for this node type. 
022 * Attempts to place it into a hierarchy or a NamedNodeMap result in a 
023 * <code>DOMException</code> with the code <code>HIERARCHY_REQUEST_ERR</code>
024 * . This node is read only, so methods or setting of attributes that would 
025 * mutate the node result in a DOMException with the code 
026 * <code>NO_MODIFICATION_ALLOWED_ERR</code>.
027 * <p>The core specification describes attributes of the <code>Node</code> 
028 * interface that are different for different node types but does not 
029 * describe <code>XPATH_NAMESPACE_NODE</code>, so here is a description of 
030 * those attributes for this node type. All attributes of <code>Node</code> 
031 * not described in this section have a <code>null</code> or 
032 * <code>false</code> value.
033 * <p><code>ownerDocument</code> matches the <code>ownerDocument</code> of the 
034 * <code>ownerElement</code> even if the element is later adopted.
035 * <p><code>nodeName</code> is always the string "<code>#namespace</code>".
036 * <p><code>prefix</code> is the prefix of the namespace represented by the 
037 * node.
038 * <p><code>localName</code> is the same as <code>prefix</code>.
039 * <p><code>nodeType</code> is equal to <code>XPATH_NAMESPACE_NODE</code>.
040 * <p><code>namespaceURI</code> is the namespace URI of the namespace 
041 * represented by the node.
042 * <p><code>nodeValue</code> is the same as <code>namespaceURI</code>.
043 * <p><code>adoptNode</code>, <code>cloneNode</code>, and 
044 * <code>importNode</code> fail on this node type by raising a 
045 * <code>DOMException</code> with the code <code>NOT_SUPPORTED_ERR</code>.
046 * <p ><b>Note:</b> In future versions of the XPath specification, the 
047 * definition of a namespace node may be changed incomatibly, in which case 
048 * incompatible changes to field values may be required to implement 
049 * versions beyond XPath 1.0.
050 * <p>See also the <a href='http://www.w3.org/TR/2004/NOTE-DOM-Level-3-XPath-20040226'>Document Object Model (DOM) Level 3 XPath Specification</a>.
051 */
052public interface XPathNamespace extends Node {
053    // XPathNodeType
054    /**
055     * The node is a <code>Namespace</code>.
056     */
057    public static final short XPATH_NAMESPACE_NODE      = 13;
058
059    /**
060     * The <code>Element</code> on which the namespace was in scope when it 
061     * was requested. This does not change on a returned namespace node even 
062     * if the document changes such that the namespace goes out of scope on 
063     * that element and this node is no longer found there by XPath.
064     */
065    public Element getOwnerElement();
066
067}