07 April 2004

Apéndice G: Vinculación con el Lenguaje Java

Este apéndice contiene la vinculación completa con Java [Java] para el Núcleo del Modelo de Objetos del Documento Nivel 3.

Los archivos Java están también disponibles como http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/java-binding.zip

G.1 Extensiones Java Vinculadas

Nota: Esta sección es informativa.

Esta sección define el objeto DOMImplementationRegistry, expuesto en Bootstrapping, para Java.

El DOMImplementationRegistry primero es inicializado por la aplicación o la implementación, dependendiendo del contexto, por la propiedad del sistema Java "org.w3c.dom.DOMImplementationSourceList". El valor de esta propiedad es una lista separada por espacios, de nombres de clases válidas implementados en la interfaz DOMImplementationSource.

org/w3c/dom/bootstrap/DOMImplementationRegistry.java:

package org.w3c.dom.bootstrap;

import java.util.StringTokenizer;
import java.util.Vector;
import org.w3c.dom.DOMImplementationSource;
import org.w3c.dom.DOMImplementationList;
import org.w3c.dom.DOMImplementation;
import java.io.InputStream;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.security.AccessController;
import java.security.PrivilegedAction;

/**
 * Una fabrica que permite a las aplicaciones obtener interfaces de
 * <code>DOMImplementation</code>.
 *
 * <p>
 * Por ejemplo:
 * </p>
 *
 * <pre class='example'>
 *  // consigue una instancia del registro DOMImplementation
 *  DOMImplementationRegistry registry =
 *       DOMImplementationRegistry.newInstance();
 *  // consigue una implementación DOM el módulo XML Nivel 3
 *  DOMImplementation domImpl =
 *       registry.getDOMImplementation("XML 3.0");
 * </pre>
 *
 * <p>
 * Esto proporciona una aplicación con una implementación con un punto de inicio independiente.
 * Las implementaciones DOM pueden modificar este clase para encontrar un nuevo estandar seguro
 * o proporcionar retrasos *adicionales* para la lista de
 * DOMImplementationSources.
 * </p>
 *
 * @Vea DOMImplementation
 * @Vea DOMImplementationSource
 * @Desde DOM Nivel 3
 */
public final class DOMImplementationRegistry {
    /**
     * La propiedad del sistema para especificar el
     * nombre de clase DOMImplementationSource.
     */
    public static final String PROPERTY =
	"org.w3c.dom.DOMImplementationSourceList";
    
    /**
     * Columnas predeterminadas por línea.
     */
    private static final int DEFAULT_LINE_LENGTH = 80;
    
    /**
     * La lista de DOMImplementationSources.
     */
    private Vector sources;
    
    /**
     * Constructuro privado.
     * @param srcs Vector List of DOMImplementationSources
     */
    private DOMImplementationRegistry(final Vector srcs) {
	sources = srcs;
    }
    
