05 February 2003

Appendix B: Java Language Binding

This appendix contains the complete Java [Java] bindings for the Level 3 Document Object Model Validation.

The Java files are also available as http://www.w3.org/TR/2003/WD-DOM-Level-3-Val-20030205/java-binding.zip

org/w3c/dom/validation/ExceptionVAL.java:

package org.w3c.dom.validation;

public class ExceptionVAL extends RuntimeException {
    public ExceptionVAL(short code, String message) {
       super(message);
       this.code = code;
    }
    public short   code;
    // ExceptionVALCode
    public static final short NO_GRAMMAR_AVAILABLE_ERR  = 71;

}

org/w3c/dom/validation/DocumentEditVAL.java:

package org.w3c.dom.validation;

import org.w3c.dom.NameList;

public interface DocumentEditVAL extends NodeEditVAL {
    public boolean getContinuousValidityChecking();
    public void setContinuousValidityChecking(boolean continuousValidityChecking);

    public NameList getDefinedElementTypes(String namespaceURI);

    public void validateDocument()
                                 throws ExceptionVAL;

}

org/w3c/dom/validation/NodeEditVAL.java:

package org.w3c.dom.validation;

import org.w3c.dom.Node;
import org.w3c.dom.DOMStringList;

public interface NodeEditVAL {
    // CheckTypeVAL
    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 String getDefaultValue();

    public DOMStringList getEnumeratedValues();

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

}

org/w3c/dom/validation/ElementEditVAL.java:

package org.w3c.dom.validation;

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

public interface ElementEditVAL extends NodeEditVAL {
    public NameList getAllowedChildren();

    public NameList getAllowedParents();

    public NameList getAllowedNextSiblings();

    public NameList getAllowedPreviousSiblings();

    public NameList getAllowedAttributes();

    public NameList getRequiredAttributes();

    public short contentType();

    public boolean canSetAttribute(String attrname, 
                                   String attrval);

    public boolean canSetAttributeNode(Attr attrNode);

    public boolean canSetAttributeNS(String namespaceURI, 
                                     String qualifiedName, 
                                     String value);

    public boolean canRemoveAttribute(String attrname);

    public boolean canRemoveAttributeNS(String namespaceURI, 
                                        String localName);

    public boolean canRemoveAttributeNode(Node attrNode);

    public boolean isElementDefined(String name);

    public boolean isElementDefinedNS(String namespaceURI, 
                                      String name);

}

org/w3c/dom/validation/CharacterDataEditVAL.java:

package org.w3c.dom.validation;

public interface CharacterDataEditVAL extends NodeEditVAL {
    public boolean getIsWhitespaceOnly();

    public boolean canSetData(String arg);

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

package org.w3c.dom.validation;

import org.w3c.dom.Node;
import org.w3c.dom.Range;
import org.w3c.dom.NameList;

public interface RangeVAL extends Range {
    public boolean canSurroundContents(Node node1, 
                                       Node node2, 
                                       Node b);

    public NameList getAlternativeElements(Node refChild);

}