19 April 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-20010419/java-binding.zip

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

package org.w3c.dom.contentModel;

import org.w3c.dom.nsElement;
import org.w3c.dom.DOMException;

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

    public CMElementDeclaration getRootElementDecl();
    public void setRootElementDecl(CMElementDeclaration rootElementDecl);

    public String getLocation();

    public nsElement getCMNamespace();

    public CMNamedNodeMap getCMNodes();

    public boolean removeNode(CMNode node);

    public boolean insertBefore(CMNode newNode, 
                                CMNode refNode);

    public boolean validate();

    public CMElementDeclaration createCMElementDeclaration(String namespaceURI, 
                                                           String qualifiedElementName, 
                                                           int contentSpec)
                                                           throws DOMException;

    public CMAttributeDeclaration createCMAttributeDeclaration(String namespaceURI, 
                                                               String qualifiedName)
                                                               throws DOMException;

    public CMNotationDeclaration createCMNotationDeclaration(String name, 
                                                             String systemIdentifier, 
                                                             String publicIdentifier)
                                                             throws DOMException;

    public CMEntityDeclaration createCMEntityDeclaration(String name)
                                                         throws DOMException;

    public CMChildren createCMChildren(int minOccurs, 
                                       int maxOccurs, 
                                       short operator)
                                       throws DOMException;

}

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 CM_ELEMENT_DECLARATION    = 1;
    public static final short CM_ATTRIBUTE_DECLARATION  = 2;
    public static final short CM_NOTATION_DECLARATION   = 3;
    public static final short CM_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 CMModel getOwnerCMModel();
    public void setOwnerCMModel(CMModel ownerCMModel);

    public String getNodeName();
    public void setNodeName(String nodeName);

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

    public String getLocalName();
    public void setLocalName(String localName);

    public String getNamespaceURI();
    public void setNamespaceURI(String namespaceURI);

    public CMNode clone();

}

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 short getCMPrimitiveType();

}

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

package org.w3c.dom.contentModel;

import org.w3c.dom.decimal;

public interface CMPrimitiveType extends CMDataType {
    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 DECIMAL_DATATYPE          = 5;
    public static final short HEXBINARY_DATATYPE        = 6;
    public static final short BASE64BINARY_DATATYPE     = 7;
    public static final short ANYURI_DATATYPE           = 8;
    public static final short QNAME_DATATYPE            = 9;
    public static final short DURATION_DATATYPE         = 10;
    public static final short DATETIME_DATATYPE         = 11;
    public static final short DATE_DATATYPE             = 12;
    public static final short TIME_DATATYPE             = 13;
    public static final short YEARMONTH_DATATYPE        = 14;
    public static final short YEAR_DATATYPE             = 15;
    public static final short MONTHDAY_DATATYPE         = 16;
    public static final short DAY_DATATYPE              = 17;
    public static final short MONTH_DATATYPE            = 18;
    public static final short NOTATION_DATATYPE         = 19;
    public decimal getLowValue();
    public void setLowValue(decimal lowValue);

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

}

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

package org.w3c.dom.contentModel;

public interface CMElementDeclaration extends CMNode {
    public CMDataType getElementType();
    public void setElementType(CMDataType elementType);

    public boolean getIsPCDataOnly();

    public String getTagName();
    public void setTagName(String tagName);

    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 extends CMNode {
    public static final int UNBOUNDED                 = MAX_LONG;
    public static final short NONE                      = 0;
    public static final short SEQUENCE                  = 1;
    public static final short CHOICE                    = 2;
    public short getListOperator();
    public void setListOperator(short listOperator);

    public int getMinOccurs();
    public void setMinOccurs(int minOccurs);

    public int getMaxOccurs();
    public void setMaxOccurs(int maxOccurs);

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

    public CMNode removeCMNode(int nodeIndex);

    public int insertCMNode(int nodeIndex, 
                            CMNode newNode);

    public int appendCMNode(CMNode newNode);

}

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

package org.w3c.dom.contentModel;

public interface CMAttributeDeclaration extends CMNode {
    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 void setAttrName(String attrName);

    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/CMEntityDeclaration.java:

package org.w3c.dom.contentModel;

public interface CMEntityDeclaration extends CMNode {
    public static final short INTERNAL_ENTITY           = 1;
    public static final short EXTERNAL_ENTITY           = 2;
    public short getEntityType();
    public void setEntityType(short entityType);

    public String getEntityName();
    public void setEntityName(String entityName);

    public String getEntityValue();
    public void setEntityValue(String entityValue);

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

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

    public String getNotationName();
    public void setNotationName(String notationName);

}

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

package org.w3c.dom.contentModel;

public interface CMNotationDeclaration extends CMNode {
    public String getNotationName();
    public void setNotationName(String notationName);

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

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

}

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;

public interface DocumentCM extends Document {
    public static final short WF_CHECK                  = 1;
    public static final short NS_WF_CHECK               = 2;
    public static final short PARTIAL_VALIDITY_CHECK    = 3;
    public static final short STRICT_VALIDITY_CHECK     = 4;
    public boolean getContinuousValidityChecking();
    public void setContinuousValidityChecking(boolean continuousValidityChecking);

    public short getWfValidityCheckLevel();
    public void setWfValidityCheckLevel(short wfValidityCheckLevel);

    public int numCMs();

    public CMModel getInternalCM();

    public CMNodeList 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()
                           throws DOMException;

}

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

package org.w3c.dom.contentModel;

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

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

    public CMElementDeclaration getElementDeclaration()
                                                      throws DOMException;

    public boolean canSetAttribute(String attrname, 
                                   String attrval);

    public boolean canSetAttributeNode(Node node);

    public boolean canSetAttributeNodeNS(Node node);

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

    public boolean canRemoveAttribute(String attrname);

    public boolean canRemoveAttributeNS(String attrname, 
                                        String namespaceURI);

    public boolean canRemoveAttributeNode(Node node);

}

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

package org.w3c.dom.contentModel;

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

public interface CharacterDataCM extends Text,NodeCM {
    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,NodeCM;

public interface DocumentTypeCM extends DocumentType,NodeCM {
    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.Attr,NodeCM;
import org.w3c.dom.DOMException;

public interface AttributeCM extends Attr,NodeCM {
    public CMAttributeDeclaration 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 startElement(Element element);

    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;

}

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

package org.w3c.dom.loadSave;

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

public interface DocumentLS {
    public boolean getAsync();
    public void setAsync(boolean async);

    public void abort();

    public boolean load(String url);

    public boolean loadXML(String source);

    public String saveXML(Node node)
                          throws DOMException;

}

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

package org.w3c.dom.loadSave;

public interface ParserErrorEvent {
    public int getErrorCode();

    public int getFilepos();

    public int getLine();

    public int getLinepos();

    public String getReason();

    public String getSrcText();

    public String getUrl();

}