Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/share/classes/javax/imageio/metadata/IIOMetadataNode.java
38918 views
/*1* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425package javax.imageio.metadata;2627import java.util.ArrayList;28import java.util.Iterator;29import java.util.List;3031import org.w3c.dom.Attr;32import org.w3c.dom.Document;33import org.w3c.dom.Element;34import org.w3c.dom.DOMException;35import org.w3c.dom.NamedNodeMap;36import org.w3c.dom.Node;37import org.w3c.dom.NodeList;38import org.w3c.dom.TypeInfo;39import org.w3c.dom.UserDataHandler;404142class IIODOMException extends DOMException {4344public IIODOMException(short code, String message) {45super(code, message);46}47}4849class IIONamedNodeMap implements NamedNodeMap {5051List nodes;5253public IIONamedNodeMap(List nodes) {54this.nodes = nodes;55}5657public int getLength() {58return nodes.size();59}6061public Node getNamedItem(String name) {62Iterator iter = nodes.iterator();63while (iter.hasNext()) {64Node node = (Node)iter.next();65if (name.equals(node.getNodeName())) {66return node;67}68}6970return null;71}7273public Node item(int index) {74Node node = (Node)nodes.get(index);75return node;76}7778public Node removeNamedItem(java.lang.String name) {79throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR,80"This NamedNodeMap is read-only!");81}8283public Node setNamedItem(Node arg) {84throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR,85"This NamedNodeMap is read-only!");86}8788/**89* Equivalent to <code>getNamedItem(localName)</code>.90*/91public Node getNamedItemNS(String namespaceURI, String localName) {92return getNamedItem(localName);93}9495/**96* Equivalent to <code>setNamedItem(arg)</code>.97*/98public Node setNamedItemNS(Node arg) {99return setNamedItem(arg);100}101102/**103* Equivalent to <code>removeNamedItem(localName)</code>.104*/105public Node removeNamedItemNS(String namespaceURI, String localName) {106return removeNamedItem(localName);107}108}109110class IIONodeList implements NodeList {111112List nodes;113114public IIONodeList(List nodes) {115this.nodes = nodes;116}117118public int getLength() {119return nodes.size();120}121122public Node item(int index) {123if (index < 0 || index >= nodes.size()) {124return null;125}126return (Node)nodes.get(index);127}128}129130class IIOAttr extends IIOMetadataNode implements Attr {131132Element owner;133String name;134String value;135136public IIOAttr(Element owner, String name, String value) {137this.owner = owner;138this.name = name;139this.value = value;140}141142public String getName() {143return name;144}145146public String getNodeName() {147return name;148}149150public short getNodeType() {151return ATTRIBUTE_NODE;152}153154public boolean getSpecified() {155return true;156}157158public String getValue() {159return value;160}161162public String getNodeValue() {163return value;164}165166public void setValue(String value) {167this.value = value;168}169170public void setNodeValue(String value) {171this.value = value;172}173174public Element getOwnerElement() {175return owner;176}177178public void setOwnerElement(Element owner) {179this.owner = owner;180}181182/** This method is new in the DOM L3 for Attr interface.183* Could throw DOMException here, but its probably OK184* to always return false. One reason for this, is we have no good185* way to document this exception, since this class, IIOAttr,186* is not a public class. The rest of the methods that throw187* DOMException are publically documented as such on IIOMetadataNode.188* @return false189*/190public boolean isId() {191return false;192}193194195}196197/**198* A class representing a node in a meta-data tree, which implements199* the <a200* href="../../../../api/org/w3c/dom/Element.html">201* <code>org.w3c.dom.Element</code></a> interface and additionally allows202* for the storage of non-textual objects via the203* <code>getUserObject</code> and <code>setUserObject</code> methods.204*205* <p> This class is not intended to be used for general XML206* processing. In particular, <code>Element</code> nodes created207* within the Image I/O API are not compatible with those created by208* Sun's standard implementation of the <code>org.w3.dom</code> API.209* In particular, the implementation is tuned for simple uses and may210* not perform well for intensive processing.211*212* <p> Namespaces are ignored in this implementation. The terms "tag213* name" and "node name" are always considered to be synonymous.214*215* <em>Note:</em>216* The DOM Level 3 specification added a number of new methods to the217* {@code Node}, {@code Element} and {@code Attr} interfaces that are not218* of value to the {@code IIOMetadataNode} implementation or specification.219*220* Calling such methods on an {@code IIOMetadataNode}, or an {@code Attr}221* instance returned from an {@code IIOMetadataNode} will result in a222* {@code DOMException} being thrown.223*224* @see IIOMetadata#getAsTree225* @see IIOMetadata#setFromTree226* @see IIOMetadata#mergeTree227*228*/229public class IIOMetadataNode implements Element, NodeList {230231/**232* The name of the node as a <code>String</code>.233*/234private String nodeName = null;235236/**237* The value of the node as a <code>String</code>. The Image I/O238* API typically does not make use of the node value.239*/240private String nodeValue = null;241242/**243* The <code>Object</code> value associated with this node.244*/245private Object userObject = null;246247/**248* The parent node of this node, or <code>null</code> if this node249* forms the root of its own tree.250*/251private IIOMetadataNode parent = null;252253/**254* The number of child nodes.255*/256private int numChildren = 0;257258/**259* The first (leftmost) child node of this node, or260* <code>null</code> if this node is a leaf node.261*/262private IIOMetadataNode firstChild = null;263264/**265* The last (rightmost) child node of this node, or266* <code>null</code> if this node is a leaf node.267*/268private IIOMetadataNode lastChild = null;269270/**271* The next (right) sibling node of this node, or272* <code>null</code> if this node is its parent's last child node.273*/274private IIOMetadataNode nextSibling = null;275276/**277* The previous (left) sibling node of this node, or278* <code>null</code> if this node is its parent's first child node.279*/280private IIOMetadataNode previousSibling = null;281282/**283* A <code>List</code> of <code>IIOAttr</code> nodes representing284* attributes.285*/286private List attributes = new ArrayList();287288/**289* Constructs an empty <code>IIOMetadataNode</code>.290*/291public IIOMetadataNode() {}292293/**294* Constructs an <code>IIOMetadataNode</code> with a given node295* name.296*297* @param nodeName the name of the node, as a <code>String</code>.298*/299public IIOMetadataNode(String nodeName) {300this.nodeName = nodeName;301}302303/**304* Check that the node is either <code>null</code> or an305* <code>IIOMetadataNode</code>.306*/307private void checkNode(Node node) throws DOMException {308if (node == null) {309return;310}311if (!(node instanceof IIOMetadataNode)) {312throw new IIODOMException(DOMException.WRONG_DOCUMENT_ERR,313"Node not an IIOMetadataNode!");314}315}316317// Methods from Node318319/**320* Returns the node name associated with this node.321*322* @return the node name, as a <code>String</code>.323*/324public String getNodeName() {325return nodeName;326}327328/**329* Returns the value associated with this node.330*331* @return the node value, as a <code>String</code>.332*/333public String getNodeValue(){334return nodeValue;335}336337/**338* Sets the <code>String</code> value associated with this node.339*/340public void setNodeValue(String nodeValue) {341this.nodeValue = nodeValue;342}343344/**345* Returns the node type, which is always346* <code>ELEMENT_NODE</code>.347*348* @return the <code>short</code> value <code>ELEMENT_NODE</code>.349*/350public short getNodeType() {351return ELEMENT_NODE;352}353354/**355* Returns the parent of this node. A <code>null</code> value356* indicates that the node is the root of its own tree. To add a357* node to an existing tree, use one of the358* <code>insertBefore</code>, <code>replaceChild</code>, or359* <code>appendChild</code> methods.360*361* @return the parent, as a <code>Node</code>.362*363* @see #insertBefore364* @see #replaceChild365* @see #appendChild366*/367public Node getParentNode() {368return parent;369}370371/**372* Returns a <code>NodeList</code> that contains all children of this node.373* If there are no children, this is a <code>NodeList</code> containing374* no nodes.375*376* @return the children as a <code>NodeList</code>377*/378public NodeList getChildNodes() {379return this;380}381382/**383* Returns the first child of this node, or <code>null</code> if384* the node has no children.385*386* @return the first child, as a <code>Node</code>, or387* <code>null</code>388*/389public Node getFirstChild() {390return firstChild;391}392393/**394* Returns the last child of this node, or <code>null</code> if395* the node has no children.396*397* @return the last child, as a <code>Node</code>, or398* <code>null</code>.399*/400public Node getLastChild() {401return lastChild;402}403404/**405* Returns the previous sibling of this node, or <code>null</code>406* if this node has no previous sibling.407*408* @return the previous sibling, as a <code>Node</code>, or409* <code>null</code>.410*/411public Node getPreviousSibling() {412return previousSibling;413}414415/**416* Returns the next sibling of this node, or <code>null</code> if417* the node has no next sibling.418*419* @return the next sibling, as a <code>Node</code>, or420* <code>null</code>.421*/422public Node getNextSibling() {423return nextSibling;424}425426/**427* Returns a <code>NamedNodeMap</code> containing the attributes of428* this node.429*430* @return a <code>NamedNodeMap</code> containing the attributes of431* this node.432*/433public NamedNodeMap getAttributes() {434return new IIONamedNodeMap(attributes);435}436437/**438* Returns <code>null</code>, since <code>IIOMetadataNode</code>s439* do not belong to any <code>Document</code>.440*441* @return <code>null</code>.442*/443public Document getOwnerDocument() {444return null;445}446447/**448* Inserts the node <code>newChild</code> before the existing449* child node <code>refChild</code>. If <code>refChild</code> is450* <code>null</code>, insert <code>newChild</code> at the end of451* the list of children.452*453* @param newChild the <code>Node</code> to insert.454* @param refChild the reference <code>Node</code>.455*456* @return the node being inserted.457*458* @exception IllegalArgumentException if <code>newChild</code> is459* <code>null</code>.460*/461public Node insertBefore(Node newChild,462Node refChild) {463if (newChild == null) {464throw new IllegalArgumentException("newChild == null!");465}466467checkNode(newChild);468checkNode(refChild);469470IIOMetadataNode newChildNode = (IIOMetadataNode)newChild;471IIOMetadataNode refChildNode = (IIOMetadataNode)refChild;472473// Siblings, can be null.474IIOMetadataNode previous = null;475IIOMetadataNode next = null;476477if (refChild == null) {478previous = this.lastChild;479next = null;480this.lastChild = newChildNode;481} else {482previous = refChildNode.previousSibling;483next = refChildNode;484}485486if (previous != null) {487previous.nextSibling = newChildNode;488}489if (next != null) {490next.previousSibling = newChildNode;491}492493newChildNode.parent = this;494newChildNode.previousSibling = previous;495newChildNode.nextSibling = next;496497// N.B.: O.K. if refChild == null498if (this.firstChild == refChildNode) {499this.firstChild = newChildNode;500}501502++numChildren;503return newChildNode;504}505506/**507* Replaces the child node <code>oldChild</code> with508* <code>newChild</code> in the list of children, and returns the509* <code>oldChild</code> node.510*511* @param newChild the <code>Node</code> to insert.512* @param oldChild the <code>Node</code> to be replaced.513*514* @return the node replaced.515*516* @exception IllegalArgumentException if <code>newChild</code> is517* <code>null</code>.518*/519public Node replaceChild(Node newChild,520Node oldChild) {521if (newChild == null) {522throw new IllegalArgumentException("newChild == null!");523}524525checkNode(newChild);526checkNode(oldChild);527528IIOMetadataNode newChildNode = (IIOMetadataNode)newChild;529IIOMetadataNode oldChildNode = (IIOMetadataNode)oldChild;530531IIOMetadataNode previous = oldChildNode.previousSibling;532IIOMetadataNode next = oldChildNode.nextSibling;533534if (previous != null) {535previous.nextSibling = newChildNode;536}537if (next != null) {538next.previousSibling = newChildNode;539}540541newChildNode.parent = this;542newChildNode.previousSibling = previous;543newChildNode.nextSibling = next;544545if (firstChild == oldChildNode) {546firstChild = newChildNode;547}548if (lastChild == oldChildNode) {549lastChild = newChildNode;550}551552oldChildNode.parent = null;553oldChildNode.previousSibling = null;554oldChildNode.nextSibling = null;555556return oldChildNode;557}558559/**560* Removes the child node indicated by <code>oldChild</code> from561* the list of children, and returns it.562*563* @param oldChild the <code>Node</code> to be removed.564*565* @return the node removed.566*567* @exception IllegalArgumentException if <code>oldChild</code> is568* <code>null</code>.569*/570public Node removeChild(Node oldChild) {571if (oldChild == null) {572throw new IllegalArgumentException("oldChild == null!");573}574checkNode(oldChild);575576IIOMetadataNode oldChildNode = (IIOMetadataNode)oldChild;577578IIOMetadataNode previous = oldChildNode.previousSibling;579IIOMetadataNode next = oldChildNode.nextSibling;580581if (previous != null) {582previous.nextSibling = next;583}584if (next != null) {585next.previousSibling = previous;586}587588if (this.firstChild == oldChildNode) {589this.firstChild = next;590}591if (this.lastChild == oldChildNode) {592this.lastChild = previous;593}594595oldChildNode.parent = null;596oldChildNode.previousSibling = null;597oldChildNode.nextSibling = null;598599--numChildren;600return oldChildNode;601}602603/**604* Adds the node <code>newChild</code> to the end of the list of605* children of this node.606*607* @param newChild the <code>Node</code> to insert.608*609* @return the node added.610*611* @exception IllegalArgumentException if <code>newChild</code> is612* <code>null</code>.613*/614public Node appendChild(Node newChild) {615if (newChild == null) {616throw new IllegalArgumentException("newChild == null!");617}618checkNode(newChild);619620// insertBefore will increment numChildren621return insertBefore(newChild, null);622}623624/**625* Returns <code>true</code> if this node has child nodes.626*627* @return <code>true</code> if this node has children.628*/629public boolean hasChildNodes() {630return numChildren > 0;631}632633/**634* Returns a duplicate of this node. The duplicate node has no635* parent (<code>getParentNode</code> returns <code>null</code>).636* If a shallow clone is being performed (<code>deep</code> is637* <code>false</code>), the new node will not have any children or638* siblings. If a deep clone is being performed, the new node639* will form the root of a complete cloned subtree.640*641* @param deep if <code>true</code>, recursively clone the subtree642* under the specified node; if <code>false</code>, clone only the643* node itself.644*645* @return the duplicate node.646*/647public Node cloneNode(boolean deep) {648IIOMetadataNode newNode = new IIOMetadataNode(this.nodeName);649newNode.setUserObject(getUserObject());650// Attributes651652if (deep) {653for (IIOMetadataNode child = firstChild;654child != null;655child = child.nextSibling) {656newNode.appendChild(child.cloneNode(true));657}658}659660return newNode;661}662663/**664* Does nothing, since <code>IIOMetadataNode</code>s do not665* contain <code>Text</code> children.666*/667public void normalize() {668}669670/**671* Returns <code>false</code> since DOM features are not672* supported.673*674* @return <code>false</code>.675*676* @param feature a <code>String</code>, which is ignored.677* @param version a <code>String</code>, which is ignored.678*/679public boolean isSupported(String feature, String version) {680return false;681}682683/**684* Returns <code>null</code>, since namespaces are not supported.685*/686public String getNamespaceURI() throws DOMException {687return null;688}689690/**691* Returns <code>null</code>, since namespaces are not supported.692*693* @return <code>null</code>.694*695* @see #setPrefix696*/697public String getPrefix() {698return null;699}700701/**702* Does nothing, since namespaces are not supported.703*704* @param prefix a <code>String</code>, which is ignored.705*706* @see #getPrefix707*/708public void setPrefix(String prefix) {709}710711/**712* Equivalent to <code>getNodeName</code>.713*714* @return the node name, as a <code>String</code>.715*/716public String getLocalName() {717return nodeName;718}719720// Methods from Element721722723/**724* Equivalent to <code>getNodeName</code>.725*726* @return the node name, as a <code>String</code>727*/728public String getTagName() {729return nodeName;730}731732/**733* Retrieves an attribute value by name.734* @param name The name of the attribute to retrieve.735* @return The <code>Attr</code> value as a string, or the empty string736* if that attribute does not have a specified or default value.737*/738public String getAttribute(String name) {739Attr attr = getAttributeNode(name);740if (attr == null) {741return "";742}743return attr.getValue();744}745746/**747* Equivalent to <code>getAttribute(localName)</code>.748*749* @see #setAttributeNS750*/751public String getAttributeNS(String namespaceURI, String localName) {752return getAttribute(localName);753}754755public void setAttribute(String name, String value) {756// Name must be valid unicode chars757boolean valid = true;758char[] chs = name.toCharArray();759for (int i=0;i<chs.length;i++) {760if (chs[i] >= 0xfffe) {761valid = false;762break;763}764}765if (!valid) {766throw new IIODOMException(DOMException.INVALID_CHARACTER_ERR,767"Attribute name is illegal!");768}769removeAttribute(name, false);770attributes.add(new IIOAttr(this, name, value));771}772773/**774* Equivalent to <code>setAttribute(qualifiedName, value)</code>.775*776* @see #getAttributeNS777*/778public void setAttributeNS(String namespaceURI,779String qualifiedName, String value) {780setAttribute(qualifiedName, value);781}782783public void removeAttribute(String name) {784removeAttribute(name, true);785}786787private void removeAttribute(String name, boolean checkPresent) {788int numAttributes = attributes.size();789for (int i = 0; i < numAttributes; i++) {790IIOAttr attr = (IIOAttr)attributes.get(i);791if (name.equals(attr.getName())) {792attr.setOwnerElement(null);793attributes.remove(i);794return;795}796}797798// If we get here, the attribute doesn't exist799if (checkPresent) {800throw new IIODOMException(DOMException.NOT_FOUND_ERR,801"No such attribute!");802}803}804805/**806* Equivalent to <code>removeAttribute(localName)</code>.807*/808public void removeAttributeNS(String namespaceURI,809String localName) {810removeAttribute(localName);811}812813public Attr getAttributeNode(String name) {814Node node = getAttributes().getNamedItem(name);815return (Attr)node;816}817818/**819* Equivalent to <code>getAttributeNode(localName)</code>.820*821* @see #setAttributeNodeNS822*/823public Attr getAttributeNodeNS(String namespaceURI,824String localName) {825return getAttributeNode(localName);826}827828public Attr setAttributeNode(Attr newAttr) throws DOMException {829Element owner = newAttr.getOwnerElement();830if (owner != null) {831if (owner == this) {832return null;833} else {834throw new DOMException(DOMException.INUSE_ATTRIBUTE_ERR,835"Attribute is already in use");836}837}838839IIOAttr attr;840if (newAttr instanceof IIOAttr) {841attr = (IIOAttr)newAttr;842attr.setOwnerElement(this);843} else {844attr = new IIOAttr(this,845newAttr.getName(),846newAttr.getValue());847}848849Attr oldAttr = getAttributeNode(attr.getName());850if (oldAttr != null) {851removeAttributeNode(oldAttr);852}853854attributes.add(attr);855856return oldAttr;857}858859/**860* Equivalent to <code>setAttributeNode(newAttr)</code>.861*862* @see #getAttributeNodeNS863*/864public Attr setAttributeNodeNS(Attr newAttr) {865return setAttributeNode(newAttr);866}867868public Attr removeAttributeNode(Attr oldAttr) {869removeAttribute(oldAttr.getName());870return oldAttr;871}872873public NodeList getElementsByTagName(String name) {874List l = new ArrayList();875getElementsByTagName(name, l);876return new IIONodeList(l);877}878879private void getElementsByTagName(String name, List l) {880if (nodeName.equals(name) || "*".equals(name)) {881l.add(this);882}883884Node child = getFirstChild();885while (child != null) {886((IIOMetadataNode)child).getElementsByTagName(name, l);887child = child.getNextSibling();888}889}890891/**892* Equivalent to <code>getElementsByTagName(localName)</code>.893*/894public NodeList getElementsByTagNameNS(String namespaceURI,895String localName) {896return getElementsByTagName(localName);897}898899public boolean hasAttributes() {900return attributes.size() > 0;901}902903public boolean hasAttribute(String name) {904return getAttributeNode(name) != null;905}906907/**908* Equivalent to <code>hasAttribute(localName)</code>.909*/910public boolean hasAttributeNS(String namespaceURI,911String localName) {912return hasAttribute(localName);913}914915// Methods from NodeList916917public int getLength() {918return numChildren;919}920921public Node item(int index) {922if (index < 0) {923return null;924}925926Node child = getFirstChild();927while (child != null && index-- > 0) {928child = child.getNextSibling();929}930return child;931}932933/**934* Returns the <code>Object</code> value associated with this node.935*936* @return the user <code>Object</code>.937*938* @see #setUserObject939*/940public Object getUserObject() {941return userObject;942}943944/**945* Sets the value associated with this node.946*947* @param userObject the user <code>Object</code>.948*949* @see #getUserObject950*/951public void setUserObject(Object userObject) {952this.userObject = userObject;953}954955// Start of dummy methods for DOM L3.956957/**958* This DOM Level 3 method is not supported for {@code IIOMetadataNode}959* and will throw a {@code DOMException}.960* @throws DOMException - always.961*/962public void setIdAttribute(String name,963boolean isId)964throws DOMException {965throw new DOMException(DOMException.NOT_SUPPORTED_ERR,966"Method not supported");967}968969/**970* This DOM Level 3 method is not supported for {@code IIOMetadataNode}971* and will throw a {@code DOMException}.972* @throws DOMException - always.973*/974public void setIdAttributeNS(String namespaceURI,975String localName,976boolean isId)977throws DOMException {978throw new DOMException(DOMException.NOT_SUPPORTED_ERR,979"Method not supported");980}981982/**983* This DOM Level 3 method is not supported for {@code IIOMetadataNode}984* and will throw a {@code DOMException}.985* @throws DOMException - always.986*/987public void setIdAttributeNode(Attr idAttr,988boolean isId)989throws DOMException {990throw new DOMException(DOMException.NOT_SUPPORTED_ERR,991"Method not supported");992}993994/**995* This DOM Level 3 method is not supported for {@code IIOMetadataNode}996* and will throw a {@code DOMException}.997* @throws DOMException - always.998*/999public TypeInfo getSchemaTypeInfo() throws DOMException {1000throw new DOMException(DOMException.NOT_SUPPORTED_ERR,1001"Method not supported");1002}10031004/**1005* This DOM Level 3 method is not supported for {@code IIOMetadataNode}1006* and will throw a {@code DOMException}.1007* @throws DOMException - always.1008*/1009public Object setUserData(String key,1010Object data,1011UserDataHandler handler) throws DOMException {1012throw new DOMException(DOMException.NOT_SUPPORTED_ERR,1013"Method not supported");1014}10151016/**1017* This DOM Level 3 method is not supported for {@code IIOMetadataNode}1018* and will throw a {@code DOMException}.1019* @throws DOMException - always.1020*/1021public Object getUserData(String key) throws DOMException {1022throw new DOMException(DOMException.NOT_SUPPORTED_ERR,1023"Method not supported");1024}10251026/**1027* This DOM Level 3 method is not supported for {@code IIOMetadataNode}1028* and will throw a {@code DOMException}.1029* @throws DOMException - always.1030*/1031public Object getFeature(String feature, String version)1032throws DOMException {1033throw new DOMException(DOMException.NOT_SUPPORTED_ERR,1034"Method not supported");1035}10361037/**1038* This DOM Level 3 method is not supported for {@code IIOMetadataNode}1039* and will throw a {@code DOMException}.1040* @throws DOMException - always.1041*/1042public boolean isSameNode(Node node) throws DOMException {1043throw new DOMException(DOMException.NOT_SUPPORTED_ERR,1044"Method not supported");1045}10461047/**1048* This DOM Level 3 method is not supported for {@code IIOMetadataNode}1049* and will throw a {@code DOMException}.1050* @throws DOMException - always.1051*/1052public boolean isEqualNode(Node node) throws DOMException {1053throw new DOMException(DOMException.NOT_SUPPORTED_ERR,1054"Method not supported");1055}10561057/**1058* This DOM Level 3 method is not supported for {@code IIOMetadataNode}1059* and will throw a {@code DOMException}.1060* @throws DOMException - always.1061*/1062public String lookupNamespaceURI(String prefix) throws DOMException {1063throw new DOMException(DOMException.NOT_SUPPORTED_ERR,1064"Method not supported");1065}10661067/**1068* This DOM Level 3 method is not supported for {@code IIOMetadataNode}1069* and will throw a {@code DOMException}.1070* @throws DOMException - always.1071*/1072public boolean isDefaultNamespace(String namespaceURI)1073throws DOMException {1074throw new DOMException(DOMException.NOT_SUPPORTED_ERR,1075"Method not supported");1076}10771078/**1079* This DOM Level 3 method is not supported for {@code IIOMetadataNode}1080* and will throw a {@code DOMException}.1081* @throws DOMException - always.1082*/1083public String lookupPrefix(String namespaceURI) throws DOMException {1084throw new DOMException(DOMException.NOT_SUPPORTED_ERR,1085"Method not supported");1086}10871088/**1089* This DOM Level 3 method is not supported for {@code IIOMetadataNode}1090* and will throw a {@code DOMException}.1091* @throws DOMException - always.1092*/1093public String getTextContent() throws DOMException {1094throw new DOMException(DOMException.NOT_SUPPORTED_ERR,1095"Method not supported");1096}10971098/**1099* This DOM Level 3 method is not supported for {@code IIOMetadataNode}1100* and will throw a {@code DOMException}.1101* @throws DOMException - always.1102*/1103public void setTextContent(String textContent) throws DOMException {1104throw new DOMException(DOMException.NOT_SUPPORTED_ERR,1105"Method not supported");1106}11071108/**1109* This DOM Level 3 method is not supported for {@code IIOMetadataNode}1110* and will throw a {@code DOMException}.1111* @throws DOMException - always.1112*/1113public short compareDocumentPosition(Node other)1114throws DOMException {1115throw new DOMException(DOMException.NOT_SUPPORTED_ERR,1116"Method not supported");1117}11181119/**1120* This DOM Level 3 method is not supported for {@code IIOMetadataNode}1121* and will throw a {@code DOMException}.1122* @throws DOMException - always.1123*/1124public String getBaseURI() throws DOMException {1125throw new DOMException(DOMException.NOT_SUPPORTED_ERR,1126"Method not supported");1127}1128//End of dummy methods for DOM L3.112911301131}113211331134