org.opencyc.xml
Class NameNodeFilter

java.lang.Object
  |
  +--org.opencyc.xml.NameNodeFilter
All Implemented Interfaces:
org.w3c.dom.traversal.NodeFilter

public class NameNodeFilter
extends java.lang.Object
implements org.w3c.dom.traversal.NodeFilter

Provides a implementation of org.w3c.dom.traversal.NodeFilter that allows a TreeWalker to select nodes of a DOM tree based on their tag name.

Author:
Stefano Bertolo

Copyright 2001 Cycorp, Inc., license is open source GNU LGPL.

the license

www.opencyc.org

OpenCyc at SourceForge

THIS SOFTWARE AND KNOWLEDGE BASE CONTENT ARE PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OPENCYC ORGANIZATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE AND KNOWLEDGE BASE CONTENT, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.


Fields inherited from interface org.w3c.dom.traversal.NodeFilter
FILTER_ACCEPT, FILTER_REJECT, FILTER_SKIP, SHOW_ALL, SHOW_ATTRIBUTE, SHOW_CDATA_SECTION, SHOW_COMMENT, SHOW_DOCUMENT, SHOW_DOCUMENT_FRAGMENT, SHOW_DOCUMENT_TYPE, SHOW_ELEMENT, SHOW_ENTITY, SHOW_ENTITY_REFERENCE, SHOW_NOTATION, SHOW_PROCESSING_INSTRUCTION, SHOW_TEXT
 
Constructor Summary
NameNodeFilter(java.lang.String tag)
          Creates a NameNodeFilter that will be used by a TreeWalker to navigate a DOM tree obtained from an XML input document and accept only nodes that in the XML document were tagged with the string that is supplied as the only parameter of this creator method.
 
Method Summary
 short acceptNode(org.w3c.dom.Node node)
          Decides whether an input node should be accepted based on its Local Name.
 java.lang.String getTagName()
          Gets the NameNodeFilter's tagname field
 void setTagName(java.lang.String tag)
          Sets the NameNodeFilter's tagname field
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NameNodeFilter

public NameNodeFilter(java.lang.String tag)
Creates a NameNodeFilter that will be used by a TreeWalker to navigate a DOM tree obtained from an XML input document and accept only nodes that in the XML document were tagged with the string that is supplied as the only parameter of this creator method. For example, to create a NameNodeFilter that only looks at DOM nodes that were tagged ... in the input XML document, do NameNodeFilter filter = new NameNodeFilter("MyTag");
Method Detail

setTagName

public void setTagName(java.lang.String tag)
Sets the NameNodeFilter's tagname field

getTagName

public java.lang.String getTagName()
Gets the NameNodeFilter's tagname field
Returns:
the String in the NameNodeFilter's tagname field

acceptNode

public short acceptNode(org.w3c.dom.Node node)
                 throws org.w3c.dom.DOMException
Decides whether an input node should be accepted based on its Local Name.
Specified by:
acceptNode in interface org.w3c.dom.traversal.NodeFilter
Parameters:
node - the input node
Returns:
a short, whose value depends on the appropriate static fields of the org.w3c.dom.Node class.