All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class w3c.xmlOnline.tree.TreeListener

java.lang.Object
   |
   +----w3c.xmlOnline.tree.TreeListener

public class TreeListener
extends Object
implements XMLListener
A class that implements the XMLListener interface and uses it to build a tree corresponding to the XML document that is parsed.

Version:
$Id: w3c.xmlOnline.tree.TreeListener.html,v 1.7 1997/06/09 22:26:24 bbos Exp $
Author:
Bert Bos
See Also:
Parser

Constructor Index

 o TreeListener()

Method Index

 o doComments(boolean)
Set a flag that determines whether comments are stored or ignored.
 o doPIs(boolean)
Set a flag that determines whether PIs are stored or ignored.
 o handleAttribute(String, String)
This function is called by the parser when it has recognized an attribute name/value pair.
 o handleComment(String)
This function is called by the parser when it has recognized a comment.
 o handleData(String)
This function is called by the parser when it has recognized character data.
 o handleEndDoc(String)
This function is called by the parser when it has recognized the end of a document or sub-document.
 o handleEndTag(String)
This function is called by the parser when it has recognized an end tag or the end of an empty tag.
 o handlePI(String)
This function is called by the parser when it has recognized a processing instruction.
 o handleStartDoc(String, String)
This function is called by the parser when it has recognized a doctype declaration.
 o handleStartTag(String)
This function is called by the parser when it has recognized a start tag.
 o root()
Return the root of the XML tree

Constructors

 o TreeListener
 public TreeListener()

Methods

 o doComments
 public TreeListener doComments(boolean on)
Set a flag that determines whether comments are stored or ignored. By default, comments are not stored (on = false).

Parameters:
on - if true, store comment nodes
Returns:
this
 o doPIs
 public TreeListener doPIs(boolean on)
Set a flag that determines whether PIs are stored or ignored. By default, PIs are not stored (on = false).

Parameters:
on - if true, store PI nodes
Returns:
this
 o root
 public Root root()
Return the root of the XML tree

 o handleComment
 public void handleComment(String comment)
This function is called by the parser when it has recognized a comment.

Parameters:
comment - the comment string (without <!-- -->)
 o handleStartTag
 public void handleStartTag(String tag)
This function is called by the parser when it has recognized a start tag.

Parameters:
tag - the tag name in lowercase
 o handleAttribute
 public void handleAttribute(String attribute,
                             String value)
This function is called by the parser when it has recognized an attribute name/value pair. The attribute belongs to the tag that was handled by the most recent call to handleStartTag().

Note that there is no indication of whether this attribute was actually on the tag, or whether it is the declared default value for the attribute on this tag (<?XML DEFAULT...?>)

Parameters:
attribute - the name of the attribute in lowercase
value - the value of the attribute (a string)
 o handleEndTag
 public void handleEndTag(String tag)
This function is called by the parser when it has recognized an end tag or the end of an empty tag.

Parameters:
tag - the name of the tag in lowercase
 o handleData
 public void handleData(String data)
This function is called by the parser when it has recognized character data. The function may be called several times without intervening calls to handleStartTag() or handleEndTag(). The content of an element is thus the concatenation of all consecutive calls to handleData().

Parameters:
data - the character data
 o handlePI
 public void handlePI(String pi)
This function is called by the parser when it has recognized a processing instruction.

Parameters:
pi - the processing instruction (without <? ?>)
 o handleStartDoc
 public void handleStartDoc(String name,
                            String doctype)
This function is called by the parser when it has recognized a doctype declaration.

Parameters:
root - the name of the start tag
doctype - the URL defining the document type (may be null)
 o handleEndDoc
 public void handleEndDoc(String root)
This function is called by the parser when it has recognized the end of a document or sub-document.

Parameters:
root - the name of the start tag

All Packages  Class Hierarchy  This Package  Previous  Next  Index