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.xpath; 14 15 import org.w3c.dom.Element; 16 import org.w3c.dom.Node; 17 18 /** 19 * The <code>XPathNamespace</code> interface is returned by 20 * <code>XPathResult</code> interfaces to represent the XPath namespace node 21 * type that DOM lacks. There is no public constructor for this node type. 22 * Attempts to place it into a hierarchy or a NamedNodeMap result in a 23 * <code>DOMException</code> with the code <code>HIERARCHY_REQUEST_ERR</code> 24 * . This node is read only, so methods or setting of attributes that would 25 * mutate the node result in a DOMException with the code 26 * <code>NO_MODIFICATION_ALLOWED_ERR</code>. 27 * <p>The core specification describes attributes of the <code>Node</code> 28 * interface that are different for different node types but does not 29 * describe <code>XPATH_NAMESPACE_NODE</code>, so here is a description of 30 * those attributes for this node type. All attributes of <code>Node</code> 31 * not described in this section have a <code>null</code> or 32 * <code>false</code> value. 33 * <p><code>ownerDocument</code> matches the <code>ownerDocument</code> of the 34 * <code>ownerElement</code> even if the element is later adopted. 35 * <p><code>nodeName</code> is always the string "<code>#namespace</code>". 36 * <p><code>prefix</code> is the prefix of the namespace represented by the 37 * node. 38 * <p><code>localName</code> is the same as <code>prefix</code>. 39 * <p><code>nodeType</code> is equal to <code>XPATH_NAMESPACE_NODE</code>. 40 * <p><code>namespaceURI</code> is the namespace URI of the namespace 41 * represented by the node. 42 * <p><code>nodeValue</code> is the same as <code>namespaceURI</code>. 43 * <p><code>adoptNode</code>, <code>cloneNode</code>, and 44 * <code>importNode</code> fail on this node type by raising a 45 * <code>DOMException</code> with the code <code>NOT_SUPPORTED_ERR</code>. 46 * <p ><b>Note:</b> In future versions of the XPath specification, the 47 * definition of a namespace node may be changed incomatibly, in which case 48 * incompatible changes to field values may be required to implement 49 * versions beyond XPath 1.0. 50 * <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>. 51 */ 52 public interface XPathNamespace extends Node { 53 // XPathNodeType 54 /** 55 * The node is a <code>Namespace</code>. 56 */ 57 public static final short XPATH_NAMESPACE_NODE = 13; 58 59 /** 60 * The <code>Element</code> on which the namespace was in scope when it 61 * was requested. This does not change on a returned namespace node even 62 * if the document changes such that the namespace goes out of scope on 63 * that element and this node is no longer found there by XPath. 64 */ 65 public Element getOwnerElement(); 66 67 }