    /**
     * Obtiene una nueva interfaz de un <code>DOMImplementationRegistry</code>.
     *

     * El <code>DOMImplementationRegistry</code> es inicializado por la
     * aplicación o la implementación, dependiendo del contexto, pero
     * primero se verifica el valor de la propiedad del sistema Java
     * <code>org.w3c.dom.DOMImplementationSourceList</code> y 
     * el servicio proporcionado cuyo contenido está en
     * "<code>META_INF/services/org.w3c.dom.DOMImplementationSourceList</code>"
     * El valor de esta propiedad es una lista separada por espacios en blancos de
     * nombres de las clases validas implementadas en la interfaz
     * <code>DOMImplementationSource</code>. Cada clase listada
     * en la lista de clases de nombre es instanciada y cualquier excepción
     * encontrada es lanzada en la application.
     *
     * @Devuelve una instanacia inicializada de DOMImplementationRegistry
     * @Lanza ClassNotFoundException
     *     Si cualquier clase especificada no pude ser encontrad
     * @Lanza InstantiationException
     *     Si cualquier clase especificada es una interfas o clases abstracta
     * @Lanza IllegalAccessException
     *     Si el constructor por defecto de una clase especificada no es accesible
     * @Lanza ClassCastException
     *     Si cualquier clase especificada no es implementada
     * <code>DOMImplementationSource</code>
     */
    public static DOMImplementationRegistry newInstance()
	throws
	ClassNotFoundException,
	InstantiationException,
	IllegalAccessException,
	ClassCastException {
	Vector sources = new Vector();
	
	ClassLoader classLoader = getClassLoader();
	// Busqueda de propiedades de sistema:
	String p = getSystemProperty(PROPERTY);
	
	//
	// si la propiedad no es especificada entonces usa el contenido de
        // META_INF/org.w3c.dom.DOMImplementationSourceList de classpath
	if (p == null) {
	    p = getServiceValue(classLoader);
	} 
        if (p == null) {
	    //
	    // Las implementaciones DOM pueden modificar aquón añadiendo retrasos *adicionales*
	    // Los mecanismos para acceder a una lista predeterminada de DOMImplementationSources.
	    
	}
	if (p != null) {
	    StringTokenizer st = new StringTokenizer(p);
	    while (st.hasMoreTokens()) {
		String sourceName = st.nextToken();
		// Usa el contexto clase cargado, retornando a Class.forName
		// si y solo si esto falla...
		Class sourceClass = null;
		if (classLoader != null) {
		    sourceClass = classLoader.loadClass(sourceName);
		} else {
		    sourceClass = Class.forName(sourceName);
		}
		DOMImplementationSource source =
		    (DOMImplementationSource) sourceClass.newInstance();
		sources.addElement(source);
	    }
	}
	return new DOMImplementationRegistry(sources);
    }
    
    /**
     * Devuelve la primera implementación que tiene la funcionalidad
     * deseada, o <code>null</code> si no es encontrada.
     *
     * @funcionalidades param
     *            Una cadena que especifica que funcionalidad es requerida. Esto es
     *            una lista separada por espacios en la cual cada funcionalidad es especificada por
     *            su nombre seguido opcionalmente por un espacio y un número de versión
     *            Esto es algo como: "XML 1.0 Traversal +Events 2.0"
     * @Devuelve una implementación que tiene la funcionalidad deseada,
     *         o <code>null</code> si no es encontrada.
     */
    public DOMImplementation getDOMImplementation(final String features) {
	int size = sources.size();
	String name = null;
	for (int i = 0; i < size; i++) {
	    DOMImplementationSource source =
		(DOMImplementationSource) sources.elementAt(i);
	    DOMImplementation impl = source.getDOMImplementation(features);
	    if (impl != null) {
		return impl;
	    }
	}
	return null;
    }
    
    /**
     * devuelve una lista de las implementaciones que soportan la
     * funcionalidad deseada.
     *
     * @funcioinalidades param 
     *            Una cadena que especica que funcionalidades son requeridas. Eta es
     *            una lista separada por espacios en blanco en la que cada funcionalidad es especificada por 
     *            su nombre seguida opcionalmente por un espacio y un n&ucacute;mero de versión.
     *            Esto es algo como: "XML 1.0 Traversal +Events 2.0"
     * @Devuelve una lista de DOMImplementations que soporta la funcionalidad deseada.
     */
    public DOMImplementationList getDOMImplementationList(final String features) {
	final Vector implementations = new Vector();
	int size = sources.size();
	for (int i = 0; i < size; i++) {
	    DOMImplementationSource source =
		(DOMImplementationSource) sources.elementAt(i);
	    DOMImplementationList impls =
		source.getDOMImplementationList(features);
	    for (int j = 0; j < impls.getLength(); j++) {
		DOMImplementation impl = impls.item(j);
		implementations.addElement(impl);
	    }
	}
	return new DOMImplementationList() {
		public DOMImplementation item(final int index) {
		    if (index >= 0 && index < implementations.size()) {
			try {
			    return (DOMImplementation)
				implementations.elementAt(index);
			} catch (ArrayIndexOutOfBoundsException e) {
			    return null;
			}
		    }
		    return null;
		}
		
		public int getLength() {
		    return implementations.size();
		}
	    };
    }
    
