09 February 2001

Appendix B: Java Language Binding

This appendix contains the complete Java [Java] bindings for the Level 3 Document Object Model Content Model and Load and Save.

The Java files are also available as http://www.w3.org/TR/2001/WD-DOM-Level-3-CMLS-20010209/java-binding.zip

org/w3c/dom/contentModel/CMModel.java:

package org.w3c.dom.contentModel;

import org.w3c.dom.nsElement;

public interface CMModel extends CMNode {
    public boolean getIsNamespaceAware();

    public ElementDeclaration getRootElementDecl();

    public String getLocation();

    public nsElement getCMNamespace();

    public CMNamedNodeMap getCMNodes();

    public boolean removeNode(CMNode node);

    public boolean insertBefore(CMNode newNode, 
                                CMNode refNode);

    public boolean validate();

}

org/w3c/dom/contentModel/CMExternalModel.java:

package org.w3c.dom.contentModel;

public interface CMExternalModel extends CMModel {
}

org/w3c/dom/contentModel/CMNode.java:

package org.w3c.dom.contentModel;

public interface CMNode {
    public static final short ELEMENT_DECLARATION       = 1;
    public static final short ATTRIBUTE_DECLARATION     = 2;
    public static final short CM_NOTATION_DECLARATION   = 3;
    public static final short ENTITY_DECLARATION        = 4;
    public static final short CM_CHILDREN               = 5;
    public static final short CM_MODEL                  = 6;
    public static final short CM_EXTERNALMODEL          = 7;
    public short getCmNodeType();

    public CMNode cloneCM();

    public CMNode cloneExternalCM();

}

org/w3c/dom/contentModel/CMNodeList.java:

package org.w3c.dom.contentModel;

public interface CMNodeList {
}

org/w3c/dom/contentModel/CMNamedNodeMap.java:

package org.w3c.dom.contentModel;

public interface CMNamedNodeMap {
}

org/w3c/dom/contentModel/CMDataType.java:

package org.w3c.dom.contentModel;

public interface CMDataType {
    public static final short STRING_DATATYPE           = 1;
    public static final short BOOLEAN_DATATYPE          = 2;
    public static final short FLOAT_DATATYPE            = 3;
    public static final short DOUBLE_DATATYPE           = 4;
    public static final short LONG_DATATYPE             = 5;
    public static final short INT_DATATYPE              = 6;
    public static final short SHORT_DATATYPE            = 7;
    public static final short BYTE_DATATYPE             = 8;
    public int getLowValue();
    public void setLowValue(int lowValue);

    public int getHighValue();
    public void setHighValue(int highValue);

    public short getPrimitiveType();

}

org/w3c/dom/contentModel/ElementDeclaration.java:

package org.w3c.dom.contentModel;

public interface ElementDeclaration {
    public int getContentType();

    public CMChildren getCMChildren();

    public CMNamedNodeMap getCMAttributes();

    public CMNamedNodeMap getCMGrandChildren();

}

org/w3c/dom/contentModel/CMChildren.java:

package org.w3c.dom.contentModel;

public interface CMChildren {
    public String getListOperator();
    public void setListOperator(String listOperator);

    public CMDataType getElementType();
    public void setElementType(CMDataType elementType);

    public int getMultiplicity();
    public void setMultiplicity(int multiplicity);

    public CMNamedNodeMap getSubModels();
    public void setSubModels(CMNamedNodeMap subModels);

    public boolean getIsPCDataOnly();

}

org/w3c/dom/contentModel/AttributeDeclaration.java:

package org.w3c.dom.contentModel;

public interface AttributeDeclaration {
    public static final short NO_VALUE_CONSTRAINT       = 0;
    public static final short DEFAULT_VALUE_CONSTRAINT  = 1;
    public static final short FIXED_VALUE_CONSTRAINT    = 2;
    public String getAttrName();

    public CMDataType getAttrType();
    public void setAttrType(CMDataType attrType);

    public String getAttributeValue();
    public void setAttributeValue(String attributeValue);

    public String getEnumAttr();
    public void setEnumAttr(String enumAttr);

    public CMNodeList getOwnerElement();
    public void setOwnerElement(CMNodeList ownerElement);

