summaryrefslogtreecommitdiffstats
path: root/dom
diff options
context:
space:
mode:
authorJesse Wilson <jessewilson@google.com>2010-01-26 15:22:44 -0800
committerJesse Wilson <jessewilson@google.com>2010-01-27 17:38:26 -0800
commit320c9890e8241fb0ad05de6fa5e6c3eb3aece159 (patch)
tree5c76fad23bcb036be3ac91951947caabc03c1d14 /dom
parent820dd9b89746b3e3005bd5d23176cde1a69048b7 (diff)
downloadlibcore-320c9890e8241fb0ad05de6fa5e6c3eb3aece159.zip
libcore-320c9890e8241fb0ad05de6fa5e6c3eb3aece159.tar.gz
libcore-320c9890e8241fb0ad05de6fa5e6c3eb3aece159.tar.bz2
Bring our XML APIs up to date with Java 5.
New packages for Java 5 compatiblity: - javax.xml.datatype - javax.xml.namespace - javax.xml.parsers (updated) - javax.xml.transform - javax.xml.transform.dom - javax.xml.transform.sax - javax.xml.transform.stream - javax.xml.validation - javax.xml.xpath - org.w3c.dom (updated) - org.w3c.dom.events - org.w3c.dom.ls (load/save) - org.w3c.dom.traversal - org.w3c.dom.views Omitted packages (that otherwise exist in Java 5) - org.w3c.dom.bootstrap. This package facilitates pluggable implementations of DOM. I'm not including this because there's little need for it in practice; and because it adds an unnecessary layer of complexity. This decision is also reflected in TransformerFactory.newInstance(), SAXParserFactory.newInstance(), and DocumentBuilderFactory.newInstance(). New packages that pseudo-exist in Java 5 - org.w3c.dom.traversal This package is referenced by Java 5's org.w3c.dom.ls.LSSerializerFilter, but isn't included in the Javadoc API. Their spec isn't self-consistent. - org.w3c.dom.views This package is referenced by Java 5's org.w3c.dom.events.MouseEvent, but isn't included in the Javadoc API. Another spec that isn't self-consistent. This upgrades DOM from v2 to v3. http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/ This includes some API-incompatible changes; notably introducing new methods into interfaces. I believe this is still safe, and Java made a similar backwards incompatible change when they upgraded DOM from v2 to v3 between Java 1.4 and Java 5.0. Source for the new APIs comes from Apache XML commons. http://svn.apache.org/repos/asf/xml/commons/trunk rev 901014. This code currently contains several gaps in its implementation. In particular, the impelementations of the DOM model classes (AttrImpl, ElementImpl, NodeImpl) have DOM v3 methods that throw UnsupportedOperationExceptions. I intend to address this problem in an immediate follow-up CL. All gaps are marked with TODO comments, and they all live in the org.apache.harmony.xml.dom package. To implement these APIs, I've included Apache Xalan. In a follow-up change I intend to remove most of the code we don't actually need. I'm using their pristine copy from SVN so Git can track our local modifications. http://svn.apache.org/repos/asf/xalan/java/trunk rev 889881.
Diffstat (limited to 'dom')
-rw-r--r--dom/src/test/java/org/w3c/dom/DOMError.java85
-rw-r--r--dom/src/test/java/org/w3c/dom/DOMErrorHandler.java34
-rw-r--r--dom/src/test/java/org/w3c/dom/DOMLocator.java62
-rw-r--r--dom/src/test/java/org/w3c/dom/UserDataHandler.java65
4 files changed, 0 insertions, 246 deletions
diff --git a/dom/src/test/java/org/w3c/dom/DOMError.java b/dom/src/test/java/org/w3c/dom/DOMError.java
deleted file mode 100644
index e70ec6b..0000000
--- a/dom/src/test/java/org/w3c/dom/DOMError.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Copyright (C) 2008 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.w3c.dom;
-public interface DOMError {
- // ErrorSeverity
- /**
- * The severity of the error described by the <code>DOMError</code> is
- * warning. A <code>SEVERITY_WARNING</code> will not cause the
- * processing to stop, unless <code>DOMErrorHandler.handleError()</code>
- * returns <code>false</code>.
- */
- public static final short SEVERITY_WARNING = 1;
- /**
- * The severity of the error described by the <code>DOMError</code> is
- * error. A <code>SEVERITY_ERROR</code> may not cause the processing to
- * stop if the error can be recovered, unless
- * <code>DOMErrorHandler.handleError()</code> returns <code>false</code>.
- */
- public static final short SEVERITY_ERROR = 2;
- /**
- * The severity of the error described by the <code>DOMError</code> is
- * fatal error. A <code>SEVERITY_FATAL_ERROR</code> will cause the
- * normal processing to stop. The return value of
- * <code>DOMErrorHandler.handleError()</code> is ignored unless the
- * implementation chooses to continue, in which case the behavior
- * becomes undefined.
- */
- public static final short SEVERITY_FATAL_ERROR = 3;
-
- /**
- * The severity of the error, either <code>SEVERITY_WARNING</code>,
- * <code>SEVERITY_ERROR</code>, or <code>SEVERITY_FATAL_ERROR</code>.
- */
- public short getSeverity();
-
- /**
- * An implementation specific string describing the error that occurred.
- */
- public String getMessage();
-
- /**
- * A <code>DOMString</code> indicating which related data is expected in
- * <code>relatedData</code>. Users should refer to the specification of
- * the error in order to find its <code>DOMString</code> type and
- * <code>relatedData</code> definitions if any.
- * <p ><b>Note:</b> As an example,
- * <code>Document.normalizeDocument()</code> does generate warnings when
- * the "split-cdata-sections" parameter is in use. Therefore, the method
- * generates a <code>SEVERITY_WARNING</code> with <code>type</code>
- * <code>"cdata-sections-splitted"</code> and the first
- * <code>CDATASection</code> node in document order resulting from the
- * split is returned by the <code>relatedData</code> attribute.
- */
- public String getType();
-
- /**
- * The related platform dependent exception if any.
- */
- public Object getRelatedException();
-
- /**
- * The related <code>DOMError.type</code> dependent data if any.
- */
- public Object getRelatedData();
-
- /**
- * The location of the error.
- */
- public DOMLocator getLocation();
-
-} \ No newline at end of file
diff --git a/dom/src/test/java/org/w3c/dom/DOMErrorHandler.java b/dom/src/test/java/org/w3c/dom/DOMErrorHandler.java
deleted file mode 100644
index 7b1366a..0000000
--- a/dom/src/test/java/org/w3c/dom/DOMErrorHandler.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright (C) 2008 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.w3c.dom;
-public interface DOMErrorHandler {
- /**
- * This method is called on the error handler when an error occurs.
- * <br> If an exception is thrown from this method, it is considered to be
- * equivalent of returning <code>true</code>.
- * @param error The error object that describes the error. This object
- * may be reused by the DOM implementation across multiple calls to
- * the <code>handleError</code> method.
- * @return If the <code>handleError</code> method returns
- * <code>false</code>, the DOM implementation should stop the current
- * processing when possible. If the method returns <code>true</code>,
- * the processing may continue depending on
- * <code>DOMError.severity</code>.
- */
- public boolean handleError(DOMError error);
-
-} \ No newline at end of file
diff --git a/dom/src/test/java/org/w3c/dom/DOMLocator.java b/dom/src/test/java/org/w3c/dom/DOMLocator.java
deleted file mode 100644
index 876636f..0000000
--- a/dom/src/test/java/org/w3c/dom/DOMLocator.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright (C) 2008 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.w3c.dom;
-
-/**
- * <code>DOMLocator</code> is an interface that describes a location (e.g.
- * where an error occurred).
- * <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>.
- * @since DOM Level 3
- */
-public interface DOMLocator {
- /**
- * The line number this locator is pointing to, or <code>-1</code> if
- * there is no column number available.
- */
- public int getLineNumber();
-
- /**
- * The column number this locator is pointing to, or <code>-1</code> if
- * there is no column number available.
- */
- public int getColumnNumber();
-
- /**
- * The byte offset into the input source this locator is pointing to or
- * <code>-1</code> if there is no byte offset available.
- */
- public int getByteOffset();
-
- /**
- * The UTF-16, as defined in [Unicode] and Amendment 1 of [ISO/IEC 10646], offset into the input source this locator is pointing to or
- * <code>-1</code> if there is no UTF-16 offset available.
- */
- public int getUtf16Offset();
-
- /**
- * The node this locator is pointing to, or <code>null</code> if no node
- * is available.
- */
- public Node getRelatedNode();
-
- /**
- * The URI this locator is pointing to, or <code>null</code> if no URI is
- * available.
- */
- public String getUri();
-
-}
diff --git a/dom/src/test/java/org/w3c/dom/UserDataHandler.java b/dom/src/test/java/org/w3c/dom/UserDataHandler.java
deleted file mode 100644
index 0901f4a..0000000
--- a/dom/src/test/java/org/w3c/dom/UserDataHandler.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright (C) 2008 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.w3c.dom;
-public interface UserDataHandler {
- // OperationType
- /**
- * The node is cloned, using <code>Node.cloneNode()</code>.
- */
- public static final short NODE_CLONED = 1;
- /**
- * The node is imported, using <code>Document.importNode()</code>.
- */
- public static final short NODE_IMPORTED = 2;
- /**
- * The node is deleted.
- * <p ><b>Note:</b> This may not be supported or may not be reliable in
- * certain environments, such as Java, where the implementation has no
- * real control over when objects are actually deleted.
- */
- public static final short NODE_DELETED = 3;
- /**
- * The node is renamed, using <code>Document.renameNode()</code>.
- */
- public static final short NODE_RENAMED = 4;
- /**
- * The node is adopted, using <code>Document.adoptNode()</code>.
- */
- public static final short NODE_ADOPTED = 5;
-
- /**
- * This method is called whenever the node for which this handler is
- * registered is imported or cloned.
- * <br> DOM applications must not raise exceptions in a
- * <code>UserDataHandler</code>. The effect of throwing exceptions from
- * the handler is DOM implementation dependent.
- * @param operation Specifies the type of operation that is being
- * performed on the node.
- * @param key Specifies the key for which this handler is being called.
- * @param data Specifies the data for which this handler is being called.
- * @param src Specifies the node being cloned, adopted, imported, or
- * renamed. This is <code>null</code> when the node is being deleted.
- * @param dst Specifies the node newly created if any, or
- * <code>null</code>.
- */
- public void handle(short operation,
- String key,
- Object data,
- Node src,
- Node dst);
-
-}