    /**
     * Registra una implmentación.
     *
     * @param s El código a registrar, puede no ser <code>null</code>
     */
    public void addSource(final DOMImplementationSource s) {
	if (s == null) {
	    throw new NullPointerException();
	}
	if (!sources.contains(s)) {
	    sources.addElement(s);
	}
    }
    
    /**
     *
     * Obtiene una clase cargada.
     *
     * @Devuelve una clase cargada, posiblemente <code>null</code>
     */
    private static ClassLoader getClassLoader() {
	try {
	    ClassLoader contextClassLoader = getContextClassLoader();
	    
	    if (contextClassLoader != null) {
		return contextClassLoader;
	    }
	} catch (Exception e) {
	    // Asume que la aplicación DOM está en un JRE 1.1, utilice el
	    // ClassLoader actual
	    return DOMImplementationRegistry.class.getClassLoader();
	}
	return DOMImplementationRegistry.class.getClassLoader();
    }
    
    /**
     * Este método intenta devolver la primera línea del recurso
     * META_INF/services/org.w3c.dom.DOMImplementationSourceList
     * desde el ClassLoader proporcionado.
     *
     * @param classLoader classLoader, pueden no ser <code>null</code>.
     * @devuelve la primera línea del recurso, o <code>null</code>
     */
    private static String getServiceValue(final ClassLoader classLoader) {
	String serviceId = "META-INF/services/" + PROPERTY;
	// intenta encontrar los servicios en CLASSPATH
	try {
	    InputStream is = getResourceAsStream(classLoader, serviceId);
	    
	    if (is != null) {
		BufferedReader rd;
		try {
		    rd =
			new BufferedReader(new InputStreamReader(is, "UTF-8"),
					   DEFAULT_LINE_LENGTH);
		} catch (java.io.UnsupportedEncodingException e) {
		    rd =
			new BufferedReader(new InputStreamReader(is),
					   DEFAULT_LINE_LENGTH);
		}		
		String serviceValue = rd.readLine();
		rd.close();
		if (serviceValue != null && serviceValue.length() > 0) {
		    return serviceValue;
		}
	    }
	} catch (Exception ex) {
	    return null;
	}
	return null;
    }
    
    /**
     * Un simple test JRE (Java Runtime Environment) 1.1
     *
     * @devuelve <code>true</code> si es JRE 1.1 
     */
    private static boolean isJRE11() {
	try {
	    Class c = Class.forName("java.security.AccessController");
	    // java.security.AccessController existe desde 1.2 así, si no
	    // fue lanzada una excepción, la aplicación DOM es iniciada en un JRE
	    // 1.2 o superior
	    return false;
	} catch (Exception ex) {
	    // ignora 
	}
	return true;
    }
    
    /**
     * This method returns the ContextClassLoader or <code>null</code> if
     * running in a JRE 1.1
     *
     * @return The Context Classloader
     */
    private static ClassLoader getContextClassLoader() {
	return isJRE11()
	    ? null
	    : (ClassLoader)
 	      AccessController.doPrivileged(new PrivilegedAction() {
		    public Object run() {
			ClassLoader classLoader = null;
			try {
			    classLoader =
				Thread.currentThread().getContextClassLoader();
			} catch (SecurityException ex) {
			}
			return classLoader;
		    }
		});
    }
    
    /**
     * Este método devuelve la propidad del sistema indicada por el nombre especificado
     * despues de testear el control de privilegios de acceso. Para un JRE 1.1, este testeo no es
     * realizado.
     * 	 
     * @param name el nombre de la propiedad del sistema
     * @devuelve la propiedad del sistema
     */
    private static String getSystemProperty(final String name) {
	return isJRE11()
	    ? (String) System.getProperty(name)
	    : (String) AccessController.doPrivileged(new PrivilegedAction() {
		    public Object run() {
			return System.getProperty(name);
		    }
		});
    }
    
