| <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" |
| "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
| <!-- |
| Generated: Thu Nov 09 17:46:07 EST 2000 jfouffa.w3.org |
| --> |
| <html lang='en' xmlns="http://www.w3.org/1999/xhtml"> |
| <head> |
| <title>Java Language Binding</title> |
| <link rel='stylesheet' type='text/css' href='./spec.css' /> |
| <link rel='stylesheet' type='text/css' href='W3C-REC.css' /> |
| <link rel='next' href='ecma-script-binding.html' /> |
| <link rel='contents' href='Overview.html#contents' /> |
| <link rel='index' href='def-index.html' /> |
| <link rel='previous' href='idl-definitions.html' /> |
| </head> |
| <body> |
| <div class='navbar' align='center'><a accesskey='p' |
| href='idl-definitions.html'>previous</a> <a accesskey='n' |
| href='ecma-script-binding.html'>next</a> <a accesskey='c' |
| href='Overview.html#contents'>contents</a> <a accesskey='i' |
| href='def-index.html'>index</a> |
| |
| <hr title='Navigation area separator' /> |
| </div> |
| |
| <div class='noprint' style='text-align: right'> |
| <p style='font-family: monospace;font-size:small'>13 November, |
| 2000</p> |
| </div> |
| |
| <div class='div1'><a id="java-binding" name='java-binding'></a> |
| |
| <h1 id='java-binding-h1' class='adiv1'>Appendix B: Java Language |
| Binding</h1> |
| |
| <p>This appendix contains the complete Java Language [<a |
| class='noxref' href='references.html#Java'>Java</a>] binding for |
| the Level 2 Document Object Model Traversal and Range. The |
| definitions are divided into <a |
| href='#Traversal-Java'>Traversal</a>, and <a |
| href='#Range-Java'>Range</a>.</p> |
| |
| <p>The Java files are also available as <a |
| href='java-binding.zip'>http://www.w3.org/TR/2000/REC-DOM-Level-2-Traversal-Range-20001113/java-binding.zip</a></p> |
| |
| <div class='div2'><a id="Traversal-Java" name='Traversal-Java'></a> |
| |
| |
| <h2 id='Traversal-Java-h2' class='adiv2'>B.1: Document Object Model |
| Traversal</h2> |
| |
| <h3 id='org.w3c.dom.traversal.NodeIterator'> |
| org/w3c/dom/traversal/NodeIterator.java:</h3> |
| |
| <div class='java-code'> |
| <pre> |
| package org.w3c.dom.traversal; |
| |
| import org.w3c.dom.Node; |
| import org.w3c.dom.DOMException; |
| |
| public interface NodeIterator { |
| public Node getRoot(); |
| |
| public int getWhatToShow(); |
| |
| public NodeFilter getFilter(); |
| |
| public boolean getExpandEntityReferences(); |
| |
| public Node nextNode() |
| throws DOMException; |
| |
| public Node previousNode() |
| throws DOMException; |
| |
| public void detach(); |
| |
| } |
| </pre> |
| </div> |
| |
| <h3 id='org.w3c.dom.traversal.NodeFilter'> |
| org/w3c/dom/traversal/NodeFilter.java:</h3> |
| |
| <div class='java-code'> |
| <pre> |
| package org.w3c.dom.traversal; |
| |
| import org.w3c.dom.Node; |
| |
| public interface NodeFilter { |
| // Constants returned by acceptNode |
| public static final short FILTER_ACCEPT = 1; |
| public static final short FILTER_REJECT = 2; |
| public static final short FILTER_SKIP = 3; |
| |
| // Constants for whatToShow |
| public static final int SHOW_ALL = 0xFFFFFFFF; |
| public static final int SHOW_ELEMENT = 0x00000001; |
| public static final int SHOW_ATTRIBUTE = 0x00000002; |
| public static final int SHOW_TEXT = 0x00000004; |
| public static final int SHOW_CDATA_SECTION = 0x00000008; |
| public static final int SHOW_ENTITY_REFERENCE = 0x00000010; |
| public static final int SHOW_ENTITY = 0x00000020; |
| public static final int SHOW_PROCESSING_INSTRUCTION = 0x00000040; |
| public static final int SHOW_COMMENT = 0x00000080; |
| public static final int SHOW_DOCUMENT = 0x00000100; |
| public static final int SHOW_DOCUMENT_TYPE = 0x00000200; |
| public static final int SHOW_DOCUMENT_FRAGMENT = 0x00000400; |
| public static final int SHOW_NOTATION = 0x00000800; |
| |
| public short acceptNode(Node n); |
| |
| } |
| </pre> |
| </div> |
| |
| <h3 id='org.w3c.dom.traversal.TreeWalker'> |
| org/w3c/dom/traversal/TreeWalker.java:</h3> |
| |
| <div class='java-code'> |
| <pre> |
| package org.w3c.dom.traversal; |
| |
| import org.w3c.dom.Node; |
| import org.w3c.dom.DOMException; |
| |
| public interface TreeWalker { |
| public Node getRoot(); |
| |
| public int getWhatToShow(); |
| |
| public NodeFilter getFilter(); |
| |
| public boolean getExpandEntityReferences(); |
| |
| public Node getCurrentNode(); |
| public void setCurrentNode(Node currentNode) |
| throws DOMException; |
| |
| public Node parentNode(); |
| |
| public Node firstChild(); |
| |
| public Node lastChild(); |
| |
| public Node previousSibling(); |
| |
| public Node nextSibling(); |
| |
| public Node previousNode(); |
| |
| public Node nextNode(); |
| |
| } |
| </pre> |
| </div> |
| |
| <h3 id='org.w3c.dom.traversal.DocumentTraversal'> |
| org/w3c/dom/traversal/DocumentTraversal.java:</h3> |
| |
| <div class='java-code'> |
| <pre> |
| package org.w3c.dom.traversal; |
| |
| import org.w3c.dom.Node; |
| import org.w3c.dom.DOMException; |
| |
| public interface DocumentTraversal { |
| public NodeIterator createNodeIterator(Node root, |
| int whatToShow, |
| NodeFilter filter, |
| boolean entityReferenceExpansion) |
| throws DOMException; |
| |
| public TreeWalker createTreeWalker(Node root, |
| int whatToShow, |
| NodeFilter filter, |
| boolean entityReferenceExpansion) |
| throws DOMException; |
| |
| } |
| </pre> |
| </div> |
| </div> |
| |
| <!-- div2 Traversal-Java --> |
| <div class='div2'><a id="Range-Java" name='Range-Java'></a> |
| |
| <h2 id='Range-Java-h2' class='adiv2'>B.2: Document Object Model |
| Range</h2> |
| |
| <h3 id='org.w3c.dom.ranges.RangeException'> |
| org/w3c/dom/ranges/RangeException.java:</h3> |
| |
| <div class='java-code'> |
| <pre> |
| package org.w3c.dom.ranges; |
| |
| public class RangeException extends RuntimeException { |
| public RangeException(short code, String message) { |
| super(message); |
| this.code = code; |
| } |
| public short code; |
| // RangeExceptionCode |
| public static final short BAD_BOUNDARYPOINTS_ERR = 1; |
| public static final short INVALID_NODE_TYPE_ERR = 2; |
| |
| } |
| </pre> |
| </div> |
| |
| <h3 id='org.w3c.dom.ranges.Range'> |
| org/w3c/dom/ranges/Range.java:</h3> |
| |
| <div class='java-code'> |
| <pre> |
| package org.w3c.dom.ranges; |
| |
| import org.w3c.dom.Node; |
| import org.w3c.dom.DocumentFragment; |
| import org.w3c.dom.DOMException; |
| |
| public interface Range { |
| public Node getStartContainer() |
| throws DOMException; |
| |
| public int getStartOffset() |
| throws DOMException; |
| |
| public Node getEndContainer() |
| throws DOMException; |
| |
| public int getEndOffset() |
| throws DOMException; |
| |
| public boolean getCollapsed() |
| throws DOMException; |
| |
| public Node getCommonAncestorContainer() |
| throws DOMException; |
| |
| public void setStart(Node refNode, |
| int offset) |
| throws RangeException, DOMException; |
| |
| public void setEnd(Node refNode, |
| int offset) |
| throws RangeException, DOMException; |
| |
| public void setStartBefore(Node refNode) |
| throws RangeException, DOMException; |
| |
| public void setStartAfter(Node refNode) |
| throws RangeException, DOMException; |
| |
| public void setEndBefore(Node refNode) |
| throws RangeException, DOMException; |
| |
| public void setEndAfter(Node refNode) |
| throws RangeException, DOMException; |
| |
| public void collapse(boolean toStart) |
| throws DOMException; |
| |
| public void selectNode(Node refNode) |
| throws RangeException, DOMException; |
| |
| public void selectNodeContents(Node refNode) |
| throws RangeException, DOMException; |
| |
| // CompareHow |
| public static final short START_TO_START = 0; |
| public static final short START_TO_END = 1; |
| public static final short END_TO_END = 2; |
| public static final short END_TO_START = 3; |
| |
| public short compareBoundaryPoints(short how, |
| Range sourceRange) |
| throws DOMException; |
| |
| public void deleteContents() |
| throws DOMException; |
| |
| public DocumentFragment extractContents() |
| throws DOMException; |
| |
| public DocumentFragment cloneContents() |
| throws DOMException; |
| |
| public void insertNode(Node newNode) |
| throws DOMException, RangeException; |
| |
| public void surroundContents(Node newParent) |
| throws DOMException, RangeException; |
| |
| public Range cloneRange() |
| throws DOMException; |
| |
| public String toString() |
| throws DOMException; |
| |
| public void detach() |
| throws DOMException; |
| |
| } |
| </pre> |
| </div> |
| |
| <h3 id='org.w3c.dom.ranges.DocumentRange'> |
| org/w3c/dom/ranges/DocumentRange.java:</h3> |
| |
| <div class='java-code'> |
| <pre> |
| package org.w3c.dom.ranges; |
| |
| public interface DocumentRange { |
| public Range createRange(); |
| |
| } |
| </pre> |
| </div> |
| </div> |
| |
| <!-- div2 Range-Java --></div> |
| |
| <!-- div1 java-binding --> |
| <div class='navbar' align='center'> |
| <hr title='Navigation area separator' /> |
| <a accesskey='p' href='idl-definitions.html'>previous</a> <a |
| accesskey='n' href='ecma-script-binding.html'>next</a> <a |
| accesskey='c' href='Overview.html#contents'>contents</a> <a |
| accesskey='i' href='def-index.html'>index</a></div> |
| </body> |
| </html> |
| |