14 January 2002

Appendix B: Java Language Binding

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

The Java files are also available as http://www.w3.org/TR/2002/WD-DOM-Level-3-ASLS-20020114/java-binding.zip

org/w3c/dom/as/ASException.java:

package org.w3c.dom.as;

public class ASException extends RuntimeException {
    public ASException(short code, String message) {
       super(message);
       this.code = code;
    }
    public short   code;
    // ASExceptionCode
    public static final short DUPLICATE_NAME_ERR        = 1;
    public static final short TYPE_ERR                  = 2;
    public static final short NO_AS_AVAILABLE           = 3;
    public static final short WRONG_MIME_TYPE_ERR       = 4;
    public static final short INVALID_CHARACTER_ERR     = 5;
    public static final short VALIDATION_ERR            = 6;

}

org/w3c/dom/as/ASModel.java:

package org.w3c.dom.as;

public interface ASModel extends ASObject {
    // ASMODEL_TYPES
    public static final short INTERNAL_SUBSET           = 1;
    public static final short EXTERNAL_SUBSET           = 2;
    public static final short NOT_USED                  = 3;

    public boolean getNamespaceAware();

    public short getUsage();

    public String getLocation();
    public void setLocation(String location);

    public String getHint();
    public void setHint(String hint);

    public boolean getContainer();

    public ASNamedObjectMap getElementDecls();

    public ASNamedObjectMap getAttributeDecls();

    public ASNamedObjectMap getNotationDecls();

    public ASNamedObjectMap getEntityDecls();

    public ASNamedObjectMap getContentModelDecls();

    public void addASModel(ASModel abstractSchema);

    public ASObjectList getASModels();

    public void removeAS(ASModel as);

    public boolean validate();

    public void importASObject(ASObject asobject);

    public void insertASObject(ASObject asobject);

    public ASElementDecl createASElementDecl(String namespaceURI, 
                                             String name)
                                             throws ASException;

    public ASAttributeDecl createASAttributeDecl(String namespaceURI, 
                                                 String name)
                                                 throws ASException;

    public ASNotationDecl createASNotationDecl(String namespaceURI, 
                                               String name, 
                                               String systemId, 
                                               String publicId)
                                               throws ASException;

    public ASEntityDecl createASEntityDecl(String name)
                                           throws ASException;

    public ASContentModel createASContentModel(String name, 
                                               String namespaceURI, 
                                               int minOccurs, 
                                               int maxOccurs, 
                                               short operator)
                                               throws ASException;

}

org/w3c/dom/as/ASObject.java:

package org.w3c.dom.as;

public interface ASObject {
    // ASObjectType
    public static final short AS_ELEMENT_DECLARATION    = 1;
    public static final short AS_ATTRIBUTE_DECLARATION  = 2;
    public static final short AS_NOTATION_DECLARATION   = 3;
    public static final short AS_ENTITY_DECLARATION     = 4;
    public static final short AS_CONTENTMODEL           = 5;
    public static final short AS_MODEL                  = 6;

    public short getASObjectType();

    public ASModel getOwnerASModel();

    public String getObjectName();
    public void setObjectName(String objectName);

    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 ASObject cloneASObject(boolean deep);

}

org/w3c/dom/as/ASObjectList.java:

package org.w3c.dom.as;

public interface ASObjectList {
    public int getLength();

    public ASObject item(int index);

}

org/w3c/dom/as/ASNamedObjectMap.java:

package org.w3c.dom.as;

import org.w3c.dom.DOMException;

public interface ASNamedObjectMap {
    public int getLength();

    public ASObject getNamedItem(String name);

    public ASObject item(int index);

    public ASObject removeNamedItem(String name)
                                    throws DOMException;

    public ASObject setNamedItem(ASObject newASObject)
                                 throws DOMException, ASException;

}

org/w3c/dom/as/ASDataType.java:

package org.w3c.dom.as;

public interface ASDataType {
    public short getDataType();