    /**
     * Este método devuelve una corriente de entradas (Inputstream) para el recurso de lectura
     * META_INF/services/org.w3c.dom.DOMImplementationSourceList despues del testeo
     * de privilegios de control de accesos. Para un JRE 1.1, este testeo no es realizado.
     *
     * @param classLoader la clase Cargada
     * @param name el recurso
     * @Devuelve una corriente de entradas (Inputstream) para el recurso especificado
     */
    private static InputStream getResourceAsStream(final ClassLoader classLoader,
						   final String name) {
	if (isJRE11()) {
	    InputStream ris;
	    if (classLoader == null) {
		ris = ClassLoader.getSystemResourceAsStream(name);
	    } else {
		ris = classLoader.getResourceAsStream(name);
	    }    
	    return ris;
	} else {
	    return (InputStream)
		AccessController.doPrivileged(new PrivilegedAction() {
			public Object run() {
			    InputStream ris;
			    if (classLoader == null) {
				ris =
				    ClassLoader.getSystemResourceAsStream(name);
			    } else {
				ris = classLoader.getResourceAsStream(name);
			    }
			    return ris;
			}
		    });
	}
    }
}

G.2 Otras interfaces del Núcleo

org/w3c/dom/DOMException.java:

package org.w3c.dom;

public class DOMException extends RuntimeException {
    public DOMException(short code, String message) {
       super(message);
       this.code = code;
    }
    public short   code;
    // ExceptionCode
    public static final short INDEX_SIZE_ERR            = 1;
    public static final short DOMSTRING_SIZE_ERR        = 2;
    public static final short HIERARCHY_REQUEST_ERR     = 3;
    public static final short WRONG_DOCUMENT_ERR        = 4;
    public static final short INVALID_CHARACTER_ERR     = 5;
    public static final short NO_DATA_ALLOWED_ERR       = 6;
    public static final short NO_MODIFICATION_ALLOWED_ERR = 7;
    public static final short NOT_FOUND_ERR             = 8;
    public static final short NOT_SUPPORTED_ERR         = 9;
    public static final short INUSE_ATTRIBUTE_ERR       = 10;
    public static final short INVALID_STATE_ERR         = 11;
    public static final short SYNTAX_ERR                = 12;
    public static final short INVALID_MODIFICATION_ERR  = 13;
    public static final short NAMESPACE_ERR             = 14;
    public static final short INVALID_ACCESS_ERR        = 15;
    public static final short VALIDATION_ERR            = 16;
    public static final short TYPE_MISMATCH_ERR         = 17;

}

org/w3c/dom/DOMStringList.java:

package org.w3c.dom;

public interface DOMStringList {
    public String item(int index);

    public int getLength();

    public boolean contains(String str);

}

org/w3c/dom/NameList.java:

package org.w3c.dom;

public interface NameList {
    public String getName(int index);

    public String getNamespaceURI(int index);

    public int getLength();

    public boolean contains(String str);

    public boolean containsNS(String namespaceURI, 
                              String name);

}

org/w3c/dom/DOMImplementationList.java:

package org.w3c.dom;

public interface DOMImplementationList {
    public DOMImplementation item(int index);

    public int getLength();

}

org/w3c/dom/DOMImplementationSource.java:

package org.w3c.dom;

public interface DOMImplementationSource {
    public DOMImplementation getDOMImplementation(String features);

    public DOMImplementationList getDOMImplementationList(String features);

}

org/w3c/dom/DOMImplementation.java:

package org.w3c.dom;

public interface DOMImplementation {
    public boolean hasFeature(String feature, 
                              String version);

    public DocumentType createDocumentType(String qualifiedName, 
                                           String publicId, 
                                           String systemId)
                                           throws DOMException;

    public Document createDocument(String namespaceURI, 
                                   String qualifiedName, 
                                   DocumentType doctype)
                                   throws DOMException;

    public Object getFeature(String feature, 
                             String version);

}

org/w3c/dom/DocumentFragment.java:

package org.w3c.dom;

public interface DocumentFragment extends Node {
}

org/w3c/dom/Document.java:

package org.w3c.dom;

public interface Document extends Node {
    public DocumentType getDoctype();

    public DOMImplementation getImplementation();