    public short getConstraintType();
    public void setConstraintType(short constraintType);

}

org/w3c/dom/contentModel/EntityDeclaration.java:

package org.w3c.dom.contentModel;

public interface EntityDeclaration {
}

org/w3c/dom/contentModel/CMNotationDeclaration.java:

package org.w3c.dom.contentModel;

public interface CMNotationDeclaration {
    public String getStrSystemIdentifier();
    public void setStrSystemIdentifier(String strSystemIdentifier);

    public String getStrPublicIdentifier();
    public void setStrPublicIdentifier(String strPublicIdentifier);

}

org/w3c/dom/contentModel/Document.java:

package org.w3c.dom.contentModel;

public interface Document {
    public void setErrorHandler(DOMErrorHandler handler);

}

org/w3c/dom/contentModel/DocumentCM.java:

package org.w3c.dom.contentModel;

import org.w3c.dom.CMExternalModel *;

public interface DocumentCM extends Document {
    public int numCMs();

    public CMModel getInternalCM();

    public CMExternalModel * getCMs();

    public CMModel getActiveCM();

    public void addCM(CMModel cm);

    public void removeCM(CMModel cm);

    public boolean activateCM(CMModel cm);

}

org/w3c/dom/contentModel/DOMImplementationCM.java:

package org.w3c.dom.contentModel;

import org.w3c.dom.DOMImplementation;

public interface DOMImplementationCM extends DOMImplementation {
    public CMModel createCM();

    public CMExternalModel createExternalCM();

}

org/w3c/dom/contentModel/NodeCM.java:

package org.w3c.dom.contentModel;

import org.w3c.dom.Node;
import org.w3c.dom.DOMException;

public interface NodeCM extends Node {
    public boolean canInsertBefore(Node newChild, 
                                   Node refChild)
                                   throws DOMException;

    public boolean canRemoveChild(Node oldChild)
                                  throws DOMException;

    public boolean canReplaceChild(Node newChild, 
                                   Node oldChild)
                                   throws DOMException;

    public boolean canAppendChild(Node newChild)
                                  throws DOMException;

    public boolean isValid();

}

org/w3c/dom/contentModel/ElementCM.java:

package org.w3c.dom.contentModel;

import org.w3c.dom.Node;
import org.w3c.dom.DOMException;
import org.w3c.dom.Element;

public interface ElementCM extends Element {
    public int contentType();

    public ElementDeclaration getElementDeclaration()
                                                    throws DOMException;

    public boolean canSetAttribute(String attrname, 
                                   String attrval);

    public boolean canSetAttributeNode(Node node);

    public boolean canSetAttributeNodeNS(Node node, 
                                         String namespaceURI, 
                                         String localName);

    public boolean canSetAttributeNS(String attrname, 
                                     String attrval, 
                                     String namespaceURI, 
                                     String localName);

}

org/w3c/dom/contentModel/CharacterDataCM.java:

package org.w3c.dom.contentModel;

import org.w3c.dom.Text;
import org.w3c.dom.DOMException;

public interface CharacterDataCM extends Text {
    public boolean isWhitespaceOnly();

    public boolean canSetData(int offset, 
                              String arg)
                              throws DOMException;

    public boolean canAppendData(String arg)
                                 throws DOMException;

    public boolean canReplaceData(int offset, 
                                  int count, 
                                  String arg)
                                  throws DOMException;

    public boolean canInsertData(int offset, 
                                 String arg)
                                 throws DOMException;

    public boolean canDeleteData(int offset, 
                                 String arg)
                                 throws DOMException;

}

org/w3c/dom/contentModel/DocumentTypeCM.java:

package org.w3c.dom.contentModel;

import org.w3c.dom.DocumentType;

public interface DocumentTypeCM extends DocumentType {
    public boolean isElementDefined(String elemTypeName);

    public boolean isElementDefinedNS(String elemTypeName, 
                                      String namespaceURI, 
                                      String localName);

    public boolean isAttributeDefined(String elemTypeName, 
                                      String attrName);

    public boolean isAttributeDefinedNS(String elemTypeName, 
                                        String attrName, 
                                        String namespaceURI, 
                                        String localName);

