diff options
Diffstat (limited to 'libjava/gnu/xml/dom')
24 files changed, 177 insertions, 725 deletions
diff --git a/libjava/gnu/xml/dom/Consumer.java b/libjava/gnu/xml/dom/Consumer.java index 1aad5be9273..426b1e5da62 100644 --- a/libjava/gnu/xml/dom/Consumer.java +++ b/libjava/gnu/xml/dom/Consumer.java @@ -38,16 +38,11 @@ exception statement from your version. */ package gnu.xml.dom; -import java.io.IOException; - -import org.w3c.dom.Document; import org.w3c.dom.DocumentType; -import org.w3c.dom.DOMImplementation; import org.w3c.dom.Node; import org.w3c.dom.Text; import org.xml.sax.Attributes; -import org.xml.sax.ErrorHandler; import org.xml.sax.SAXException; import org.xml.sax.ext.Attributes2; diff --git a/libjava/gnu/xml/dom/DomAttr.java b/libjava/gnu/xml/dom/DomAttr.java index 2890430e315..555902e3ea3 100644 --- a/libjava/gnu/xml/dom/DomAttr.java +++ b/libjava/gnu/xml/dom/DomAttr.java @@ -38,6 +38,7 @@ exception statement from your version. */ package gnu.xml.dom; import org.w3c.dom.Attr; +import org.w3c.dom.DOMException; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.TypeInfo; @@ -194,7 +195,7 @@ public class DomAttr { if (readonly) { - throw new DomEx(DomEx.NO_MODIFICATION_ALLOWED_ERR); + throw new DomDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR); } if (value == null) { @@ -284,11 +285,11 @@ public class DomAttr { if (parent != null) { - throw new DomEx (DomEx.HIERARCHY_REQUEST_ERR); + throw new DomDOMException(DOMException.HIERARCHY_REQUEST_ERR); } if (!(e instanceof DomElement)) { - throw new DomEx(DomEx.WRONG_DOCUMENT_ERR); + throw new DomDOMException(DOMException.WRONG_DOCUMENT_ERR); } parent = (DomElement) e; depth = parent.depth + 1; diff --git a/libjava/gnu/xml/dom/DomCDATA.java b/libjava/gnu/xml/dom/DomCDATA.java deleted file mode 100644 index f6f471c68f2..00000000000 --- a/libjava/gnu/xml/dom/DomCDATA.java +++ /dev/null @@ -1,91 +0,0 @@ -/* DomCDATA.java -- - Copyright (C) 1999,2000,2001,2004 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. - -GNU Classpath is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - -package gnu.xml.dom; - -import org.w3c.dom.CDATASection; - -/** - * <p> "CDATASection" implementation. - * This is a non-core DOM class, supporting the "XML" feature. - * CDATA sections are just ways to represent text using different - * delimeters. </p> - * - * <p> <em>You are strongly advised not to use CDATASection nodes.</em> - * The advantage of having slightly prettier ways to print text that may - * have lots of embedded XML delimiters, such as "&" and "<", - * can be dwarfed by the cost of dealing with multiple kinds of text - * nodes in all your algorithms. </p> - * - * @author David Brownell - * @author <a href='mailto:dog@gnu.org'>Chris Burdess</a> - */ -public class DomCDATA - extends DomText - implements CDATASection -{ - - /** - * Constructs a CDATA section node associated with the specified - * document and holding the specified data. - * - * <p>This constructor should only be invoked by a Document as part of - * its createCDATASection functionality, or through a subclass which is - * similarly used in a "Sub-DOM" style layer. - * - */ - protected DomCDATA(DomDocument owner, String value) - { - super(CDATA_SECTION_NODE, owner, value); - } - - protected DomCDATA(DomDocument owner, char buf [], int off, int len) - { - super(CDATA_SECTION_NODE, owner, buf, off, len); - } - - /** - * <b>DOM L1</b> - * Returns the string "#cdata-section". - */ - final public String getNodeName() - { - return "#cdata-section"; - } - -} - diff --git a/libjava/gnu/xml/dom/DomCharacterData.java b/libjava/gnu/xml/dom/DomCharacterData.java index 48ccb82d638..e5cc231891d 100644 --- a/libjava/gnu/xml/dom/DomCharacterData.java +++ b/libjava/gnu/xml/dom/DomCharacterData.java @@ -38,8 +38,7 @@ exception statement from your version. */ package gnu.xml.dom; import org.w3c.dom.CharacterData; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; +import org.w3c.dom.DOMException; import org.w3c.dom.events.MutationEvent; @@ -82,7 +81,7 @@ public abstract class DomCharacterData { if (isReadonly()) { - throw new DomEx(DomEx.NO_MODIFICATION_ALLOWED_ERR); + throw new DomDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR); } String value = text + arg; mutating(value); @@ -98,12 +97,12 @@ public abstract class DomCharacterData { if (isReadonly()) { - throw new DomEx(DomEx.NO_MODIFICATION_ALLOWED_ERR); + throw new DomDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR); } char[] raw = text.toCharArray(); if (offset < 0 || count < 0 || offset > raw.length) { - throw new DomEx(DomEx.INDEX_SIZE_ERR); + throw new DomDOMException(DOMException.INDEX_SIZE_ERR); } if ((offset + count) > raw.length) { @@ -125,7 +124,7 @@ public abstract class DomCharacterData } catch (IndexOutOfBoundsException x) { - throw new DomEx(DomEx.INDEX_SIZE_ERR); + throw new DomDOMException(DOMException.INDEX_SIZE_ERR); } } @@ -164,7 +163,7 @@ public abstract class DomCharacterData { if (isReadonly()) { - throw new DomEx(DomEx.NO_MODIFICATION_ALLOWED_ERR); + throw new DomDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR); } char[] raw = text.toCharArray(); char[] tmp = arg.toCharArray (); @@ -182,7 +181,7 @@ public abstract class DomCharacterData } catch (IndexOutOfBoundsException x) { - throw new DomEx(DomEx.INDEX_SIZE_ERR); + throw new DomDOMException(DOMException.INDEX_SIZE_ERR); } } @@ -195,14 +194,14 @@ public abstract class DomCharacterData { if (readonly) { - throw new DomEx(DomEx.NO_MODIFICATION_ALLOWED_ERR); + throw new DomDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR); } char[] raw = text.toCharArray(); // deleteData if (offset < 0 || count < 0 || offset > raw.length) { - throw new DomEx(DomEx.INDEX_SIZE_ERR); + throw new DomDOMException(DOMException.INDEX_SIZE_ERR); } if ((offset + count) > raw.length) { @@ -228,7 +227,7 @@ public abstract class DomCharacterData } catch (IndexOutOfBoundsException x) { - throw new DomEx(DomEx.INDEX_SIZE_ERR); + throw new DomDOMException(DOMException.INDEX_SIZE_ERR); } } @@ -241,7 +240,7 @@ public abstract class DomCharacterData { if (isReadonly()) { - throw new DomEx (DomEx.NO_MODIFICATION_ALLOWED_ERR); + throw new DomDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR); } if (value == null) { @@ -276,7 +275,7 @@ public abstract class DomCharacterData { return text.substring(offset); } - throw new DomEx(DomEx.INDEX_SIZE_ERR); + throw new DomDOMException(DOMException.INDEX_SIZE_ERR); } } diff --git a/libjava/gnu/xml/dom/DomDoctype.java b/libjava/gnu/xml/dom/DomDoctype.java index 35fb613e55a..8c760a5317f 100644 --- a/libjava/gnu/xml/dom/DomDoctype.java +++ b/libjava/gnu/xml/dom/DomDoctype.java @@ -39,6 +39,7 @@ package gnu.xml.dom; import java.util.HashMap; import org.w3c.dom.DocumentType; +import org.w3c.dom.DOMException; import org.w3c.dom.DOMImplementation; import org.w3c.dom.Entity; import org.w3c.dom.NamedNodeMap; @@ -194,7 +195,7 @@ public class DomDoctype } if (isReadonly()) { - throw new DomEx(DomEx.NO_MODIFICATION_ALLOWED_ERR); + throw new DomDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR); } getEntities(); @@ -250,7 +251,7 @@ public class DomDoctype if (isReadonly()) { - throw new DomEx(DomEx.NO_MODIFICATION_ALLOWED_ERR); + throw new DomDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR); } getNotations(); diff --git a/libjava/gnu/xml/dom/DomDocument.java b/libjava/gnu/xml/dom/DomDocument.java index 10693ae1d58..d8ccc9d821c 100644 --- a/libjava/gnu/xml/dom/DomDocument.java +++ b/libjava/gnu/xml/dom/DomDocument.java @@ -54,7 +54,6 @@ import org.w3c.dom.Entity; import org.w3c.dom.EntityReference; import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; -import org.w3c.dom.NodeList; import org.w3c.dom.Notation; import org.w3c.dom.ProcessingInstruction; import org.w3c.dom.Text; @@ -292,16 +291,16 @@ public class DomDocument if (newChild.getNodeType() == ELEMENT_NODE && getDocumentElement() != null) { - throw new DomEx (DomEx.HIERARCHY_REQUEST_ERR, - "document element already present: " + - getDocumentElement(), newChild, 0); + throw new DomDOMException(DOMException.HIERARCHY_REQUEST_ERR, + "document element already present: " + + getDocumentElement(), newChild, 0); } if (newChild.getNodeType() == DOCUMENT_TYPE_NODE && getDoctype() != null) { - throw new DomEx (DomEx.HIERARCHY_REQUEST_ERR, - "document type already present: " + - getDoctype(), newChild, 0); + throw new DomDOMException(DOMException.HIERARCHY_REQUEST_ERR, + "document type already present: " + + getDoctype(), newChild, 0); } } @@ -376,12 +375,12 @@ public class DomDocument { if (name == null) { - throw new DomEx (DomEx.NAMESPACE_ERR, name, null, 0); + throw new DomDOMException(DOMException.NAMESPACE_ERR, name, null, 0); } int len = name.length(); if (len == 0) { - throw new DomEx (DomEx.NAMESPACE_ERR, name, null, 0); + throw new DomDOMException(DOMException.NAMESPACE_ERR, name, null, 0); } // dog: rewritten to use the rules for XML 1.0 and 1.1 @@ -407,7 +406,8 @@ public class DomDocument (c < 0xfdf0 || c > 0xfffd) && (c < 0x10000 || c > 0xeffff)) { - throw new DomEx(DomEx.INVALID_CHARACTER_ERR, name, null, c); + throw new DomDOMException(DOMException.INVALID_CHARACTER_ERR, + name, null, c); } } else @@ -425,14 +425,16 @@ public class DomDocument (c >= 0x20dd && c <= 0x20e0)) { // Compatibility area and Unicode 2.0 exclusions - throw new DomEx(DomEx.INVALID_CHARACTER_ERR, name, null, c); + throw new DomDOMException(DOMException.INVALID_CHARACTER_ERR, + name, null, c); } break; default: if (c != ':' && c != '_' && (c < 0x02bb || c > 0x02c1) && c != 0x0559 && c != 0x06e5 && c != 0x06e6) { - throw new DomEx(DomEx.INVALID_CHARACTER_ERR, name, null, c); + throw new DomDOMException(DOMException.INVALID_CHARACTER_ERR, + name, null, c); } } } @@ -464,7 +466,8 @@ public class DomDocument (c < 0x0300 || c > 0x036f) && (c < 0x203f || c > 0x2040)) { - throw new DomEx(DomEx.INVALID_CHARACTER_ERR, name, null, c); + throw new DomDOMException(DOMException.INVALID_CHARACTER_ERR, name, + null, c); } } else @@ -487,7 +490,8 @@ public class DomDocument (c >= 0x20dd && c <= 0x20e0)) { // Compatibility area and Unicode 2.0 exclusions - throw new DomEx(DomEx.INVALID_CHARACTER_ERR, name, null, c); + throw new DomDOMException(DOMException.INVALID_CHARACTER_ERR, + name, null, c); } break; default: @@ -495,7 +499,8 @@ public class DomDocument c != 0x0387 && (c < 0x02bb || c > 0x02c1) && c != 0x0559 && c != 0x06e5 && c != 0x06e6 && c != 0x00b7) { - throw new DomEx(DomEx.INVALID_CHARACTER_ERR, name, null, c); + throw new DomDOMException(DOMException.INVALID_CHARACTER_ERR, + name, null, c); } } } @@ -517,7 +522,8 @@ public class DomDocument if (index == 0 || index == (len - 1) || name.lastIndexOf(':') != index) { - throw new DomEx(DomEx.NAMESPACE_ERR, name, null, 0); + throw new DomDOMException(DOMException.NAMESPACE_ERR, + name, null, 0); } } } @@ -552,8 +558,8 @@ public class DomDocument continue; } } - throw new DomEx(DomEx.INVALID_CHARACTER_ERR, - new String(buf, off, len), null, c); + throw new DomDOMException(DOMException.INVALID_CHARACTER_ERR, + new String(buf, off, len), null, c); } } @@ -602,22 +608,23 @@ public class DomDocument if (namespaceURI != null && !XMLConstants.XML_NS_URI.equals(namespaceURI)) { - throw new DomEx(DomEx.NAMESPACE_ERR, - "xml namespace is always " + - XMLConstants.XML_NS_URI, this, 0); + throw new DomDOMException(DOMException.NAMESPACE_ERR, + "xml namespace is always " + + XMLConstants.XML_NS_URI, this, 0); } namespaceURI = XMLConstants.XML_NS_URI; } else if (XMLConstants.XMLNS_ATTRIBUTE.equals(name) || name.startsWith("xmlns:")) { - throw new DomEx(DomEx.NAMESPACE_ERR, - "xmlns is reserved", this, 0); + throw new DomDOMException(DOMException.NAMESPACE_ERR, + "xmlns is reserved", this, 0); } else if (namespaceURI == null && name.indexOf(':') != -1) { - throw new DomEx(DomEx.NAMESPACE_ERR, - "prefixed name '" + name + "' needs a URI", this, 0); + throw new DomDOMException(DOMException.NAMESPACE_ERR, + "prefixed name '" + name + + "' needs a URI", this, 0); } Element element = new DomElement(this, namespaceURI, name); @@ -660,7 +667,7 @@ public class DomDocument */ public DocumentFragment createDocumentFragment() { - return new DomFragment(this); + return new DomDocumentFragment(this); } /** @@ -711,7 +718,7 @@ public class DomDocument { checkChar(value, "1.1".equals(version)); } - return new DomCDATA(this, value); + return new DomCDATASection(this, value); } /** @@ -723,7 +730,7 @@ public class DomDocument { checkChar(buf, off, len, "1.1".equals(version)); } - return new DomCDATA(this, buf, off, len); + return new DomCDATASection(this, buf, off, len); } /** @@ -739,12 +746,13 @@ public class DomDocument checkName(target, xml11); if ("xml".equalsIgnoreCase(target)) { - throw new DomEx(DomEx.SYNTAX_ERR, - "illegal PI target name", this, 0); + throw new DomDOMException(DOMException.SYNTAX_ERR, + "illegal PI target name", + this, 0); } checkChar(data, xml11); } - return new DomPI(this, target, data); + return new DomProcessingInstruction(this, target, data); } /** @@ -796,9 +804,10 @@ public class DomDocument } else if (!XMLConstants.XML_NS_URI.equals(namespaceURI)) { - throw new DomEx(DomEx.NAMESPACE_ERR, - "xml namespace is always " + - XMLConstants.XML_NS_URI, this, 0); + throw new DomDOMException(DOMException.NAMESPACE_ERR, + "xml namespace is always " + + XMLConstants.XML_NS_URI, + this, 0); } } else if (XMLConstants.XMLNS_ATTRIBUTE.equals(name) || @@ -810,14 +819,15 @@ public class DomDocument } else if (!XMLConstants.XMLNS_ATTRIBUTE_NS_URI.equals(namespaceURI)) { - throw new DomEx(DomEx.NAMESPACE_ERR, - "xmlns namespace must be " + - XMLConstants.XMLNS_ATTRIBUTE_NS_URI, this, 0); + throw new DomDOMException(DOMException.NAMESPACE_ERR, + "xmlns namespace must be " + + XMLConstants.XMLNS_ATTRIBUTE_NS_URI, + this, 0); } } else if (namespaceURI == null && name.indexOf(':') != -1) { - throw new DomEx(DomEx.NAMESPACE_ERR, + throw new DomDOMException(DOMException.NAMESPACE_ERR, "prefixed name needs a URI: " + name, this, 0); } return new DomAttr(this, namespaceURI, name); @@ -913,7 +923,7 @@ public class DomDocument dst = createEntityReference(src.getNodeName()); break; case DOCUMENT_FRAGMENT_NODE: - dst = new DomFragment(this); + dst = new DomDocumentFragment(this); if (deep) { for (Node ctx = src.getFirstChild(); ctx != null; @@ -988,7 +998,7 @@ public class DomDocument // FALLTHROUGH // can't import unrecognized or nonstandard nodes default: - throw new DomEx(DomEx.NOT_SUPPORTED_ERR, null, src, 0); + throw new DomDOMException(DOMException.NOT_SUPPORTED_ERR, null, src, 0); } // FIXME cleanup a bit -- for deep copies, copy those @@ -1083,7 +1093,7 @@ public class DomDocument } else { - throw new DomEx(DomEx.NOT_SUPPORTED_ERR); + throw new DomDOMException(DOMException.NOT_SUPPORTED_ERR); } } @@ -1149,10 +1159,10 @@ public class DomDocument { case DOCUMENT_NODE: case DOCUMENT_TYPE_NODE: - throw new DomEx(DomEx.NOT_SUPPORTED_ERR); + throw new DomDOMException(DOMException.NOT_SUPPORTED_ERR); case ENTITY_NODE: case NOTATION_NODE: - throw new DomEx(DomEx.NO_MODIFICATION_ALLOWED_ERR); + throw new DomDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR); } if (source instanceof DomNode) { @@ -1284,11 +1294,12 @@ public class DomDocument DomNsNode src = (DomNsNode) n; if (src == null) { - throw new DomEx(DomEx.NOT_FOUND_ERR); + throw new DomDOMException(DOMException.NOT_FOUND_ERR); } if (src.owner != this) { - throw new DomEx(DomEx.WRONG_DOCUMENT_ERR, null, src, 0); + throw new DomDOMException(DOMException.WRONG_DOCUMENT_ERR, + null, src, 0); } boolean xml11 = "1.1".equals(version); checkName(qualifiedName, xml11); @@ -1305,7 +1316,7 @@ public class DomDocument if (XMLConstants.XML_NS_PREFIX.equals(prefix) && !XMLConstants.XML_NS_URI.equals(namespaceURI)) { - throw new DomEx(DomEx.NAMESPACE_ERR, + throw new DomDOMException(DOMException.NAMESPACE_ERR, "xml namespace must be " + XMLConstants.XML_NS_URI, src, 0); } @@ -1314,14 +1325,14 @@ public class DomDocument XMLConstants.XMLNS_ATTRIBUTE.equals(qualifiedName)) && !XMLConstants.XMLNS_ATTRIBUTE_NS_URI.equals(namespaceURI)) { - throw new DomEx(DomEx.NAMESPACE_ERR, + throw new DomDOMException(DOMException.NAMESPACE_ERR, "xmlns namespace must be " + XMLConstants.XMLNS_ATTRIBUTE_NS_URI, src, 0); } if (XMLConstants.XML_NS_URI.equals(namespaceURI) && !XMLConstants.XML_NS_PREFIX.equals(prefix)) { - throw new DomEx(DomEx.NAMESPACE_ERR, + throw new DomDOMException(DOMException.NAMESPACE_ERR, "xml namespace must be " + XMLConstants.XML_NS_URI, src, 0); } @@ -1330,7 +1341,7 @@ public class DomDocument !(XMLConstants.XMLNS_ATTRIBUTE.equals(prefix) || XMLConstants.XMLNS_ATTRIBUTE.equals(qualifiedName))) { - throw new DomEx(DomEx.NAMESPACE_ERR, + throw new DomDOMException(DOMException.NAMESPACE_ERR, "xmlns namespace must be " + XMLConstants.XMLNS_ATTRIBUTE_NS_URI, src, 0); } @@ -1343,7 +1354,7 @@ public class DomDocument // DOMElementNameChanged or DOMAttributeNameChanged return src; } - throw new DomEx(DomEx.NOT_SUPPORTED_ERR, null, n, 0); + throw new DomDOMException(DOMException.NOT_SUPPORTED_ERR, null, n, 0); } // -- XPathEvaluator -- diff --git a/libjava/gnu/xml/dom/DomDocumentBuilder.java b/libjava/gnu/xml/dom/DomDocumentBuilder.java index 16ea2ae5dba..d321653ed73 100644 --- a/libjava/gnu/xml/dom/DomDocumentBuilder.java +++ b/libjava/gnu/xml/dom/DomDocumentBuilder.java @@ -40,7 +40,6 @@ package gnu.xml.dom; import java.io.InputStream; import java.io.IOException; import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.ParserConfigurationException; import org.w3c.dom.Document; import org.w3c.dom.DOMConfiguration; import org.w3c.dom.DOMImplementation; diff --git a/libjava/gnu/xml/dom/DomDocumentConfiguration.java b/libjava/gnu/xml/dom/DomDocumentConfiguration.java index eebee09bba6..38d6e6d7bb3 100644 --- a/libjava/gnu/xml/dom/DomDocumentConfiguration.java +++ b/libjava/gnu/xml/dom/DomDocumentConfiguration.java @@ -99,8 +99,8 @@ class DomDocumentConfiguration } catch (ClassCastException e) { - throw new DomEx(DomEx.TYPE_MISMATCH_ERR, - value.getClass().getName(), null, 0); + throw new DomDOMException(DOMException.TYPE_MISMATCH_ERR, + value.getClass().getName(), null, 0); } } else if ("namespace-declarations".equals(name)) @@ -140,7 +140,8 @@ class DomDocumentConfiguration } else { - throw new DomEx(DomEx.NOT_SUPPORTED_ERR, name, null, 0); + throw new DomDOMException(DOMException.NOT_SUPPORTED_ERR, + name, null, 0); } } @@ -197,7 +198,7 @@ class DomDocumentConfiguration namespaceDeclarations == true && comments == true) ? Boolean.TRUE : Boolean.FALSE; } - throw new DomEx(DomEx.NOT_SUPPORTED_ERR, name, null, 0); + throw new DomDOMException(DOMException.NOT_SUPPORTED_ERR, name, null, 0); } public boolean canSetParameter(String name, Object value) diff --git a/libjava/gnu/xml/dom/DomElement.java b/libjava/gnu/xml/dom/DomElement.java index fb04638af12..535608343f9 100644 --- a/libjava/gnu/xml/dom/DomElement.java +++ b/libjava/gnu/xml/dom/DomElement.java @@ -42,6 +42,7 @@ import java.util.Set; import javax.xml.XMLConstants; import org.w3c.dom.Attr; +import org.w3c.dom.DOMException; import org.w3c.dom.Element; import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; @@ -262,7 +263,7 @@ public class DomElement if (("xmlns".equals (aname) || aname.startsWith ("xmlns:")) && !XMLConstants.XMLNS_ATTRIBUTE_NS_URI.equals (uri)) { - throw new DomEx(DomEx.NAMESPACE_ERR, + throw new DomDOMException(DOMException.NAMESPACE_ERR, "setting xmlns attribute to illegal value", this, 0); } @@ -318,9 +319,9 @@ public class DomElement { attributes.removeNamedItem(name); } - catch (DomEx e) + catch (DomDOMException e) { - if (e.code != DomEx.NOT_FOUND_ERR) + if (e.code != DOMException.NOT_FOUND_ERR) { throw e; } @@ -340,7 +341,7 @@ public class DomElement { if (attributes == null) { - throw new DomEx(DomEx.NOT_FOUND_ERR, null, node, 0); + throw new DomDOMException(DOMException.NOT_FOUND_ERR, null, node, 0); } return (Attr) attributes.removeNamedItem(node.getNodeName()); } @@ -358,7 +359,7 @@ public class DomElement { if (attributes == null) { - throw new DomEx(DomEx.NOT_FOUND_ERR, localPart, null, 0); + throw new DomDOMException(DOMException.NOT_FOUND_ERR, localPart, null, 0); } attributes.removeNamedItemNS (namespace, localPart); } @@ -487,11 +488,11 @@ public class DomElement { if (readonly) { - throw new DomEx(DomEx.NO_MODIFICATION_ALLOWED_ERR); + throw new DomDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR); } if (attr == null || attr.getOwnerElement() != this) { - throw new DomEx(DomEx.NOT_FOUND_ERR); + throw new DomDOMException(DOMException.NOT_FOUND_ERR); } if (isId) { diff --git a/libjava/gnu/xml/dom/DomEx.java b/libjava/gnu/xml/dom/DomEx.java deleted file mode 100644 index aacac968932..00000000000 --- a/libjava/gnu/xml/dom/DomEx.java +++ /dev/null @@ -1,175 +0,0 @@ -/* DomEx.java -- - Copyright (C) 1999,2000,2001,2004 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. - -GNU Classpath is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - -package gnu.xml.dom; - -import org.w3c.dom.DOMException; -import org.w3c.dom.Node; - -/** - * <p> DOMException implementation. The version that - * is provided by the W3C is abstract, so it can't be instantiated. - * - * <p> This also provides a bit more information about the error - * that is being reported, in terms of the relevant DOM structures - * and data. - * - * @author David Brownell - */ -public class DomEx - extends DOMException -{ - - /** @serial Data that caused an error to be reported */ - private String data; - - /** @serial Node associated with the error. */ - private Node node; - - /** @serial Data associated with the error. */ - private int value; - - /** - * Constructs an exception, with the diagnostic message - * corresponding to the specified code. - */ - public DomEx(short code) - { - super(code, diagnostic(code)); - } - - /** - * Constructs an exception, with the diagnostic message - * corresponding to the specified code and additional - * information as provided. - */ - public DomEx(short code, String data, Node node, int value) - { - super(code, diagnostic(code)); - this.data = data; - this.node = node; - this.value = value; - } - - /** Returns the node to which the diagnotic applies, or null. */ - final public Node getNode() - { - return node; - } - - /** Returns data to which the diagnotic applies, or null. */ - final public String getData() - { - return data; - } - - /** Returns data to which the diagnotic applies, or null. */ - final public int getValue() - { - return value; - } - - /** - * Returns a diagnostic message that may be slightly more useful - * than the generic one, where possible. - */ - public String getMessage() - { - String retval = super.getMessage(); - - if (data != null) - { - retval += "\nMore Information: " + data; - } - if (value != 0) - { - retval += "\nNumber: " + value; - } - if (node != null) - { - retval += "\nNode Name: " + node.getNodeName(); - } - return retval; - } - - // these strings should be localizable. - - private static String diagnostic(short code) - { - switch (code) - { - // DOM L1: - case INDEX_SIZE_ERR: - return "An index or size is out of range."; - case DOMSTRING_SIZE_ERR: - return "A string is too big."; - case HIERARCHY_REQUEST_ERR: - return "The node doesn't belong here."; - case WRONG_DOCUMENT_ERR: - return "The node belongs in another document."; - case INVALID_CHARACTER_ERR: - return "That character is not permitted."; - case NO_DATA_ALLOWED_ERR: - return "This node does not permit data."; - case NO_MODIFICATION_ALLOWED_ERR: - return "No changes are allowed."; - case NOT_FOUND_ERR: - return "The node was not found in that context."; - case NOT_SUPPORTED_ERR: - return "That object is not supported."; - case INUSE_ATTRIBUTE_ERR: - return "The attribute belongs to a different element."; - - // DOM L2: - case INVALID_STATE_ERR: - return "The object is not usable."; - case SYNTAX_ERR: - return "An illegal string was provided."; - case INVALID_MODIFICATION_ERR: - return "An object's type may not be changed."; - case NAMESPACE_ERR: - return "The operation violates XML Namespaces."; - case INVALID_ACCESS_ERR: - return "Parameter or operation isn't supported by this node."; - case TYPE_MISMATCH_ERR: - return "The type of the argument is incompatible with the expected type."; - } - return "Reserved exception number: " + code; - } - -} - diff --git a/libjava/gnu/xml/dom/DomFragment.java b/libjava/gnu/xml/dom/DomFragment.java deleted file mode 100644 index 44763a956c0..00000000000 --- a/libjava/gnu/xml/dom/DomFragment.java +++ /dev/null @@ -1,76 +0,0 @@ -/* DomFragment.java -- - Copyright (C) 1999,2000,2001,2004 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. - -GNU Classpath is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - -package gnu.xml.dom; - -import org.w3c.dom.DocumentFragment; - -/** - * <p> "DocumentFragment" implementation. </p> - * - * @author David Brownell - * @author <a href='mailto:dog@gnu.org'>Chris Burdess</a> - */ -public class DomFragment - extends DomNode - implements DocumentFragment -{ - - /** - * Constructs a DocumentFragment node associated with the - * specified document. - * - * <p>This constructor should only be invoked by a Document as part of - * its createDocumentFragment functionality, or through a subclass which - * is similarly used in a "Sub-DOM" style layer. - */ - protected DomFragment(DomDocument owner) - { - super(DOCUMENT_FRAGMENT_NODE, owner); - } - - /** - * <b>DOM L1</b> - * Returns the string "#document-fragment". - */ - final public String getNodeName() - { - return "#document-fragment"; - } - -} - diff --git a/libjava/gnu/xml/dom/DomImpl.java b/libjava/gnu/xml/dom/DomImpl.java index 1a16de32593..feb7ea703cc 100644 --- a/libjava/gnu/xml/dom/DomImpl.java +++ b/libjava/gnu/xml/dom/DomImpl.java @@ -207,7 +207,8 @@ public class DomImpl root = doc.createElementNS(namespaceURI, rootName); if (rootName.startsWith("xmlns:")) { - throw new DomEx(DomEx.NAMESPACE_ERR, "xmlns is reserved", null, 0); + throw new DomDOMException(DOMException.NAMESPACE_ERR, + "xmlns is reserved", null, 0); } } // Bleech -- L2 seemingly _requires_ omission of xmlns attributes. diff --git a/libjava/gnu/xml/dom/DomIterator.java b/libjava/gnu/xml/dom/DomIterator.java index 3dfd9640334..bb1f2cff2af 100644 --- a/libjava/gnu/xml/dom/DomIterator.java +++ b/libjava/gnu/xml/dom/DomIterator.java @@ -37,8 +37,7 @@ exception statement from your version. */ package gnu.xml.dom; -import java.util.Vector; - +import org.w3c.dom.DOMException; import org.w3c.dom.Node; import org.w3c.dom.events.Event; import org.w3c.dom.events.EventListener; @@ -76,7 +75,7 @@ public final class DomIterator { if (!root.isSupported("MutationEvents", "2.0")) { - throw new DomEx(DomEx.NOT_SUPPORTED_ERR, + throw new DomDOMException(DOMException.NOT_SUPPORTED_ERR, "Iterator needs mutation events", root, 0); } @@ -154,7 +153,7 @@ public final class DomIterator { if (done) { - throw new DomEx(DomEx.INVALID_STATE_ERR); + throw new DomDOMException(DOMException.INVALID_STATE_ERR); } right = true; return walk(true); @@ -171,7 +170,7 @@ public final class DomIterator { if (done) { - throw new DomEx(DomEx.INVALID_STATE_ERR); + throw new DomDOMException(DOMException.INVALID_STATE_ERR); } Node previous = reference; right = false; diff --git a/libjava/gnu/xml/dom/DomNamedNodeMap.java b/libjava/gnu/xml/dom/DomNamedNodeMap.java index af7594249be..2b1106e64c0 100644 --- a/libjava/gnu/xml/dom/DomNamedNodeMap.java +++ b/libjava/gnu/xml/dom/DomNamedNodeMap.java @@ -37,6 +37,7 @@ exception statement from your version. */ package gnu.xml.dom; +import org.w3c.dom.DOMException; import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; @@ -166,24 +167,24 @@ public class DomNamedNodeMap { if (readonly) { - throw new DomEx(DomEx.NO_MODIFICATION_ALLOWED_ERR); + throw new DomDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR); } DomNode node = (DomNode) arg; if (node.owner != owner.owner) { - throw new DomEx(DomEx.WRONG_DOCUMENT_ERR); + throw new DomDOMException(DOMException.WRONG_DOCUMENT_ERR); } if (node.nodeType != type) { - throw new DomEx(DomEx.HIERARCHY_REQUEST_ERR); + throw new DomDOMException(DOMException.HIERARCHY_REQUEST_ERR); } if (node.nodeType == Node.ATTRIBUTE_NODE) { DomNode element = node.parent; if (element != null && element != owner) { - throw new DomEx(DomEx.INUSE_ATTRIBUTE_ERR); + throw new DomDOMException(DOMException.INUSE_ATTRIBUTE_ERR); } node.parent = owner; node.depth = owner.depth + 1; @@ -302,7 +303,7 @@ public class DomNamedNodeMap { if (readonly) { - throw new DomEx(DomEx.NO_MODIFICATION_ALLOWED_ERR); + throw new DomDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR); } // report attribute REMOVAL event? @@ -369,7 +370,7 @@ public class DomNamedNodeMap return ctx; } } - throw new DomEx(DomEx.NOT_FOUND_ERR); + throw new DomDOMException(DOMException.NOT_FOUND_ERR); } String getDefaultValue(String name) diff --git a/libjava/gnu/xml/dom/DomNode.java b/libjava/gnu/xml/dom/DomNode.java index 3858fe8bbb9..20a62c53ba5 100644 --- a/libjava/gnu/xml/dom/DomNode.java +++ b/libjava/gnu/xml/dom/DomNode.java @@ -40,7 +40,6 @@ package gnu.xml.dom; import java.util.HashMap; import java.util.Iterator; import java.util.Map; -import javax.xml.XMLConstants; import org.w3c.dom.Document; import org.w3c.dom.DOMException; @@ -58,7 +57,6 @@ import org.w3c.dom.events.EventTarget; import org.w3c.dom.events.MutationEvent; import org.w3c.dom.traversal.NodeFilter; import org.w3c.dom.traversal.NodeIterator; -import org.w3c.dom.traversal.TreeWalker; /** * <p> "Node", "EventTarget", and "DocumentEvent" implementation. @@ -308,15 +306,16 @@ public abstract class DomNode { if (readonly && !owner.building) { - throw new DomEx(DomEx.NO_MODIFICATION_ALLOWED_ERR, - null, this, 0); + throw new DomDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, + null, this, 0); } for (DomNode ctx = this; ctx != null; ctx = ctx.parent) { if (child == ctx) { - throw new DomEx(DomEx.HIERARCHY_REQUEST_ERR, - "can't make ancestor into a child", this, 0); + throw new DomDOMException(DOMException.HIERARCHY_REQUEST_ERR, + "can't make ancestor into a child", + this, 0); } } @@ -330,8 +329,8 @@ public abstract class DomNode // new in DOM L2, this case -- patch it up later, in reparent() if (!(childNodeType == DOCUMENT_TYPE_NODE && childOwner == null)) { - throw new DomEx(DomEx.WRONG_DOCUMENT_ERR, - null, child, 0); + throw new DomDOMException(DOMException.WRONG_DOCUMENT_ERR, + null, child, 0); } } @@ -376,10 +375,12 @@ public abstract class DomNode } if (owner.checkingWellformedness) { - throw new DomEx(DomEx.HIERARCHY_REQUEST_ERR, - "can't append " + nodeTypeToString(childNodeType) + - " to node of type " + nodeTypeToString(nodeType), - this, 0); + throw new DomDOMException(DOMException.HIERARCHY_REQUEST_ERR, + "can't append " + + nodeTypeToString(childNodeType) + + " to node of type " + + nodeTypeToString(nodeType), + this, 0); } } @@ -578,8 +579,8 @@ public abstract class DomNode } catch (ClassCastException e) { - throw new DomEx(DomEx.WRONG_DOCUMENT_ERR, - null, newChild, 0); + throw new DomDOMException(DOMException.WRONG_DOCUMENT_ERR, + null, newChild, 0); } } @@ -630,12 +631,14 @@ public abstract class DomNode checkMisc(child); if (ref == null || ref.parent != this) { - throw new DomEx(DomEx.NOT_FOUND_ERR, null, ref, 0); + throw new DomDOMException(DOMException.NOT_FOUND_ERR, + null, ref, 0); } if (ref == child) { - throw new DomEx(DomEx.HIERARCHY_REQUEST_ERR, - "can't insert node before itself", ref, 0); + throw new DomDOMException(DOMException.HIERARCHY_REQUEST_ERR, + "can't insert node before itself", + ref, 0); } if (child.parent != null) @@ -672,8 +675,8 @@ public abstract class DomNode } catch (ClassCastException e) { - throw new DomEx(DomEx.WRONG_DOCUMENT_ERR, - null, newChild, 0); + throw new DomDOMException(DOMException.WRONG_DOCUMENT_ERR, + null, newChild, 0); } } @@ -721,7 +724,8 @@ public abstract class DomNode } if (ref == null || ref.parent != this) { - throw new DomEx(DomEx.NOT_FOUND_ERR, null, ref, 0); + throw new DomDOMException(DOMException.NOT_FOUND_ERR, + null, ref, 0); } if (reportMutations) @@ -784,7 +788,8 @@ public abstract class DomNode checkMisc(child); if (ref == null || ref.parent != this) { - throw new DomEx(DomEx.NOT_FOUND_ERR, null, ref, 0); + throw new DomDOMException(DOMException.NOT_FOUND_ERR, + null, ref, 0); } if (reportMutations) @@ -837,8 +842,8 @@ public abstract class DomNode } catch (ClassCastException e) { - throw new DomEx(DomEx.WRONG_DOCUMENT_ERR, - null, newChild, 0); + throw new DomDOMException(DOMException.WRONG_DOCUMENT_ERR, + null, newChild, 0); } } @@ -860,12 +865,13 @@ public abstract class DomNode if (ref == null || ref.parent != this) { - throw new DomEx(DomEx.NOT_FOUND_ERR, null, ref, 0); + throw new DomDOMException(DOMException.NOT_FOUND_ERR, + null, ref, 0); } if (readonly && !owner.building) { - throw new DomEx(DomEx.NO_MODIFICATION_ALLOWED_ERR, - null, this, 0); + throw new DomDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, + null, this, 0); } for (DomNode child = first; child != null; child = child.next) @@ -909,13 +915,13 @@ public abstract class DomNode return ref; } } - throw new DomEx(DomEx.NOT_FOUND_ERR, - "that's no child of mine", refChild, 0); + throw new DomDOMException(DOMException.NOT_FOUND_ERR, + "that's no child of mine", refChild, 0); } catch (ClassCastException e) { - throw new DomEx(DomEx.WRONG_DOCUMENT_ERR, - null, refChild, 0); + throw new DomDOMException(DOMException.WRONG_DOCUMENT_ERR, + null, refChild, 0); } } @@ -1446,8 +1452,8 @@ public abstract class DomNode // mouse events - throw new DomEx(DomEx.NOT_SUPPORTED_ERR, - eventType, null, 0); + throw new DomDOMException(DOMException.NOT_SUPPORTED_ERR, + eventType, null, 0); } /** diff --git a/libjava/gnu/xml/dom/DomNsNode.java b/libjava/gnu/xml/dom/DomNsNode.java index ea41fff6b8c..15b2fb54228 100644 --- a/libjava/gnu/xml/dom/DomNsNode.java +++ b/libjava/gnu/xml/dom/DomNsNode.java @@ -38,6 +38,7 @@ exception statement from your version. */ package gnu.xml.dom; import javax.xml.XMLConstants; +import org.w3c.dom.DOMException; /** * <p> Abstract implemention of namespace support. This facilitates @@ -135,7 +136,7 @@ public abstract class DomNsNode { if (readonly) { - throw new DomEx(DomEx.NO_MODIFICATION_ALLOWED_ERR); + throw new DomDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR); } if (prefix == null) @@ -145,40 +146,42 @@ public abstract class DomNsNode } else if (namespace == null) { - throw new DomEx(DomEx.NAMESPACE_ERR, - "can't set prefix, node has no namespace URI", - this, 0); + throw new DomDOMException(DOMException.NAMESPACE_ERR, + "can't set prefix, node has no namespace URI", + this, 0); } DomDocument.checkName(prefix, "1.1".equals(owner.getXmlVersion())); if (prefix.indexOf (':') != -1) { - throw new DomEx(DomEx.NAMESPACE_ERR, - "illegal prefix " + prefix, this, 0); + throw new DomDOMException(DOMException.NAMESPACE_ERR, + "illegal prefix " + prefix, this, 0); } if (XMLConstants.XML_NS_PREFIX.equals(prefix) && !XMLConstants.XML_NS_URI.equals(namespace)) { - throw new DomEx(DomEx.NAMESPACE_ERR, - "xml namespace is always " + - XMLConstants.XML_NS_URI, this, 0); + throw new DomDOMException(DOMException.NAMESPACE_ERR, + "xml namespace is always " + + XMLConstants.XML_NS_URI, this, 0); } if (XMLConstants.XMLNS_ATTRIBUTE.equals(prefix)) { if (namespace != null || getNodeType() != ATTRIBUTE_NODE) { - throw new DomEx(DomEx.NAMESPACE_ERR, - "xmlns attribute prefix is reserved", this, 0); + throw new DomDOMException(DOMException.NAMESPACE_ERR, + "xmlns attribute prefix is reserved", + this, 0); } } else if (getNodeType () == ATTRIBUTE_NODE && (XMLConstants.XMLNS_ATTRIBUTE.equals(name) || name.startsWith("xmlns:"))) { - throw new DomEx(DomEx.NAMESPACE_ERR, - "namespace declarations can't change names", this, 0); + throw new DomDOMException(DOMException.NAMESPACE_ERR, + "namespace declarations can't change names", + this, 0); } this.prefix = prefix.intern(); diff --git a/libjava/gnu/xml/dom/DomPI.java b/libjava/gnu/xml/dom/DomPI.java deleted file mode 100644 index dedf375153c..00000000000 --- a/libjava/gnu/xml/dom/DomPI.java +++ /dev/null @@ -1,145 +0,0 @@ -/* DomPI.java -- - Copyright (C) 1999,2000,2001,2004 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. - -GNU Classpath is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - -package gnu.xml.dom; - -import org.w3c.dom.ProcessingInstruction; - -/** - * <p> "ProcessingInstruction" (PI) implementation. - * This is a non-core DOM class, supporting the "XML" feature. </p> - * - * <p> Unlike other DOM APIs in the "XML" feature, this one fully - * exposes the functionality it describes. So there is no reason - * inherent in DOM to avoid using this API, unless you want to rely - * on NOTATION declarations to associate meaning with your PIs; - * there is no vendor-neutal way to record those notations in DOM.</p> - * - * <p> Also of note is that PI support is part of SAX, so that XML - * systems using PIs can choose among multiple APIs. </p> - * - * @see DomNotation - * - * @author David Brownell - * @author <a href='mailto:dog@gnu.org'>Chris Burdess</a> - */ -public class DomPI - extends DomNode - implements ProcessingInstruction -{ - - private String target; - private String data; - - /** - * Constructs a ProcessingInstruction node associated with the - * specified document, with the specified data. - * - * <p>This constructor should only be invoked by a Document object as - * part of its createProcessingInstruction functionality, or through - * a subclass which is similarly used in a "Sub-DOM" style layer. - */ - protected DomPI(DomDocument owner, String target, String data) - { - super(PROCESSING_INSTRUCTION_NODE, owner); - this.target = target; - this.data = data; - } - - /** - * <b>DOM L1</b> - * Returns the target of the processing instruction. - */ - public final String getTarget() - { - return target; - } - - /** - * <b>DOM L1</b> - * Returns the target of the processing instruction - * (same as getTarget). - */ - public final String getNodeName() - { - return target; - } - - /** - * <b>DOM L1</b> - * Returns the data associated with the processing instruction. - */ - public final String getData() - { - return data; - } - - /** - * <b>DOM L1</b> - * Returns the data associated with the processing instruction - * (same as getData). - */ - public final String getNodeValue() - { - return data; - } - - /** - * <b>DOM L1</b> - * Assigns the data associated with the processing instruction; - * same as setNodeValue. - */ - public final void setData(String data) - { - setNodeValue(data); - } - - /** - * <b>DOM L1</b> - * Assigns the data associated with the processing instruction. - */ - public final void setNodeValue(String data) - { - if (isReadonly()) - { - throw new DomEx(DomEx.NO_MODIFICATION_ALLOWED_ERR); - } - this.data = data; - } - -} - diff --git a/libjava/gnu/xml/dom/DomText.java b/libjava/gnu/xml/dom/DomText.java index d714655e61d..dc2d50a8eb7 100644 --- a/libjava/gnu/xml/dom/DomText.java +++ b/libjava/gnu/xml/dom/DomText.java @@ -102,7 +102,7 @@ public class DomText { if (isReadonly()) { - throw new DomEx(DomEx.NO_MODIFICATION_ALLOWED_ERR); + throw new DomDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR); } try { @@ -134,7 +134,7 @@ public class DomText } catch (IndexOutOfBoundsException x) { - throw new DomEx(DomEx.INDEX_SIZE_ERR); + throw new DomDOMException(DOMException.INDEX_SIZE_ERR); } } diff --git a/libjava/gnu/xml/dom/DomXPathExpression.java b/libjava/gnu/xml/dom/DomXPathExpression.java index d92670d7eff..c22f29413ee 100644 --- a/libjava/gnu/xml/dom/DomXPathExpression.java +++ b/libjava/gnu/xml/dom/DomXPathExpression.java @@ -37,7 +37,6 @@ exception statement from your version. */ package gnu.xml.dom; -import java.io.IOException; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; diff --git a/libjava/gnu/xml/dom/DomXPathResult.java b/libjava/gnu/xml/dom/DomXPathResult.java index 1cc49d8f733..5c57e25e204 100644 --- a/libjava/gnu/xml/dom/DomXPathResult.java +++ b/libjava/gnu/xml/dom/DomXPathResult.java @@ -39,10 +39,8 @@ package gnu.xml.dom; import java.util.Collection; import java.util.Iterator; -import org.w3c.dom.DOMException; import org.w3c.dom.Node; import org.w3c.dom.xpath.XPathException; -import org.w3c.dom.xpath.XPathNSResolver; import org.w3c.dom.xpath.XPathResult; /** diff --git a/libjava/gnu/xml/dom/JAXPFactory.java b/libjava/gnu/xml/dom/JAXPFactory.java index 42712081094..3602ef6b9ab 100644 --- a/libjava/gnu/xml/dom/JAXPFactory.java +++ b/libjava/gnu/xml/dom/JAXPFactory.java @@ -40,7 +40,6 @@ package gnu.xml.dom; import java.io.IOException; import org.w3c.dom.Document; -import org.w3c.dom.DocumentType; import org.w3c.dom.DOMImplementation; import org.xml.sax.EntityResolver; diff --git a/libjava/gnu/xml/dom/ls/DomLSEx.java b/libjava/gnu/xml/dom/ls/DomLSEx.java deleted file mode 100644 index 5bf1595363f..00000000000 --- a/libjava/gnu/xml/dom/ls/DomLSEx.java +++ /dev/null @@ -1,75 +0,0 @@ -/* DomLSEx.java -- - Copyright (C) 2004 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. - -GNU Classpath is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - -package gnu.xml.dom.ls; - -import java.io.PrintStream; -import java.io.PrintWriter; -import org.w3c.dom.ls.LSException; - -/** - * A DOM LS exception incorporating a cause. - * - * @author <a href='mailto:dog@gnu.org'>Chris Burdess</a> - */ -public class DomLSEx - extends LSException -{ - - private final Exception cause2; - - public DomLSEx(short type, Exception cause) - { - super(type, cause.getMessage()); - cause2 = cause; - } - - public void printStackTrace(PrintStream out) - { - super.printStackTrace(out); - out.print("caused by "); - cause2.printStackTrace(out); - } - - public void printStackTrace(PrintWriter out) - { - super.printStackTrace(out); - out.print("caused by "); - cause2.printStackTrace(out); - } - -} diff --git a/libjava/gnu/xml/dom/ls/DomLSParser.java b/libjava/gnu/xml/dom/ls/DomLSParser.java index b050b99a1a2..489777fc913 100644 --- a/libjava/gnu/xml/dom/ls/DomLSParser.java +++ b/libjava/gnu/xml/dom/ls/DomLSParser.java @@ -65,7 +65,7 @@ import org.xml.sax.SAXNotRecognizedException; import org.xml.sax.SAXParseException; import org.xml.sax.XMLReader; import gnu.xml.dom.DomDocument; -import gnu.xml.dom.DomEx; +import gnu.xml.dom.DomDOMException; /** * Parser implementation for GNU DOM. @@ -117,7 +117,7 @@ public class DomLSParser async = false; break; default: - throw new DomEx(DOMException.NOT_SUPPORTED_ERR); + throw new DomDOMException(DOMException.NOT_SUPPORTED_ERR); } // TODO schemaType this.schemaType = schemaType; @@ -307,13 +307,13 @@ public class DomLSParser { reader = null; eventSink = null; - throw new DomLSEx(LSException.PARSE_ERR, e); + throw new DomLSException(LSException.PARSE_ERR, e); } catch (IOException e) { reader = null; eventSink = null; - throw new DomLSEx(LSException.PARSE_ERR, e); + throw new DomLSException(LSException.PARSE_ERR, e); } // return document Document ret = eventSink.doc; @@ -341,11 +341,11 @@ public class DomLSParser } catch (ParserConfigurationException e) { - throw new DomLSEx(LSException.PARSE_ERR, e); + throw new DomLSException(LSException.PARSE_ERR, e); } catch (SAXException e) { - throw new DomLSEx(LSException.PARSE_ERR, e); + throw new DomLSException(LSException.PARSE_ERR, e); } } return reader; @@ -371,11 +371,11 @@ public class DomLSParser } catch (SAXException e) { - throw new DomLSEx(LSException.PARSE_ERR, e); + throw new DomLSException(LSException.PARSE_ERR, e); } catch (IOException e) { - throw new DomLSEx(LSException.PARSE_ERR, e); + throw new DomLSException(LSException.PARSE_ERR, e); } } if (source == null) @@ -403,7 +403,7 @@ public class DomLSParser } catch (IOException e) { - throw new DomLSEx(LSException.PARSE_ERR, e); + throw new DomLSException(LSException.PARSE_ERR, e); } } return source; @@ -457,7 +457,7 @@ public class DomLSParser } else { - throw new DomEx(DomEx.NOT_SUPPORTED_ERR); + throw new DomDOMException(DOMException.NOT_SUPPORTED_ERR); } // invalidate reader, a new one will be created reader = null; @@ -509,7 +509,7 @@ public class DomLSParser } else { - throw new DomEx(DomEx.NOT_SUPPORTED_ERR); + throw new DomDOMException(DOMException.NOT_SUPPORTED_ERR); } } diff --git a/libjava/gnu/xml/dom/ls/DomLSSerializer.java b/libjava/gnu/xml/dom/ls/DomLSSerializer.java index 91a01c96e0e..ec27c5de65b 100644 --- a/libjava/gnu/xml/dom/ls/DomLSSerializer.java +++ b/libjava/gnu/xml/dom/ls/DomLSSerializer.java @@ -58,7 +58,7 @@ import org.w3c.dom.ls.LSOutput; import org.w3c.dom.ls.LSSerializer; import org.w3c.dom.ls.LSSerializerFilter; import org.w3c.dom.traversal.NodeFilter; -import gnu.xml.dom.DomEx; +import gnu.xml.dom.DomDOMException; import gnu.xml.transform.StreamSerializer; /** @@ -147,7 +147,7 @@ public class DomLSSerializer } catch (IOException e) { - throw new DomLSEx(LSException.SERIALIZE_ERR, e); + throw new DomLSException(LSException.SERIALIZE_ERR, e); } } @@ -302,7 +302,7 @@ public class DomLSSerializer } else { - throw new DomEx(DomEx.NOT_SUPPORTED_ERR); + throw new DomDOMException(DOMException.NOT_SUPPORTED_ERR); } } @@ -319,7 +319,7 @@ public class DomLSSerializer } else { - throw new DomEx(DomEx.NOT_SUPPORTED_ERR); + throw new DomDOMException(DOMException.NOT_SUPPORTED_ERR); } } |