    public Element getDocumentElement();

    public Element createElement(String tagName)
                                 throws DOMException;

    public DocumentFragment createDocumentFragment();

    public Text createTextNode(String data);

    public Comment createComment(String data);

    public CDATASection createCDATASection(String data)
                                           throws DOMException;

    public ProcessingInstruction createProcessingInstruction(String target, 
                                                             String data)
                                                             throws DOMException;

    public Attr createAttribute(String name)
                                throws DOMException;

    public EntityReference createEntityReference(String name)
                                                 throws DOMException;

    public NodeList getElementsByTagName(String tagname);

    public Node importNode(Node importedNode, 
                           boolean deep)
                           throws DOMException;

    public Element createElementNS(String namespaceURI, 
                                   String qualifiedName)
                                   throws DOMException;

    public Attr createAttributeNS(String namespaceURI, 
                                  String qualifiedName)
                                  throws DOMException;

    public NodeList getElementsByTagNameNS(String namespaceURI, 
                                           String localName);

    public Element getElementById(String elementId);

    public String getInputEncoding();

    public String getXmlEncoding();

    public boolean getXmlStandalone();
    public void setXmlStandalone(boolean xmlStandalone)
                                  throws DOMException;

    public String getXmlVersion();
    public void setXmlVersion(String xmlVersion)
                                  throws DOMException;

    public boolean getStrictErrorChecking();
    public void setStrictErrorChecking(boolean strictErrorChecking);

    public String getDocumentURI();
    public void setDocumentURI(String documentURI);

    public Node adoptNode(Node source)
                          throws DOMException;

    public DOMConfiguration getDomConfig();

    public void normalizeDocument();

    public Node renameNode(Node n, 
                           String namespaceURI, 
                           String qualifiedName)
                           throws DOMException;

}

org/w3c/dom/Node.java:

package org.w3c.dom;

public interface Node {
    // NodeType
    public static final short ELEMENT_NODE              = 1;
    public static final short ATTRIBUTE_NODE            = 2;
    public static final short TEXT_NODE                 = 3;
    public static final short CDATA_SECTION_NODE        = 4;
    public static final short ENTITY_REFERENCE_NODE     = 5;
    public static final short ENTITY_NODE               = 6;
    public static final short PROCESSING_INSTRUCTION_NODE = 7;
    public static final short COMMENT_NODE              = 8;
    public static final short DOCUMENT_NODE             = 9;
    public static final short DOCUMENT_TYPE_NODE        = 10;
    public static final short DOCUMENT_FRAGMENT_NODE    = 11;
    public static final short NOTATION_NODE             = 12;

    public String getNodeName();

    public String getNodeValue()
                           throws DOMException;
    public void setNodeValue(String nodeValue)
                           throws DOMException;

    public short getNodeType();

    public Node getParentNode();

    public NodeList getChildNodes();

    public Node getFirstChild();

    public Node getLastChild();

    public Node getPreviousSibling();

    public Node getNextSibling();

    public NamedNodeMap getAttributes();

    public Document getOwnerDocument();

    public Node insertBefore(Node newChild, 
                             Node refChild)
                             throws DOMException;

    public Node replaceChild(Node newChild, 
                             Node oldChild)
                             throws DOMException;

    public Node removeChild(Node oldChild)
                            throws DOMException;

    public Node appendChild(Node newChild)
                            throws DOMException;

    public boolean hasChildNodes();

    public Node cloneNode(boolean deep);

    public void normalize();

    public boolean isSupported(String feature, 
                               String version);

    public String getNamespaceURI();

    public String getPrefix();
    public void setPrefix(String prefix)
                               throws DOMException;

    public String getLocalName();

    public boolean hasAttributes();

    public String getBaseURI();

    // DocumentPosition
    public static final short DOCUMENT_POSITION_DISCONNECTED = 0x01;
    public static final short DOCUMENT_POSITION_PRECEDING = 0x02;
    public static final short DOCUMENT_POSITION_FOLLOWING = 0x04;
    public static final short DOCUMENT_POSITION_CONTAINS = 0x08;
    public static final short DOCUMENT_POSITION_CONTAINED_BY = 0x10;
    public static final short DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC = 0x20;