    // DATA_TYPES
    public static final short STRING_DATATYPE           = 1;
    public static final short NOTATION_DATATYPE         = 10;
    public static final short ID_DATATYPE               = 11;
    public static final short IDREF_DATATYPE            = 12;
    public static final short IDREFS_DATATYPE           = 13;
    public static final short ENTITY_DATATYPE           = 14;
    public static final short ENTITIES_DATATYPE         = 15;
    public static final short NMTOKEN_DATATYPE          = 16;
    public static final short NMTOKENS_DATATYPE         = 17;
    public static final short BOOLEAN_DATATYPE          = 100;
    public static final short FLOAT_DATATYPE            = 101;
    public static final short DOUBLE_DATATYPE           = 102;
    public static final short DECIMAL_DATATYPE          = 103;
    public static final short HEXBINARY_DATATYPE        = 104;
    public static final short BASE64BINARY_DATATYPE     = 105;
    public static final short ANYURI_DATATYPE           = 106;
    public static final short QNAME_DATATYPE            = 107;
    public static final short DURATION_DATATYPE         = 108;
    public static final short DATETIME_DATATYPE         = 109;
    public static final short DATE_DATATYPE             = 110;
    public static final short TIME_DATATYPE             = 111;
    public static final short GYEARMONTH_DATATYPE       = 112;
    public static final short GYEAR_DATATYPE            = 113;
    public static final short GMONTHDAY_DATATYPE        = 114;
    public static final short GDAY_DATATYPE             = 115;
    public static final short GMONTH_DATATYPE           = 116;
    public static final short INTEGER                   = 117;
    public static final short NAME_DATATYPE             = 200;
    public static final short NCNAME_DATATYPE           = 201;
    public static final short NORMALIZEDSTRING_DATATYPE = 202;
    public static final short TOKEN_DATATYPE            = 203;
    public static final short LANGUAGE_DATATYPE         = 204;
    public static final short NONPOSITIVEINTEGER_DATATYPE = 205;
    public static final short NEGATIVEINTEGER_DATATYPE  = 206;
    public static final short LONG_DATATYPE             = 207;
    public static final short INT_DATATYPE              = 208;
    public static final short SHORT_DATATYPE            = 209;
    public static final short BYTE_DATATYPE             = 210;
    public static final short NONNEGATIVEINTEGER_DATATYPE = 211;
    public static final short UNSIGNEDLONG_DATATYPE     = 212;
    public static final short UNSIGNEDINT_DATATYPE      = 213;
    public static final short UNSIGNEDSHORT_DATATYPE    = 214;
    public static final short UNSIGNEDBYTE_DATATYPE     = 215;
    public static final short POSITIVEINTEGER_DATATYPE  = 216;
    public static final short OTHER_SIMPLE_DATATYPE     = 1000;
    public static final short COMPLEX_DATATYPE          = 1001;

}

org/w3c/dom/as/ASElementDecl.java:

package org.w3c.dom.as;

public interface ASElementDecl extends ASObject {
    // CONTENT_MODEL_TYPES
    public static final short EMPTY_CONTENTTYPE         = 1;
    public static final short ANY_CONTENTTYPE           = 2;
    public static final short MIXED_CONTENTTYPE         = 3;
    public static final short ELEMENTS_CONTENTTYPE      = 4;

    public boolean getStrictMixedContent();
    public void setStrictMixedContent(boolean strictMixedContent);

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

    public boolean getIsPCDataOnly();
    public void setIsPCDataOnly(boolean isPCDataOnly);

    public short getContentType();
    public void setContentType(short contentType);

    public ASContentModel getASContentModel();
    public void setASContentModel(ASContentModel ASContentModel);

    public ASNamedObjectMap getASAttributeDecls();
    public void setASAttributeDecls(ASNamedObjectMap ASAttributeDecls);

    public void addASAttributeDecl(ASAttributeDecl attributeDecl);

    public ASAttributeDecl removeASAttributeDecl(ASAttributeDecl attributeDecl);

}

org/w3c/dom/as/ASContentModel.java:

package org.w3c.dom.as;

public interface ASContentModel extends ASObject {
    public static final int AS_UNBOUNDED              = MAX_VALUE;
    // ASContentModelType
    public static final short AS_SEQUENCE               = 0;
    public static final short AS_CHOICE                 = 1;
    public static final short AS_ALL                    = 2;
    public static final short AS_NONE                   = 3;
    public static final short AS_UNDEFINED              = 4;

    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 ASObjectList getSubModels();
    public void setSubModels(ASObjectList subModels);

    public void removesubModel(ASObject oldObject);

    public ASObject insertBeforeSubModel(ASObject newObject, 
                                         ASObject refObject)
                                         throws ASException;

