Class ScanHtml

  extended by sunlabs.brazil.sunlabs.ScanHtml (view source)

public class ScanHtml
extends Object

Create a tree representation of an html file whose parts may be referenced as a dictionary. This "parses" only the html tags specified - all other tags are considered plain text.

This allows content to be modified based on specific markup, even if the document is mostly mal-formed. Use the dictionary view to find and refer to the desired node(s), and the tree commands to modify the tree.

Nested Class Summary
static class ScanHtml.DictView
          View the tree as a set of properties
static class ScanHtml.Node
          A node in the tree
static class ScanHtml.Selector
          Select a node to return.
static class ScanHtml.Viewer
          How to view a node.
Field Summary
static Hashtable values
Constructor Summary
ScanHtml(String src, String tags)
Method Summary
 Dictionary dictionary(String name)
 ScanHtml.Node find(String name)
          Return a unique String name for a node
 ScanHtml.Node find(StringTokenizer st)
          Return a unique String name for a node
 ScanHtml.Node getRoot()
 Hashtable getTags()
 boolean insert(ScanHtml other, ScanHtml.Node where, boolean isIn, boolean after)
          Insert another tree at specified node.
 String names(String prefix)
          Return a list of names for this tree
 void reset(String src, String tags)
          Reset the tree
 void setTags(String tagList)
          Set the tags we care about, ignoring the rest.
 String toString()
 String toString(ScanHtml.Node n)
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait

Field Detail


public static Hashtable values
Constructor Detail


public ScanHtml(String src,
                String tags)
Method Detail


public void reset(String src,
                  String tags)
Reset the tree


public void setTags(String tagList)
Set the tags we care about, ignoring the rest. This gets added to any existing tags.


public Hashtable getTags()


public ScanHtml.Node getRoot()


public boolean insert(ScanHtml other,
                      ScanHtml.Node where,
                      boolean isIn,
                      boolean after)
Insert another tree at specified node. Remove the "root" node of the inserted tree. The inserted tree ceases to exists (e.g. it is an empty root);

other - the tree to insert
where - our sibling or parent in the tree
isIn - if true, "where" is our parent, else our sibling
after - if true, insert after "where", else before


public ScanHtml.Node find(String name)
Return a unique String name for a node


public ScanHtml.Node find(StringTokenizer st)
Return a unique String name for a node


public String names(String prefix)
Return a list of names for this tree


public Dictionary dictionary(String name)


public String toString(ScanHtml.Node n)


public String toString()
toString in class Object

Version Kenai-svn-r24, Generated 08/18/09
Copyright (c) 2001-2009, Sun Microsystems.