09 April 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-20020409/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;
    public static final short ACTIVEAS_DELETION_ERR     = 7;

}

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

package org.w3c.dom.as;

public interface ASConstants {
    // ASObject Types
    public static final short ELEMENT_DECLARATION       = 1;
    public static final short ATTRIBUTE_DECLARATION     = 2;
    public static final short NOTATION_DECLARATION      = 3;
    public static final short ENTITY_DECLARATION        = 4;
    public static final short CONTENT_MODEL             = 5;
    public static final short SCHEMA_MODEL              = 6;

    // Schema Model types
    public static final short INTERNAL_SUBSET           = 30;
    public static final short EXTERNAL_SUBSET           = 31;
    public static final short NOT_USED                  = 32;

    // Entity Types
    public static final short INTERNAL_ENTITY           = 33;
    public static final short EXTERNAL_ENTITY           = 34;

    // Content Model Types
    public static final short EMPTY_CONTENTTYPE         = 40;
    public static final short SIMPLE_CONTENTTYPE        = 41;
    public static final short ELEMENT_CONTENTTYPE       = 42;
    public static final short MIXED_CONTENTTYPE         = 43;
    public static final short ANY_CONTENTTYPE           = 44;

    // Content model compositors
    public static final short SEQUENCE_CM               = 50;
    public static final short CHOICE_CM                 = 51;
    public static final short ALL_CM                    = 52;
    public static final short UNDEFINED_CM              = 53;
    public static final short ATOMIC_CM                 = 54;

    // Value Constraint
    public static final short NONE_VC                   = 0;
    public static final short DEFAULT_VC                = 60;
    public static final short FIXED_VC                  = 61;
    public static final short REQUIRED_VC               = 62;

    // Definition of unbounded
    public static final int UNBOUNDED                 = MAX_VALUE;

}

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

package org.w3c.dom.as;

public interface ASObject {
    public short getObjectType();

    public ASModel getOwnerModel();

    public String getRawname();

    public String getName();

    public String getNamespace();

    public ASObject cloneASObject(boolean deep)
                                  throws 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 ANYSIMPLETYPE_DATATYPE    = 216;
    public static final short ANYTYPE_DATATYPE          = 216;

}

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;

public interface ASNamedObjectMap {
    public int getLength();

    public ASObject item(int index);

    public ASObject getNamedItem(String name);

    public ASObject getNamedItemNS(String namespaceURI, 
                                   String localName);

}

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

package org.w3c.dom.as;

public interface ASModel extends ASObject {
    public boolean getNamespaceAware();

    public short getUsage();

    public String getLocation();

    public String getHint();

    public boolean getContainer();

    public ASNamedObjectMap getComponents(short objectType);

    // Convenience method to retrive named top-level declarations

    public ASElementDecl getElementDecl(String name, 
                                        String targetNamespace);

    public ASAttributeDecl getAttributeDecl(String name, 
                                            String targetNamespace);

    public ASEntityDecl getEntityDecl(String name);

    public ASNotationDecl getNotationDecl(String name, 
                                          String targetNamespace);

}

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

package org.w3c.dom.as;

public interface ASContentModel extends ASObject {
    public short getContentModelType();

    public int getMinOccurs();

    public int getMaxOccurs();

    public ASObjectList getSubModels();

}

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

package org.w3c.dom.as;

public interface ASElementDecl extends ASObject {
    public ASDataType getType();

    public short getContentType();

    public boolean getStrictMixedContent();

    public ASContentModel getContentModel();

    public boolean getIsPCDataOnly();

    public ASNamedObjectMap getAttributeDecls();

    public ASAttributeDecl getAttributeDecl(String name, 
                                            String targetNamespace);

}

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

package org.w3c.dom.as;

public interface ASAttributeDecl extends ASObject {
    public ASDataType getType();

    public String getEnumAttr();

    public ASObjectList getOwnerElementDeclarations();

    public short getDefaultType();

    public String getValue();

}

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

package org.w3c.dom.as;

public interface ASEntityDecl extends ASObject {
    public short getEntityType();

    public String getEntityValue();

    public String getSystemId();

    public String getPublicId();

}

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

package org.w3c.dom.as;

public interface ASNotationDecl extends ASObject {
    public String getSystemId();

    public String getPublicId();

}

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

package org.w3c.dom.as;

public interface ASWModel extends ASModel {
    public void setLocation(String location);

    public void setHint(String hint);

    public void addComponent(ASObject declaration);

    public void removeComponent(ASObject declaration);

    public void addASModel(ASModel declaration);

    public void removeASModel(ASModel declaration);

    public ASObjectList getASModels();

    public ASObject importASObject(ASObject asobject);

    public void insertASObject(ASObject asobject);

    public boolean validate();