    public int appendsubModel(ASObject newObject)
                              throws ASException;

}

org/w3c/dom/as/ASAttributeDecl.java:

package org.w3c.dom.as;

public interface ASAttributeDecl extends ASObject {
    // VALUE_TYPES
    public static final short NONE                      = 0;
    public static final short DEFAULT                   = 1;
    public static final short FIXED                     = 2;
    public static final short REQUIRED                  = 3;

    public ASDataType getDataType();
    public void setDataType(ASDataType DataType);

    public String getDataValue();
    public void setDataValue(String DataValue);

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

    public ASObjectList getOwnerElements();
    public void setOwnerElements(ASObjectList ownerElements);

    public short getDefaultType();
    public void setDefaultType(short defaultType);

}

org/w3c/dom/as/ASEntityDecl.java:

package org.w3c.dom.as;

public interface ASEntityDecl extends ASObject {
    // EntityType
    public static final short INTERNAL_ENTITY           = 1;
    public static final short EXTERNAL_ENTITY           = 2;

    public short getEntityType();
    public void setEntityType(short entityType);

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

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

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

}

org/w3c/dom/as/ASNotationDecl.java:

package org.w3c.dom.as;

public interface ASNotationDecl extends ASObject {
    public String getSystemId();
    public void setSystemId(String systemId);

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

}

org/w3c/dom/as/DocumentAS.java:

package org.w3c.dom.as;

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

public interface DocumentAS extends Document {
    public ASModel getActiveASModel();
    public void setActiveASModel(ASModel activeASModel);

    public ASObjectList getBoundASModels();
    public void setBoundASModels(ASObjectList boundASModels);

    public ASModel getInternalAS();

    public void setInternalAS(ASModel as)
                              throws DOMException;

    public void addAS(ASModel as);

    public void removeAS(ASModel as);

    public ASElementDecl getElementDecl()
                                        throws DOMException;

    public void validate()
                         throws ASException;

}

org/w3c/dom/as/DOMImplementationAS.java:

package org.w3c.dom.as;

import org.w3c.dom.DOMImplementation;

public interface DOMImplementationAS extends DOMImplementation {
    public boolean getContainer();

    public String getSchemaType();
    public void setSchemaType(String schemaType);

    public ASModel createAS(boolean NamespaceAware, 
                            String schemaType);

}

org/w3c/dom/as/DocumentEditAS.java:

package org.w3c.dom.as;

public interface DocumentEditAS extends NodeEditAS {
    public boolean getContinuousValidityChecking();
    public void setContinuousValidityChecking(boolean continuousValidityChecking);

}

org/w3c/dom/as/NodeEditAS.java:

package org.w3c.dom.as;

import org.w3c.dom.Node;

public interface NodeEditAS extends Node {
    // ASCheckType
    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 canInsertBefore(Node newChild, 
                                   Node refChild);

    public boolean canRemoveChild(Node oldChild);

    public boolean canReplaceChild(Node newChild, 
                                   Node oldChild);

    public boolean canAppendChild(Node newChild);

    public boolean isNodeValid(boolean deep, 
                               short wFValidityCheckLevel)
                               throws ASException;

}

org/w3c/dom/as/ElementEditAS.java:

package org.w3c.dom.as;

import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.w3c.dom.Attr;

public interface ElementEditAS extends NodeEditAS {
    public NodeList getDefinedElementTypes();

    public short contentType();

    public boolean canSetAttribute(String attrname, 
                                   String attrval);

    public boolean canSetAttributeNode(Attr attrNode);

    public boolean canSetAttributeNS(String name, 
                                     String attrval, 
                                     String namespaceURI);

    public boolean canRemoveAttribute(String attrname);

    public boolean canRemoveAttributeNS(String attrname, 
                                        String namespaceURI);

    public boolean canRemoveAttributeNode(Node attrNode);

    public NodeList getChildElements();

    public NodeList getParentElements();

    public NodeList getAttributeList();

    public boolean isElementDefined(String elemTypeName);

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

}

org/w3c/dom/as/CharacterDataEditAS.java:

package org.w3c.dom.as;

public interface CharacterDataEditAS extends NodeEditAS {
    public boolean getIsWhitespaceOnly();

    public boolean canSetData(int offset, 
                              int count);

    public boolean canAppendData(String arg);

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

