25 July 2002

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/2002/WD-DOM-Level-3-Val-20020725/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      = 1;
    public static final short VALIDATION_ERR            = 2;

}

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

package org.w3c.dom.validation;

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

    public void validateInDocument()
                                   throws ExceptionVAL;

}

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

package org.w3c.dom.validation;

import org.w3c.dom.Node;

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 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.NodeList;
import org.w3c.dom.Attr;

public interface ElementEditVAL extends NodeEditVAL {
    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/validation/CharacterDataEditVAL.java:

package org.w3c.dom.validation;

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

    public boolean canSetData(int offset, 
                              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);

}