    public boolean isEntityDefined(String entName);

}

org/w3c/dom/contentModel/AttributeCM.java:

package org.w3c.dom.contentModel;

import org.w3c.dom.DOMException;

public interface AttributeCM {
    public AttributeDeclaration getAttributeDeclaration();

    public CMNotationDeclaration getNotation()
                                             throws DOMException;

}

org/w3c/dom/contentModel/DOMErrorHandler.java:

package org.w3c.dom.contentModel;

import org.w3c.dom.DOMSystemException;

public interface DOMErrorHandler {
    public void warning(DOMLocator where, 
                        String how, 
                        String why)
                        throws DOMSystemException;

    public void fatalError(DOMLocator where, 
                           String how, 
                           String why)
                           throws DOMSystemException;

    public void error(DOMLocator where, 
                      String how, 
                      String why)
                      throws DOMSystemException;

}

org/w3c/dom/contentModel/DOMLocator.java:

package org.w3c.dom.contentModel;

import org.w3c.dom.Node;

public interface DOMLocator {
    public int getColumnNumber();

    public int getLineNumber();

    public String getPublicID();

    public String getSystemID();

    public Node getNode();

}

org/w3c/dom/loadSave/DOMImplementationLS.java:

package org.w3c.dom.loadSave;

public interface DOMImplementationLS {
    public DOMBuilder createDOMBuilder();

    public DOMWriter createDOMWriter();

}

org/w3c/dom/loadSave/DOMBuilder.java:

package org.w3c.dom.loadSave;

import org.w3c.dom.DOMErrorHandler;
import org.w3c.dom.Document;
import org.w3c.dom.DOMSystemException;
import org.w3c.dom.DOMException;

public interface DOMBuilder {
    public DOMEntityResolver getEntityResolver();
    public void setEntityResolver(DOMEntityResolver entityResolver);

    public DOMErrorHandler getErrorHandler();
    public void setErrorHandler(DOMErrorHandler errorHandler);

    public DOMBuilderFilter getFilter();
    public void setFilter(DOMBuilderFilter filter);

    public void setFeature(String name, 
                           boolean state)
                           throws DOMException;

    public boolean supportsFeature(String name);

    public boolean canSetFeature(String name, 
                                 boolean state);

    public boolean getFeature(String name)
                              throws DOMException;

    public Document parseURI(String uri)
                             throws DOMException, DOMSystemException;

    public Document parseDOMInputSource(DOMInputSource is)
                                        throws DOMException, DOMSystemException;

}

org/w3c/dom/loadSave/DOMInputSource.java:

package org.w3c.dom.loadSave;

public interface DOMInputSource {
    public java.io.InputStream getByteStream();
    public void setByteStream(java.io.InputStream byteStream);

    public java.io.Reader getCharacterStream();
    public void setCharacterStream(java.io.Reader characterStream);

    public String getEncoding();
    public void setEncoding(String encoding);

    public String getPublicId();
    public void setPublicId(String publicId);

    public String getSystemId();
    public void setSystemId(String systemId);

}

org/w3c/dom/loadSave/DOMEntityResolver.java:

package org.w3c.dom.loadSave;

import org.w3c.dom.DOMSystemException;

public interface DOMEntityResolver {
    public DOMInputSource resolveEntity(String publicId, 
                                        String systemId )
                                        throws DOMSystemException;

}

org/w3c/dom/loadSave/DOMBuilderFilter.java:

package org.w3c.dom.loadSave;

import org.w3c.dom.Element;

public interface DOMBuilderFilter {
    public boolean endElement(Element element);

}

org/w3c/dom/loadSave/DOMWriter.java:

package org.w3c.dom.loadSave;

import org.w3c.dom.Node;
import org.w3c.dom.DOMSystemException;

public interface DOMWriter {
    public String getEncoding();
    public void setEncoding(String encoding);

    public String getLastEncoding();

    public short getFormat();
    public void setFormat(short format);

    public String getNewLine();
    public void setNewLine(String newLine);

    public void writeNode(java.io.OutputStream destination, 
                          Node node)
                          throws DOMSystemException;

}