    public short compareDocumentPosition(Node other)
                                         throws DOMException;

    public String getTextContent()
                                         throws DOMException;
    public void setTextContent(String textContent)
                                         throws DOMException;

    public boolean isSameNode(Node other);

    public String lookupPrefix(String namespaceURI);

    public boolean isDefaultNamespace(String namespaceURI);

    public String lookupNamespaceURI(String prefix);

    public boolean isEqualNode(Node arg);

    public Object getFeature(String feature, 
                             String version);

    public Object setUserData(String key, 
                              Object data, 
                              UserDataHandler handler);

    public Object getUserData(String key);

}

org/w3c/dom/NodeList.java:

package org.w3c.dom;

public interface NodeList {
    public Node item(int index);

    public int getLength();

}

org/w3c/dom/NamedNodeMap.java:

package org.w3c.dom;

public interface NamedNodeMap {
    public Node getNamedItem(String name);

    public Node setNamedItem(Node arg)
                             throws DOMException;

    public Node removeNamedItem(String name)
                                throws DOMException;

    public Node item(int index);

    public int getLength();

    public Node getNamedItemNS(String namespaceURI, 
                               String localName)
                               throws DOMException;

    public Node setNamedItemNS(Node arg)
                               throws DOMException;

    public Node removeNamedItemNS(String namespaceURI, 
                                  String localName)
                                  throws DOMException;

}

org/w3c/dom/CharacterData.java:

package org.w3c.dom;

public interface CharacterData extends Node {
    public String getData()
                                  throws DOMException;
    public void setData(String data)
                                  throws DOMException;

    public int getLength();

    public String substringData(int offset, 
                                int count)
                                throws DOMException;

    public void appendData(String arg)
                           throws DOMException;

    public void insertData(int offset, 
                           String arg)
                           throws DOMException;

    public void deleteData(int offset, 
                           int count)
                           throws DOMException;

    public void replaceData(int offset, 
                            int count, 
                            String arg)
                            throws DOMException;

}

org/w3c/dom/Attr.java:

package org.w3c.dom;

public interface Attr extends Node {
    public String getName();

    public boolean getSpecified();

    public String getValue();
    public void setValue(String value)
                            throws DOMException;

    public Element getOwnerElement();

    public TypeInfo getSchemaTypeInfo();

    public boolean isId();

}

org/w3c/dom/Element.java:

package org.w3c.dom;

public interface Element extends Node {
    public String getTagName();

    public String getAttribute(String name);

    public void setAttribute(String name, 
                             String value)
                             throws DOMException;

    public void removeAttribute(String name)
                                throws DOMException;

    public Attr getAttributeNode(String name);

    public Attr setAttributeNode(Attr newAttr)
                                 throws DOMException;

    public Attr removeAttributeNode(Attr oldAttr)
                                    throws DOMException;

    public NodeList getElementsByTagName(String name);

    public String getAttributeNS(String namespaceURI, 
                                 String localName)
                                 throws DOMException;

    public void setAttributeNS(String namespaceURI, 
                               String qualifiedName, 
                               String value)
                               throws DOMException;

    public void removeAttributeNS(String namespaceURI, 
                                  String localName)
                                  throws DOMException;

    public Attr getAttributeNodeNS(String namespaceURI, 
                                   String localName)
                                   throws DOMException;

    public Attr setAttributeNodeNS(Attr newAttr)
                                   throws DOMException;

    public NodeList getElementsByTagNameNS(String namespaceURI, 
                                           String localName)
                                           throws DOMException;

    public boolean hasAttribute(String name);

    public boolean hasAttributeNS(String namespaceURI, 
                                  String localName)
                                  throws DOMException;

    public TypeInfo getSchemaTypeInfo();

    public void setIdAttribute(String name, 
                               boolean isId)
                               throws DOMException;

    public void setIdAttributeNS(String namespaceURI, 
                                 ng localName, 
                                boolean isId)
                                 throws DOMException;