    public ASWElementDecl createASWElementDecl(String namespaceURI, 
                                               String name)
                                               throws ASException;

    public ASWAttributeDecl createASWAttributeDecl(String namespaceURI, 
                                                   String name)
                                                   throws ASException;

    public ASWNotationDecl createASWNotationDecl(String namespaceURI, 
                                                 String name, 
                                                 String systemId, 
                                                 String publicId)
                                                 throws ASException;

    public ASWEntityDecl createASWEntityDecl(String name)
                                             throws ASException;

    public ASWContentModel createASWContentModel(String name, 
                                                 String namespaceURI, 
                                                 int minOccurs, 
                                                 int maxOccurs, 
                                                 short operator)
                                                 throws ASException;

}

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

package org.w3c.dom.as;

import org.w3c.dom.DOMException;

public interface ASWNamedObjectMap extends ASNamedObjectMap {
    public ASObject removeNamedItem(String name)
                                    throws ASException;

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

    public ASObject setNamedItemNS(ASObject arg)
                                   throws ASException;

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

}

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

package org.w3c.dom.as;

public interface ASWElementDecl extends ASElementDecl {
    public void setRawname(String rawname);

    public void setName(String name);

    public void setNamespace(String namespaceURI);

    public void setStrictMixedContent(boolean mixedContent);

    public void setType(ASDataType type);

    public void setContentType(short contentType);

    public void setContentModel(ASWContentModel contentModel);

    public void addAttributeDecl(ASWAttributeDecl attributeDecl);

    public ASWAttributeDecl removeAttributeDecl(ASWAttributeDecl attributeDecl);

}

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

package org.w3c.dom.as;

public interface ASWContentModel extends ASContentModel {
    public void setName(String name);

    public void setNamespaceURI(String namespaceURI);

    public void setContentModelType(short operator);

    public void setMinOccurs(int minOccurs);

    public void setMaxOccurs(int maxOccurs);

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

package org.w3c.dom.as;

public interface ASWAttributeDecl extends ASAttributeDecl {
    public void setRawname(String rawname);

    public void setName(String name);

    public void setNamespaceURI(String namespaceURI);

    public void setType(ASDataType type);

    public void setValue(String value);

    public void setEnumAttr(String enumeration);

    public void setDefaultType(short constraint);

}

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

package org.w3c.dom.as;

public interface ASWEntityDecl extends ASEntityDecl {
    public void setRawname(String rawname);

    public void setEntityType(short type);

    public void setEntityValue(String value);

    public void setSystemId(String systemId);

    public void setPublicId(String publicId);

}

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

package org.w3c.dom.as;

public interface ASWNotationDecl extends ASNotationDecl {
    public void setRawname(String rawname);

    public void setName(String name);

    public void setNamespaceURI(String namespaceURI);

    public void setSystemId(String systemId);

    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.Element;
import org.w3c.dom.DOMException;
import org.w3c.dom.Notation;
import org.w3c.dom.Attr;
import org.w3c.dom.Entity;

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)
                         throws ASException;

    public ASElementDecl getElementDecl(Element node)
                                        throws DOMException;

    public ASAttributeDecl getAttributeDecl(Attr node)
                                            throws DOMException;

    public ASEntityDecl getEntityDecl(Entity node)
                                      throws DOMException;

    public ASNotationDecl getNotationDecl(Notation node)
                                          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 ASWModel createASWModel(boolean isNamespaceAware, 
                                   boolean container, 
                                   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 ASWModel getAbstractSchema();
    public void setAbstractSchema(ASWModel abstractSchema);

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

    public ASWModel parseASInputSource(DOMInputSource is, 
                                       String schemaType)
                                       throws ASException, Exception;

}

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

package org.w3c.dom.as;

import org.w3c.dom.ls.DOMWriter;

public interface ASDOMWriter 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, 
                                       String schemaType)
                                       throws DOMException;

    public DOMWriter createDOMWriter();

    public DOMInputSource createDOMInputSource();

}

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

    public void abort();

    public boolean load(String uri);

    public boolean loadXML(String source);

    public String saveXML(Node snode)
                          throws DOMException;

}

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

package org.w3c.dom.ls;

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 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 static final short FILTER_INTERRUPT          = 4;
    public short startContainer(Node snode);

    public short acceptNode(Node enode);

    public int getWhatToShow();

}

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

}

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

    public Document parse(DOMInputSource is)
                          throws Exception;

    // ACTION_TYPES
    public static final short ACTION_REPLACE            = 1;
    public static final short ACTION_APPEND_AS_CHILDREN = 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 getNewLine();
    public void setNewLine(String newLine);

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

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

package org.w3c.dom.ls;

import org.w3c.dom.traversal.NodeFilter;

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

}