sunlabs.brazil.sunlabs
Class ScanHtml

java.lang.Object
  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

values

public static Hashtable values
Constructor Detail

ScanHtml

public ScanHtml(String src,
                String tags)
Method Detail

reset

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


setTags

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


getTags

public Hashtable getTags()

getRoot

public ScanHtml.Node getRoot()

insert

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);

Parameters:
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

find

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


find

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


names

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


dictionary

public Dictionary dictionary(String name)

toString

public String toString(ScanHtml.Node n)

toString

public String toString()
Overrides:
toString in class Object

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