    public void setIdAttributeNode(Attr idAttr, 
                                   boolean isId)
                                   throws DOMException;

}

org/w3c/dom/Text.java:

package org.w3c.dom;

public interface Text extends CharacterData {
    public Text splitText(int offset)
                          throws DOMException;

    public boolean isElementContentWhitespace();

    public String getWholeText();

    public Text replaceWholeText(String content)
                                 throws DOMException;

}

org/w3c/dom/Comment.java:

package org.w3c.dom;

public interface Comment extends CharacterData {
}

org/w3c/dom/TypeInfo.java:

package org.w3c.dom;

public interface TypeInfo {
    public String getTypeName();

    public String getTypeNamespace();

    // DerivationMethods
    public static final int DERIVATION_RESTRICTION    = 0x00000001;
    public static final int DERIVATION_EXTENSION      = 0x00000002;
    public static final int DERIVATION_UNION          = 0x00000004;
    public static final int DERIVATION_LIST           = 0x00000008;

    public boolean isDerivedFrom(String typeNamespaceArg, 
                                 String typeNameArg, 
                                 int derivationMethod);

}

org/w3c/dom/UserDataHandler.java:

package org.w3c.dom;

public interface UserDataHandler {
    // OperationType
    public static final short NODE_CLONED               = 1;
    public static final short NODE_IMPORTED             = 2;
    public static final short NODE_DELETED              = 3;
    public static final short NODE_RENAMED              = 4;
    public static final short NODE_ADOPTED              = 5;

    public void handle(short operation, 
                       String key, 
                       Object data, 
                       Node src, 
                       Node dst);

}

org/w3c/dom/DOMError.java:

package org.w3c.dom;

public interface DOMError {
    // ErrorSeverity
    public static final short SEVERITY_WARNING          = 1;
    public static final short SEVERITY_ERROR            = 2;
    public static final short SEVERITY_FATAL_ERROR      = 3;

    public short getSeverity();

    public String getMessage();

    public String getType();

    public Object getRelatedException();

    public Object getRelatedData();

    public DOMLocator getLocation();

}

org/w3c/dom/DOMErrorHandler.java:

package org.w3c.dom;

public interface DOMErrorHandler {
    public boolean handleError(DOMError error);

}

org/w3c/dom/DOMLocator.java:

package org.w3c.dom;

public interface DOMLocator {
    public int getLineNumber();

    public int getColumnNumber();

    public int getByteOffset();

    public int getUtf16Offset();

    public Node getRelatedNode();

    public String getUri();

}

org/w3c/dom/DOMConfiguration.java:

package org.w3c.dom;

public interface DOMConfiguration {
    public void setParameter(String name, 
                             Object value)
                             throws DOMException;

    public Object getParameter(String name)
                               throws DOMException;

    public boolean canSetParameter(String name, 
                                   Object value);

    public DOMStringList getParameterNames();

}

org/w3c/dom/CDATASection.java:

package org.w3c.dom;

public interface CDATASection extends Text {
}

org/w3c/dom/DocumentType.java:

package org.w3c.dom;

public interface DocumentType extends Node {
    public String getName();

    public NamedNodeMap getEntities();

    public NamedNodeMap getNotations();

    public String getPublicId();

    public String getSystemId();

    public String getInternalSubset();

}

org/w3c/dom/Notation.java:

package org.w3c.dom;

public interface Notation extends Node {
    public String getPublicId();

    public String getSystemId();

}

org/w3c/dom/Entity.java:

package org.w3c.dom;

public interface Entity extends Node {
    public String getPublicId();

    public String getSystemId();

    public String getNotationName();

    public String getInputEncoding();

    public String getXmlEncoding();

    public String getXmlVersion();

}

org/w3c/dom/EntityReference.java:

package org.w3c.dom;

public interface EntityReference extends Node {
}

org/w3c/dom/ProcessingInstruction.java:

package org.w3c.dom;

public interface ProcessingInstruction extends Node {
    public String getTarget();

    public String getData();
    public void setData(String data)
                                   throws DOMException;

}