Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * Copyright 2012 Google Inc.
   * 
   * Licensed under the Apache License, Version 2.0 (the "License"); you may not
   * use this file except in compliance with the License. You may obtain a copy of
   * the License at
   * 
   * http://www.apache.org/licenses/LICENSE-2.0
   * 
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  * License for the specific language governing permissions and limitations under
  * the License.
  */
 package elemental.traversal;
 
 
 import java.util.Date;

 
 public interface NodeFilter {

  
Value returned by the NodeFilter.acceptNode() method when a node should be accepted.
 
 
     static final short FILTER_ACCEPT = 1;

  
Value to be returned by the NodeFilter.acceptNode() method when a node should be rejected. The children of rejected nodes are not visited by the NodeIterator or TreeWalker object; this value is treated as "skip this node and all its children".
 
 
     static final short FILTER_REJECT = 2;

  
Value to be returned by NodeFilter.acceptNode() for nodes to be skipped by the NodeIterator or TreeWalker object. The children of skipped nodes are still considered. This is treated as "skip this node but not its children".
 
 
     static final short FILTER_SKIP = 3;

  
Shows all nodes.
 
 
     static final int SHOW_ALL = 0xFFFFFFFF;

  
Shows attribute Attr nodes. This is meaningful only when creating a NodeIterator or TreeWalker with an Attr node as its root; in this case, it means that the attribute node will appear in the first position of the iteration or traversal. Since attributes are never children of other nodes, they do not appear when traversing over the document tree.
 
 
     static final int SHOW_ATTRIBUTE = 0x00000002;

  
Shows CDATASection  nodes.
 
 
     static final int SHOW_CDATA_SECTION = 0x00000008;

  
Shows Comment  nodes.
 
 
     static final int SHOW_COMMENT = 0x00000080;

  
Shows Document  nodes.
 
 
     static final int SHOW_DOCUMENT = 0x00000100;

  
Shows DocumentFragment  nodes.
 
 
    static final int SHOW_DOCUMENT_FRAGMENT = 0x00000400;

  
Shows DocumentType  nodes.
    static final int SHOW_DOCUMENT_TYPE = 0x00000200;

  
Shows Element  nodes.
    static final int SHOW_ELEMENT = 0x00000001;

  
Shows Entity  nodes. This is meaningful only when creating a NodeIterator or TreeWalker with an Entity node as its root; in this case, it means that the Entity node will appear in the first position of the traversal. Since entities are not part of the document tree, they do not appear when traversing over the document tree.
    static final int SHOW_ENTITY = 0x00000020;

  
Shows EntityReference  nodes.
    static final int SHOW_ENTITY_REFERENCE = 0x00000010;

  
Shows Notation nodes. This is meaningful only when creating a NodeIterator or TreeWalker with a Notation node as its root; in this case, it means that the Notation node will appear in the first position of the traversal. Since entities are not part of the document tree, they do not appear when traversing over the document tree.
    static final int SHOW_NOTATION = 0x00000800;

  
Shows ProcessingInstruction  nodes.
    static final int SHOW_PROCESSING_INSTRUCTION = 0x00000040;

  
Shows Text  nodes.
    static final int SHOW_TEXT = 0x00000004;


  
The accept node method used by the filter is supplied as an object property when constructing the NodeIterator or TreeWalker .
  short acceptNode(Node n);
New to GrepCode? Check out our FAQ X