    public boolean canInsertData(int offset, 
                                 String arg);

    public boolean canDeleteData(int offset, 
                                 int count);

}

org/w3c/dom/as/ASDOMBuilder.java:

package org.w3c.dom.as;

import org.w3c.dom.ls.DOMInputSource;
import org.w3c.dom.ls.DOMBuilder;

public interface ASDOMBuilder extends DOMBuilder {
    public ASModel getAbstractSchema();
    public void setAbstractSchema(ASModel abstractSchema);

    public ASModel parseASURI(String uri, 
                              String schemaType)
                              throws ASException, Exception;

    public ASModel parseASInputSource(DOMInputSource is)
                                      throws ASException, Exception;

}

org/w3c/dom/as/DOMASWriter.java:

package org.w3c.dom.as;

import org.w3c.dom.ls.DOMWriter;

public interface DOMASWriter extends DOMWriter {
    public void writeASModel(java.io.OutputStream destination, 
                             ASModel model)
                             throws Exception;

}

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

package org.w3c.dom.ls;

import org.w3c.dom.DOMException;

public interface DOMImplementationLS {
    // DOMIMplementationLSMode
    public static final short MODE_SYNCHRONOUS          = 1;
    public static final short MODE_ASYNCHRONOUS         = 2;

    public DOMBuilder createDOMBuilder(short mode)
                                       throws DOMException;

    public DOMWriter createDOMWriter();

    public DOMInputSource createDOMInputSource();

}

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

package org.w3c.dom.ls;

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

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 canSetFeature(String name, 
                                 boolean state);

    public boolean getFeature(String name)
                              throws DOMException;

    public Document parseURI(String uri)
                             throws Exception;

    public Document parse(DOMInputSource is)
                          throws Exception;

    // ACTION_TYPES
    public static final short ACTION_REPLACE            = 1;
    public static final short ACTION_APPEND             = 2;
    public static final short ACTION_INSERT_AFTER       = 3;
    public static final short ACTION_INSERT_BEFORE      = 4;

    public void parseWithContext(DOMInputSource is, 
                                 Node cnode, 
                                 short action)
                                 throws DOMException;

}

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

package org.w3c.dom.ls;

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

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

    public boolean canSetFeature(String name, 
                                 boolean state);

    public boolean getFeature(String name)
                              throws DOMException;

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

    public String getLastEncoding();

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

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

    public boolean writeNode(java.io.OutputStream destination, 
                             Node wnode)
                             throws Exception;

    public String writeToString(Node wnode)
                                throws DOMException;

}

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

package org.w3c.dom.ls;

public interface DOMInputSource {
    public DOMInputSource getByteStream();
    public void setByteStream(DOMInputSource byteStream);

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

    public String getStringData();
    public void setStringData(String stringData);

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

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

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

    public String getBaseURI();
    public void setBaseURI(String baseURI);

}

org/w3c/dom/ls/LSLoadEvent.java:

package org.w3c.dom.ls;

import org.w3c.dom.Document;
import org.w3c.dom.events.Event;

public interface LSLoadEvent extends Event {
    public Document getNewDocument();

    public DOMInputSource getInputSource();

}

org/w3c/dom/ls/LSProgressEvent.java:

package org.w3c.dom.ls;

import org.w3c.dom.events.Event;

public interface LSProgressEvent extends Event {
    public DOMInputSource getInputSource();

    public int getPosition();

    public int getTotalSize();

}

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

package org.w3c.dom.ls;

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

}

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

package org.w3c.dom.ls;

import org.w3c.dom.Node;

public interface DOMBuilderFilter {
    public int startNode(Node snode);

    public int endNode(Node enode);

    public int getWhatToShow();

}

org/w3c/dom/ls/DOMWriterFilter.java:

package org.w3c.dom.ls;

import org.w3c.dom.traversal.NodeFilter;

public interface DOMWriterFilter extends NodeFilter {
    public int getWhatToShow();

}

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

package org.w3c.dom.ls;

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 uri);

    public boolean loadXML(String source);

    public String saveXML(Node snode)
                          throws DOMException;

}

org/w3c/dom/ls/ParseErrorEvent.java:

package org.w3c.dom.ls;

import org.w3c.dom.events.Event;
import org.w3c.dom.DOMError;

public interface ParseErrorEvent extends Event {
    public DOMError getError();

}