25 October 2001

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/2001/WD-DOM-Level-3-ASLS-20011025/java-binding.zip

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

package org.w3c.dom.as;

public class DOMASException extends RuntimeException {
    public DOMASException(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;

}

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

package org.w3c.dom.as;

import org.w3c.dom.DOMException;

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

    public short getUsageLocation();

    public String getAsLocation();
    public void setAsLocation(String asLocation);

    public String getAsHint();
    public void setAsHint(String asHint);

    public ASNamedObjectMap getElementDeclarations();

    public ASNamedObjectMap getAttributeDeclarations();

    public ASNamedObjectMap getNotationDeclarations();

    public ASNamedObjectMap getEntityDeclarations();

    public ASNamedObjectMap getContentModelDeclarations();

    public void setASModel(ASModel abstractSchema);

    public ASObjectList getASModels();

    public void removeAS(ASModel as);

    public boolean validate();

    public ASElementDeclaration createASElementDeclaration(String namespaceURI, 
                                                           String name)
                                                           throws DOMException;

    public ASAttributeDeclaration createASAttributeDeclaration(String namespaceURI, 
                                                               String name)
                                                               throws DOMException;

    public ASNotationDeclaration createASNotationDeclaration(String namespaceURI, 
                                                             String name, 
                                                             String systemId, 
                                                             String publicId)
                                                             throws DOMException;

    public ASEntityDeclaration createASEntityDeclaration(String name)
                                                         throws DOMException;

    public ASContentModel createASContentModel(int minOccurs, 
                                               int maxOccurs, 
                                               short operator)
                                               throws DOMASException;

}

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

    public ASModel getOwnerASModel();
    public void setOwnerASModel(ASModel ownerASModel);

    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 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 getNamedItemNS(String namespaceURI, 
                                   String localName);

    public ASObject item(int index);

    public ASObject removeNamedItem(String name)
                                    throws DOMException;

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

    public ASObject setNamedItem(ASObject newASObject)
                                 throws DOMException;

    public ASObject setNamedItemNS(ASObject newASObject)
                                   throws DOMException;

}

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

package org.w3c.dom.as;

public interface ASElementDeclaration 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 String getSystemId();
    public void setSystemId(String systemId);

    public ASContentModel getAsCM();
    public void setAsCM(ASContentModel asCM);

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

    public void addASAttributeDecl(ASAttributeDeclaration attributeDecl);

    public ASAttributeDeclaration removeASAttributeDecl(ASAttributeDeclaration 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 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 oldNode);

    public void insertsubModel(ASObject newNode)
                               throws DOMASException;

    public int appendsubModel(ASObject newNode)
                              throws DOMASException;

}

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

package org.w3c.dom.as;

public interface ASAttributeDeclaration extends ASObject {
    // VALUE_TYPES
    public static final short VALUE_NONE                = 0;
    public static final short VALUE_DEFAULT             = 1;
    public static final short VALUE_FIXED               = 2;

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

package org.w3c.dom.as;

public interface ASEntityDeclaration 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/ASNotationDeclaration.java:

package org.w3c.dom.as;

public interface ASNotationDeclaration 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.DOMException;

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

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

    public ASModel getInternalAS();

    public void setInternalAS(ASModel as);

    public void addAS(ASModel as);

    public void removeAS(ASModel as);

    public ASElementDeclaration getElementDeclaration()
                                                      throws DOMException;

    public void validate()
                         throws DOMASException;

}

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

package org.w3c.dom.as;

public interface DOMImplementationAS {
    public ASModel createAS(boolean isNamespaceAware);

    public DOMASBuilder createDOMASBuilder();

    public DOMASWriter createDOMASWriter();

}

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 {
    // 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 DOMASException;

}

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

package org.w3c.dom.as;

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

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

    public ASModel parseASURI(String uri)
                              throws DOMASException, Exception;

    public ASModel parseASInputSource(DOMInputSource is)
                                      throws DOMASException, 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();

}