htmlparser-cvs Mailing List for HTML Parser (Page 7)
Brought to you by:
derrickoswald
You can subscribe to this list here.
2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(141) |
Jun
(108) |
Jul
(66) |
Aug
(127) |
Sep
(155) |
Oct
(149) |
Nov
(72) |
Dec
(72) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
(100) |
Feb
(36) |
Mar
(21) |
Apr
(3) |
May
(87) |
Jun
(28) |
Jul
(84) |
Aug
(5) |
Sep
(14) |
Oct
|
Nov
|
Dec
|
2005 |
Jan
(1) |
Feb
(39) |
Mar
(26) |
Apr
(38) |
May
(14) |
Jun
(10) |
Jul
|
Aug
|
Sep
(13) |
Oct
(8) |
Nov
(10) |
Dec
|
2006 |
Jan
|
Feb
(1) |
Mar
(17) |
Apr
(20) |
May
(28) |
Jun
(24) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2015 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Derrick O. <der...@us...> - 2005-04-24 17:48:37
|
Update of /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5117/htmlparser/src/org/htmlparser/tests Modified Files: ParserTest.java Log Message: Documentation revamp part three. Reworked some JavaDoc descriptions. Added "HTML Parser for dummies" introductory text. Removed checkstyle.jar and fit.jar (and it's cruft). Index: ParserTest.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tests/ParserTest.java,v retrieving revision 1.64 retrieving revision 1.65 diff -C2 -d -r1.64 -r1.65 *** ParserTest.java 13 Feb 2005 20:36:02 -0000 1.64 --- ParserTest.java 24 Apr 2005 17:48:27 -0000 1.65 *************** *** 439,443 **** try { ! parser = new Parser("http://www.ibm.com/jp/", Parser.noFeedback); assertTrue("Character set should be Shift_JIS", parser.getEncoding ().equalsIgnoreCase ("Shift_JIS")); } --- 439,443 ---- try { ! parser = new Parser("http://www.ibm.com/jp/", Parser.DEVNULL); assertTrue("Character set should be Shift_JIS", parser.getEncoding ().equalsIgnoreCase ("Shift_JIS")); } *************** *** 461,465 **** try { ! parser = new Parser("http://www.sony.co.jp", Parser.noFeedback); assertEquals("Character set by default is ISO-8859-1", "ISO-8859-1", parser.getEncoding ()); enumeration = parser.elements(); --- 461,465 ---- try { ! parser = new Parser("http://www.sony.co.jp", Parser.DEVNULL); assertEquals("Character set by default is ISO-8859-1", "ISO-8859-1", parser.getEncoding ()); enumeration = parser.elements(); *************** *** 574,578 **** try { ! new Parser("http://none.existant.url.org", Parser.noFeedback); assertTrue("Should have thrown an exception!",false); } --- 574,578 ---- try { ! new Parser("http://none.existant.url.org", Parser.DEVNULL); assertTrue("Should have thrown an exception!",false); } |
From: Derrick O. <der...@us...> - 2005-04-24 17:48:36
|
Update of /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tags In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5117/htmlparser/src/org/htmlparser/tags Modified Files: package.html Log Message: Documentation revamp part three. Reworked some JavaDoc descriptions. Added "HTML Parser for dummies" introductory text. Removed checkstyle.jar and fit.jar (and it's cruft). Index: package.html =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tags/package.html,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** package.html 10 Apr 2005 23:20:45 -0000 1.20 --- package.html 24 Apr 2005 17:48:27 -0000 1.21 *************** *** 41,48 **** <p>The classes in this package have been added in an ad-hoc fashion, with the most useful ones having existed a long time, while some obvious ones are rather ! new. Please feel free to add your own, and register them with the {@link org.htmlparser.PrototypicalNodeFactory PrototypicalNodeFactory}, and they will be treated like any other in-built tag. In fact tags do not need to reside in this package.</p> <p>If the tag can contain other nodes, i.e. {@.html <h1>My Heading</h1>}, then it should derive from (i.e. be a subclass of) {@link org.htmlparser.tags.CompositeTag}. --- 41,51 ---- <p>The classes in this package have been added in an ad-hoc fashion, with the most useful ones having existed a long time, while some obvious ones are rather ! new. Please feel free to add your own custom tags, and register them with the {@link org.htmlparser.PrototypicalNodeFactory PrototypicalNodeFactory}, and they will be treated like any other in-built tag. In fact tags do not need to reside in this package.</p> + <br><b>Custom Tags</b> + <p>Creating custom tags is fairly straight forward. Simply copy one of the + simpler tags you find in this package and alter it as follows. <p>If the tag can contain other nodes, i.e. {@.html <h1>My Heading</h1>}, then it should derive from (i.e. be a subclass of) {@link org.htmlparser.tags.CompositeTag}. *************** *** 51,59 **** and nodes between the start and end tag will be gathered into the list of children. Most of the tags in this package derive from CompositeTag, and that ! why the nodes returned from the Parser are nested.</p> <p>If it is a simple tag, i.e. {@.html <br>}, then it should derive from {@link org.htmlparser.nodes.TagNode TagNode}. See for example {@link org.htmlparser.tags.MetaTag} or {@link org.htmlparser.tags.ImageTag}.</p> <!-- Put @see and @since tags down here. --> --- 54,89 ---- and nodes between the start and end tag will be gathered into the list of children. Most of the tags in this package derive from CompositeTag, and that ! is why the nodes returned from the Parser are nested.</p> <p>If it is a simple tag, i.e. {@.html <br>}, then it should derive from {@link org.htmlparser.nodes.TagNode TagNode}. See for example {@link org.htmlparser.tags.MetaTag} or {@link org.htmlparser.tags.ImageTag}.</p> + <p>To be registered with {@link org.htmlparser.PrototypicalNodeFactory#registerTag}, + and especially if it is a composite tag, the tag needs to implement + <code>getIds</code> which returns the UPPERCASE list of names for the tag + (usually only one), for example "HTML". If the tag can be smart enough to know + what other tags can't be contained within it, it should also implement + {@link org.htmlparser.nodes.TagNode#getEnders getEnders()} which returns the + list of other tags that should cause this tag to close itself, and + {@link org.htmlparser.nodes.TagNode#getEndTagEnders getEndTagEnders()} which + returns the list of end tags (i.e. {@.html </xxx>}), other than it's own name, that + should cause this tag to close itself. When these 'ender' lists cause a tag to + end before seeing it's own end tag, a virtual end tag is created and 'inserted' + at the location where the end tag should have been. These end tags can be + distinguished because their {@link org.htmlparser.Node#getStartPosition starting} + and {@link org.htmlparser.Node#getEndPosition ending} locations are the same + (i.e. they take up no character length in the HTML stream). + <p>For example, the {@.html <OPTION>} tag from a form can be prematurely ended by + any of {@.html <INPUT>}, {@.html <TEXTAREA>}, {@.html <SELECT>}, + or another {@.html <OPTION>} tag. These are the tags in the getEnders() list. + It can also be prematurely ended by {@.html </SELECT>}, {@.html </FORM>}, + {@.html </BODY>}, or {@.html </HTML>}. These are the tags in the + getEndTagEnders() list. + <p>Other than that any functionality is up to you. You should note that + {@link org.htmlparser.Node#doSemanticAction doSemanticAction()} is called after + the tag has been completely scanned (it has it's children and end tag), but before + its siblings further downstream have been scanned. If transformation is your purpose, + this is the opportunity to mess around with the content, for example to set the link URL, + or lowercase the tag name, or whatever. <!-- Put @see and @since tags down here. --> |
From: Derrick O. <der...@us...> - 2005-04-24 17:48:35
|
Update of /cvsroot/htmlparser/htmlparser/src/doc-files In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5117/htmlparser/src/doc-files Modified Files: building.html overview.html Added Files: using.html Log Message: Documentation revamp part three. Reworked some JavaDoc descriptions. Added "HTML Parser for dummies" introductory text. Removed checkstyle.jar and fit.jar (and it's cruft). Index: building.html =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/doc-files/building.html,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** building.html 15 Mar 2004 22:50:55 -0000 1.2 --- building.html 24 Apr 2005 17:48:26 -0000 1.3 *************** *** 10,14 **** <H2>JDK</H2> Set up java. I won't include instructions here, just a link to the ! <a href="http://java.sun.com/j2se">Sun j2se site</a>. I use version 1.4.1, and you need a JDK (java development kit), not a JRE (java runtime environment).<p> Test your installation by typing command:<p> --- 10,14 ---- <H2>JDK</H2> Set up java. I won't include instructions here, just a link to the ! <a href="http://java.sun.com/j2se">Sun j2se site</a>. I use version 1.5, and you need a JDK (java development kit), not a JRE (java runtime environment).<p> Test your installation by typing command:<p> *************** *** 21,25 **** HTML Parser uses relies on command tags available in Ant version 1.4.1 or higher. The version currently used on the build machine ! is 1.5.3. The current version of Ant is available <a href="http://archive.apache.org/dist/ant/ant-current-bin.zip">here</a>.<p> Basically you unzip the file into a directory and add an ANT_HOME environment --- 21,25 ---- HTML Parser uses relies on command tags available in Ant version 1.4.1 or higher. The version currently used on the build machine ! is 1.6.2. The current version of Ant is available <a href="http://archive.apache.org/dist/ant/ant-current-bin.zip">here</a>.<p> Basically you unzip the file into a directory and add an ANT_HOME environment Index: overview.html =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/doc-files/overview.html,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** overview.html 18 Jul 2004 21:31:21 -0000 1.4 --- overview.html 24 Apr 2005 17:48:26 -0000 1.5 *************** *** 12,23 **** The HTML Parser distribution is composed of: <ul> ! <li>a low level {@link org.htmlparser.lexer.Lexer lexer} that converts characters into tags</li> ! <li>a high level {@link org.htmlparser.Parser parser} that provides a heirarchical document view</li> ! <li>several example applications</li> </ul> <p> <h2>Building</h2> ! To build the system you'll need to get the sources from the ! <a href="http://sourceforge.net/project/showfiles.php?group_id=24399&release_id=161563">HTML Parser project on Sourceforge</a> if you haven't already, and then follow the <A href="{@docRoot}/doc-files/building.html">build instructions</A>. --- 12,26 ---- The HTML Parser distribution is composed of: <ul> ! <li>a low level {@link org.htmlparser.lexer.Lexer lexer} that converts characters from a HTML page into a linear sequence of nodes</li> ! <li>a high level {@link org.htmlparser.Parser parser} that provides a heirarchical document model of a HTML page</li> ! <li>source code in the src.zip file</li> </ul> <p> + <h2>Getting Started</h2> + For novice users, an introductory guide on how to set up your environment to + use the HTML Parser is provided in <A href="{@docRoot}/doc-files/using.html">HTML Parser for Dummies</A>. <h2>Building</h2> ! To build the HTML Parser you'll need to get the sources from the ! <a href="http://sourceforge.net/project/showfiles.php?group_id=24399" target="_top">HTML Parser project on Sourceforge</a> if you haven't already, and then follow the <A href="{@docRoot}/doc-files/building.html">build instructions</A>. --- NEW FILE: using.html --- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>How to Use the HTML Parser Libraries</title> <link REL ="stylesheet" TYPE="text/css" HREF="../stylesheet.css" TITLE="Style"> </head> <body> <H1>How to Use the HTML Parser libraries</H1> <h3>Step 1: Java</h3> You should make sure that a Java development system (JDK) is installed, not just a Java runtime (JRE). If you are working in an IDE (Integrated Development Environment) this is usually taken care of for you. If you are using just a command line, should see help information when you type: <pre> javac </pre> Java versions greater than 1.2 are supported for the parser, and Java 1.1 for the lexer. You can check your version with the command: <pre> java -version </pre> If you are using Java 5, you may need to specify option "-source 1.3" to avoid some warnings. <h3>Step 2: Setting the CLASSPATH</h3> To use the HTML Parser you will need to add the htmlparser.jar to the classpath. This jar includes all the files in htmllexer.jar, which is the subset of classes used by the lexer. If you are using an IDE, you need to add the htmlparser.jar to the list of jars/libraries used by your project. <h4>NetBeans</h4> <ul> <li>Right click on your project in the Projects Window (Ctrl-1) and choose Properties.</li> <li>In the Project Properties pane choose the Libraries view.</li> <li>Select the Compile tab.</li> <li>Click the Add Jar/Folder button.</li> <li>Browse to <htmlp_dir>/lib (where where <htmlp_dir> is the directory where you unzipped the distribution: xxx/htmlparser1_5), select the htmlparser.jar file and click on OK.</li> </ul> <h4>Eclipse</h4> <ul> <li>Right click on your project in the Package Explorer Window (Shift-Alt-Q + P) and choose Properties.</li> <li>In the Properties pane choose the Java Build Path view.</li> <li>Select the Libraries tab.</li> <li>Click the Add External Jars button.</li> <li>Browse to <htmlp_dir>/lib (where where <htmlp_dir> is the directory where you unzipped the distribution: xxx/htmlparser1_5), select the htmlparser.jar file and click on OK.</li> </ul> <h4>Command Line</h4> You can either add the jar to the CLASSPATH environment variable, or specify it each time on the command line: <h5>Windows</h5> <pre>set CLASSPATH=[htmlp_dir]\lib\htmlparser.jar;%CLASSPATH%</pre> where [htmlp_dir] is the directory where you unzipped the distribution: xxx\htmlparser1_5, or use: <pre>javac -classpath=[htmlp_dir]\lib\htmlparser.jar MyProgram.java</pre> <h5>Linux</h5> <pre>export CLASSPATH=[htmlp_dir]/lib/htmlparser.jar:$CLASSPATH</pre> where [htmlp_dir] is the directory where you unzipped the distribution: xxx/htmlparser1_5, or use <pre>javac -classpath=[htmlp_dir]/lib/htmlparser.jar MyProgram.java</pre> <h3>Step 3: Import Necessary Classes</h3> Whatever classes you use from the HTML Parser libraries will need to be imported by your program. For example, the simplest usage is: <pre> import org.htmlparser.Parser; import org.htmlparser.util.NodeList; import org.htmlparser.util.ParserException; class Test { public static void main (String[] args) { try { Parser parser = new Parser (args[0]); NodeList list = parser.parse (null); System.out.println (list.toHtml ()); } catch (ParserException pe) { pe.printStackTrace (); } } } </pre> Note the import statements may also have been written: <pre> import org.htmlparser.*; import org.htmlparser.util.*; </pre> <h3>Step 4: Compile & Run</h3> Within an IDE the compile and execute steps are usually combined. <h4>NetBeans</h4> <ul> <li>From the Run menu select Run Main Project (F6).</li> </ul> <h4>Eclipse</h4> <ul> <li>From the Run menu select Run... and browse to the Main class and click the Run button.</li> </ul> <h4>Command Line</h4> The above program in a file called Test.java can be compiled and run with the commands: <h5>Windows</h5> <pre> javac -classpath=[htmlp_dir]\lib\htmlparser.jar Test.java java -classpath=.;[htmlp_dir]\lib\htmlparser.jar Test.java </pre> <h5>Linux</h5> <pre> javac -classpath=[htmlp_dir]/lib/htmlparser.jar Test.java java -classpath=.:[htmlp_dir]/lib/htmlparser.jar Test.java </pre> </body> </html> |
From: Derrick O. <der...@us...> - 2005-04-24 17:48:35
|
Update of /cvsroot/htmlparser/htmlparser/src/fit In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5117/htmlparser/src/fit Removed Files: Attributes.java Log Message: Documentation revamp part three. Reworked some JavaDoc descriptions. Added "HTML Parser for dummies" introductory text. Removed checkstyle.jar and fit.jar (and it's cruft). --- Attributes.java DELETED --- |
From: Derrick O. <der...@us...> - 2005-04-24 17:48:34
|
Update of /cvsroot/htmlparser/htmlparser/results In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5117/htmlparser/results Removed Files: AttributeParser.html Log Message: Documentation revamp part three. Reworked some JavaDoc descriptions. Added "HTML Parser for dummies" introductory text. Removed checkstyle.jar and fit.jar (and it's cruft). --- AttributeParser.html DELETED --- |
From: Derrick O. <der...@us...> - 2005-04-24 17:48:34
|
Update of /cvsroot/htmlparser/htmlparser/specs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5117/htmlparser/specs Removed Files: AttributeParser.html Log Message: Documentation revamp part three. Reworked some JavaDoc descriptions. Added "HTML Parser for dummies" introductory text. Removed checkstyle.jar and fit.jar (and it's cruft). --- AttributeParser.html DELETED --- |
From: Derrick O. <der...@us...> - 2005-04-24 17:48:34
|
Update of /cvsroot/htmlparser/htmlparser/resources In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5117/htmlparser/resources Modified Files: htmlparser_checks.xml Log Message: Documentation revamp part three. Reworked some JavaDoc descriptions. Added "HTML Parser for dummies" introductory text. Removed checkstyle.jar and fit.jar (and it's cruft). Index: htmlparser_checks.xml =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/resources/htmlparser_checks.xml,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** htmlparser_checks.xml 23 Sep 2003 03:41:34 -0000 1.1 --- htmlparser_checks.xml 24 Apr 2005 17:48:25 -0000 1.2 *************** *** 102,106 **** <!-- Checks for whitespace --> <!-- See http://checkstyle.sf.net/config_whitespace.html --> - <module name="EmptyForIteratorPad"/> <module name="NoWhitespaceAfter"/> <module name="NoWhitespaceBefore"/> --- 102,105 ---- *************** *** 123,127 **** <!-- See http://checkstyle.sf.net/config_blocks.html --> <module name="AvoidNestedBlocks"/> ! <module name="EmptyBlock"/> <module name="LeftCurly"> <property name="option" value="nl"/> --- 122,128 ---- <!-- See http://checkstyle.sf.net/config_blocks.html --> <module name="AvoidNestedBlocks"/> ! <module name="EmptyBlock"> ! <property name="option" value="text"/> ! </module> <module name="LeftCurly"> <property name="option" value="nl"/> *************** *** 162,166 **** <!-- See http://checkstyle.sf.net/config_misc.html --> <module name="ArrayTypeStyle"/> - <module name="FinalParameters"/> <module name="GenericIllegalRegexp"> <property name="format" value="\s+$"/> --- 163,166 ---- |
From: Derrick O. <der...@us...> - 2005-04-24 17:48:33
|
Update of /cvsroot/htmlparser/htmlparser/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5117/htmlparser/lib Removed Files: checkstyle-all-3.1.jar fit.jar Log Message: Documentation revamp part three. Reworked some JavaDoc descriptions. Added "HTML Parser for dummies" introductory text. Removed checkstyle.jar and fit.jar (and it's cruft). --- fit.jar DELETED --- --- checkstyle-all-3.1.jar DELETED --- |
From: Derrick O. <der...@us...> - 2005-04-12 11:28:36
|
Update of /cvsroot/htmlparser/htmlparser/src/org/htmlparser/beans In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23432/htmlparser/src/org/htmlparser/beans Modified Files: package.html Log Message: Documentation revamp part two. Index: package.html =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/beans/package.html,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** package.html 10 Apr 2005 23:20:42 -0000 1.20 --- package.html 12 Apr 2005 11:27:41 -0000 1.21 *************** *** 40,44 **** <li>{@link org.htmlparser.beans.StringBean} is a bean returning the text of a page.</li> <li>{@link org.htmlparser.beans.HTMLLinkBean} is a GUI bean showing the URLs from a page.</li> ! <li>{@link org.htmlparser.beans.HTMLStringBean} is a GUI bean showing the text of a page.</li> </ul> </p> --- 40,44 ---- <li>{@link org.htmlparser.beans.StringBean} is a bean returning the text of a page.</li> <li>{@link org.htmlparser.beans.HTMLLinkBean} is a GUI bean showing the URLs from a page.</li> ! <li>{@link org.htmlparser.beans.HTMLTextBean} is a GUI bean showing the text of a page.</li> </ul> </p> |
From: Derrick O. <der...@us...> - 2005-04-12 11:28:19
|
Update of /cvsroot/htmlparser/htmlparser/src/org/htmlparser In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23432/htmlparser/src/org/htmlparser Modified Files: Attribute.java Log Message: Documentation revamp part two. Index: Attribute.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/Attribute.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Attribute.java 10 Apr 2005 23:20:42 -0000 1.5 --- Attribute.java 12 Apr 2005 11:27:40 -0000 1.6 *************** *** 268,271 **** --- 268,273 ---- */ public Attribute (String value) + throws + IllegalArgumentException { if (0 != value.trim ().length ()) |
From: Derrick O. <der...@us...> - 2005-04-12 11:28:08
|
Update of /cvsroot/htmlparser/htmlparser/src/org/htmlparser/sax In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23432/htmlparser/src/org/htmlparser/sax Modified Files: Feedback.java XMLReader.java Log Message: Documentation revamp part two. Index: XMLReader.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/sax/XMLReader.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** XMLReader.java 14 Jul 2004 01:58:02 -0000 1.1 --- XMLReader.java 12 Apr 2005 11:27:43 -0000 1.2 *************** *** 582,585 **** --- 582,587 ---- * and {@link #mNameSpacePrefixes}. * @param node The htmlparser node to traverse. + * @exception ParserException If a parse error occurs. + * @exception SAXException If a SAX error occurs. */ protected void doSAX (Node node) Index: Feedback.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/sax/Feedback.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Feedback.java 18 Jul 2004 21:31:22 -0000 1.2 --- Feedback.java 12 Apr 2005 11:27:43 -0000 1.3 *************** *** 95,98 **** --- 95,99 ---- * Calls {@link ErrorHandler#error(SAXParseException) ErrorHandler.error}. * @param message {@inheritDoc} + * @param e {@inheritDoc} */ public void error (String message, ParserException e) |
From: Derrick O. <der...@us...> - 2005-04-12 11:28:08
|
Update of /cvsroot/htmlparser/htmlparser/src/org/htmlparser/lexer In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23432/htmlparser/src/org/htmlparser/lexer Modified Files: Cursor.java InputStreamSource.java Lexer.java Page.java PageAttribute.java Source.java Stream.java StringSource.java package.html Log Message: Documentation revamp part two. Index: package.html =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/lexer/package.html,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** package.html 2 Jan 2004 16:24:53 -0000 1.12 --- package.html 12 Apr 2005 11:27:41 -0000 1.13 *************** *** 84,97 **** <p> The following are some design goals and 'invariants' within the package, if you ! are attempting to understand or modify it. Things that differ substantially from ! previous implementations are highlighted in <B>bold</B>. <DL> <DT>Contiguous Nodes ! <DD><B>Adjacent nodes have no characters between them.</B> The list of nodes forms an uninterrupted chain that, by start and end definitions, completely covers the characters that were read from the HTML source. <DT>Text Fidelity ! <DD>Besides complete coverage, the <B>nodes do not initially contain copies of ! the text</B>, but instead simply contain offsets into a single large buffer that contains the text read from the HTML source. Even within tags, the attributes list can contain whitespace, thus there is no lost whitespace or --- 84,96 ---- <p> The following are some design goals and 'invariants' within the package, if you ! are attempting to understand or modify it. <DL> <DT>Contiguous Nodes ! <DD>Adjacent nodes have no characters between them. The list of nodes forms an uninterrupted chain that, by start and end definitions, completely covers the characters that were read from the HTML source. <DT>Text Fidelity ! <DD>Besides complete coverage, the nodes do not initially contain copies of ! the text, but instead simply contain offsets into a single large buffer that contains the text read from the HTML source. Even within tags, the attributes list can contain whitespace, thus there is no lost whitespace or *************** *** 99,129 **** preserved. <DT>Line Endings ! <DD><B>End of line characters are just whitespace.</B> There is no distinction made between end of line characters (or pairs of characters on Windows) and other whitespace. The text is not read in line by line so nodes (tags) can easily span multiple lines with no special processing. Line endings are not transformed between platforms, i.e. Unix line endings are not converted to Windows line ! endings by this level. Each node will has a starting and ending location, which the page can use to extract the text. To facilitate formatting error and log messages the page can turn these offsets into row and column numbers. In general ignore line breaks in the source if at all possible. ! <DT>One Parser, One Scan ! <DD>The Lexer has the following state machines corresponding ! (roughly) to the <B>four parsers it replaces</B> (StringParser, RemarkNodeParser, ! TagParser & AttributeParser): <LI>in text - parseString()</LI> <LI>in comment - parseRemark()</LI> <LI>in tag - parseTag()</LI> ! By integrating the four state machines into one, a single pass over the text is ! all that's needed for a low level parse of the HTML source. In previous ! implementations, the attributes were parsed on a second scan after the initial ! tag was extracted. (Actually, for error conditions, the lexer can back up a ! node to handle missing end tags etc.). <DT>Two Jars <DD>For elementary operations at the node level, a minimalist jar file containing ! <B>only the lexer and base tag classes</B> is split out from the larger <CODE>htmlparser.jar</CODE>. In this way, simple parsing and output is handled with a jar file that is under 45 kilobytes, but anything beyond peephole manipulation, i.e. closing tag detection ! and other semantic reasoning will need the full set of scanners, nodes and ancillary classes, which now stands at 210 kilobytes. </DL> --- 98,126 ---- preserved. <DT>Line Endings ! <DD>End of line characters are just whitespace. There is no distinction made between end of line characters (or pairs of characters on Windows) and other whitespace. The text is not read in line by line so nodes (tags) can easily span multiple lines with no special processing. Line endings are not transformed between platforms, i.e. Unix line endings are not converted to Windows line ! endings by this level. Each node has a starting and ending location, which the page can use to extract the text. To facilitate formatting error and log messages the page can turn these offsets into row and column numbers. In general ignore line breaks in the source if at all possible. ! <DT>State Machines ! <DD>The Lexer has the following state machines: ! <UL> <LI>in text - parseString()</LI> <LI>in comment - parseRemark()</LI> <LI>in tag - parseTag()</LI> ! <LI>in JSP tag - parseJsp()</LI> ! </UL> ! There is another state machine -- parseCDATA -- used by higher level code ! (script and style scanners), but this isn't actually used by the lexer. <DT>Two Jars <DD>For elementary operations at the node level, a minimalist jar file containing ! only the lexer and base tag classes is split out from the larger <CODE>htmlparser.jar</CODE>. In this way, simple parsing and output is handled with a jar file that is under 45 kilobytes, but anything beyond peephole manipulation, i.e. closing tag detection ! and other semantic reasoning, will need the full set of scanners, nodes and ancillary classes, which now stands at 210 kilobytes. </DL> Index: StringSource.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/lexer/StringSource.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** StringSource.java 13 Feb 2005 22:45:47 -0000 1.2 --- StringSource.java 12 Apr 2005 11:27:41 -0000 1.3 *************** *** 111,114 **** --- 111,115 ---- * Does nothing. * It's supposed to close the source, but use destroy() instead. + * @exception IOException <em>not used</em> * @see #destroy */ *************** *** 206,209 **** --- 207,212 ---- */ public void reset () + throws + IllegalStateException { if (null == mString) *************** *** 248,252 **** * @exception IOException If the source is closed. */ ! public long skip (long n) throws IOException { int length; --- 251,258 ---- * @exception IOException If the source is closed. */ ! public long skip (long n) ! throws ! IOException, ! IllegalArgumentException { int length; *************** *** 255,259 **** if (null == mString) throw new IOException ("source is closed"); ! if (n < 0) throw new IllegalArgumentException ("cannot skip backwards"); else --- 261,265 ---- if (null == mString) throw new IOException ("source is closed"); ! if (0 > n) throw new IllegalArgumentException ("cannot skip backwards"); else Index: Stream.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/lexer/Stream.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** Stream.java 2 Jan 2004 16:24:53 -0000 1.12 --- Stream.java 12 Apr 2005 11:27:41 -0000 1.13 *************** *** 37,42 **** --- 37,56 ---- public class Stream extends InputStream implements Runnable { + /** + * The number of calls to fill. + * Note: to be removed. + */ public int fills = 0; + + /** + * The number of reallocations. + * Note: to be removed. + */ public int reallocations = 0; + + /** + * The number of synchronous (blocking) fills. + * Note: to be removed. + */ public int synchronous = 0; Index: Lexer.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/lexer/Lexer.java,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** Lexer.java 13 Mar 2005 14:51:43 -0000 1.37 --- Lexer.java 12 Apr 2005 11:27:41 -0000 1.38 *************** *** 47,53 **** --- 47,55 ---- * This class parses the HTML stream into nodes. * There are three major types of nodes (lexemes): + * <ul> * <li>Remark</li> * <li>Text</li> * <li>Tag</li> + * </ul> * Each time <code>nextNode()</code> is called, another node is returned until * the stream is exhausted, and <code>null</code> is returned. *************** *** 113,118 **** * Creates a new instance of a Lexer. * @param connection The url to parse. */ ! public Lexer (URLConnection connection) throws ParserException { this (new Page (connection)); --- 115,123 ---- * Creates a new instance of a Lexer. * @param connection The url to parse. + * @exception ParserException If an error occurs opening the connection. */ ! public Lexer (URLConnection connection) ! throws ! ParserException { this (new Page (connection)); *************** *** 192,195 **** --- 197,204 ---- } + /** + * Get the current cursor position. + * @return The current character offset into the source. + */ public int getPosition () { *************** *** 197,200 **** --- 206,213 ---- } + /** + * Set the current cursor position. + * @param position The new character offset into the source. + */ public void setPosition (int position) { *************** *** 315,318 **** --- 328,332 ---- * Advance the cursor through a JIS escape sequence. * @param cursor A cursor positioned within the escape sequence. + * @exception ParserException If a problem occurs reading from the source. */ protected void scanJIS (Cursor cursor) *************** *** 363,366 **** --- 377,382 ---- * @param start The position at which to start scanning. * @param quotesmart If <code>true</code>, strings ignore quoted contents. + * @return The parsed node. + * @exception ParserException If a problem occurs reading from the source. */ protected Node parseString (int start, boolean quotesmart) *************** *** 468,471 **** --- 484,491 ---- /** * Create a string node based on the current cursor and the one provided. + * @param start The starting point of the node. + * @param end The ending point of the node. + * @exception ParserException If the nodefactory creation of the string node fails. + * @return The new Text node. */ protected Node makeString (int start, int end) *************** *** 578,581 **** --- 598,602 ---- * @param start The position at which to start scanning. * @return The parsed tag. + * @exception ParserException If a problem occurs reading from the source. */ protected Node parseTag (int start) *************** *** 750,753 **** --- 771,779 ---- /** * Create a tag node based on the current cursor and the one provided. + * @param start The starting point of the node. + * @param end The ending point of the node. + * @param attributes The attributes parsed from the tag. + * @exception ParserException If the nodefactory creation of the tag node fails. + * @return The new Tag node. */ protected Node makeTag (int start, int end, Vector attributes) *************** *** 811,814 **** --- 837,842 ---- * @param start The position at which to start scanning. * @param quotesmart If <code>true</code>, strings ignore quoted contents. + * @return The parsed node. + * @exception ParserException If a problem occurs reading from the source. */ protected Node parseRemark (int start, boolean quotesmart) *************** *** 888,891 **** --- 916,923 ---- /** * Create a remark node based on the current cursor and the one provided. + * @param start The starting point of the node. + * @param end The ending point of the node. + * @exception ParserException If the nodefactory creation of the remark node fails. + * @return The new Remark node. */ protected Node makeRemark (int start, int end) *************** *** 915,918 **** --- 947,952 ---- * exhausted, in which case <code>null</code> is returned. * @param start The position at which to start scanning. + * @return The parsed node. + * @exception ParserException If a problem occurs reading from the source. */ protected Node parseJsp (int start) *************** *** 1070,1073 **** --- 1104,1108 ---- * </quote> * @return The <code>TextNode</code> of the CDATA or <code>null</code> if none. + * @exception ParserException If a problem occurs reading from the source. */ public Node parseCDATA () *************** *** 1087,1090 **** --- 1122,1126 ---- * @return The <code>TextNode</code> of the CDATA or <code>null</code> if none. * @see #parseCDATA() + * @exception ParserException If a problem occurs reading from the source. */ public Node parseCDATA (boolean quotesmart) *************** *** 1229,1232 **** --- 1265,1269 ---- * @param start The beginning position of the string. * @param end The ending positiong of the string. + * @return The created Text node. */ public Text createStringNode (Page page, int start, int end) *************** *** 1240,1243 **** --- 1277,1281 ---- * @param start The beginning position of the remark. * @param end The ending positiong of the remark. + * @return The created Remark node. */ public Remark createRemarkNode (Page page, int start, int end) *************** *** 1256,1259 **** --- 1294,1298 ---- * @param end The ending positiong of the tag. * @param attributes The attributes contained in this tag. + * @return The created Tag node. */ public Tag createTagNode (Page page, int start, int end, Vector attributes) *************** *** 1264,1272 **** /** * Mainline for command line operation */ public static void main (String[] args) throws MalformedURLException, - IOException, ParserException { --- 1303,1313 ---- /** * Mainline for command line operation + * @param args [0] The URL to parse. + * @exception MalformedURLException If the provided URL cannot be resolved. + * @exception ParserException If the parse fails. */ public static void main (String[] args) throws MalformedURLException, ParserException { Index: InputStreamSource.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/lexer/InputStreamSource.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** InputStreamSource.java 6 Mar 2005 21:46:31 -0000 1.5 --- InputStreamSource.java 12 Apr 2005 11:27:41 -0000 1.6 *************** *** 357,360 **** --- 357,361 ---- * Does nothing. * It's supposed to close the source, but use destroy() instead. + * @exception IOException <em>not used</em> * @see #destroy */ *************** *** 447,450 **** --- 448,453 ---- */ public void reset () + throws + IllegalStateException { if (null == mStream) *************** *** 504,508 **** * @exception IOException If an I/O error occurs. */ ! public long skip (long n) throws IOException { long ret; --- 507,514 ---- * @exception IOException If an I/O error occurs. */ ! public long skip (long n) ! throws ! IOException, ! IllegalArgumentException { long ret; *************** *** 510,521 **** if (null == mStream) throw new IOException ("source is closed"); ! if (mLevel - mOffset < n) ! fill ((int)(n - (mLevel - mOffset))); // minimum to satisfy this request ! if (mOffset >= mLevel) ! ret = EOF; else { ! ret = Math.min (mLevel - mOffset, n); ! mOffset += ret; } --- 516,532 ---- if (null == mStream) throw new IOException ("source is closed"); ! if (0 > n) ! throw new IllegalArgumentException ("cannot skip backwards"); else { ! if (mLevel - mOffset < n) ! fill ((int)(n - (mLevel - mOffset))); // minimum to satisfy this request ! if (mOffset >= mLevel) ! ret = EOF; ! else ! { ! ret = Math.min (mLevel - mOffset, n); ! mOffset += ret; ! } } Index: Source.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/lexer/Source.java,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** Source.java 13 Mar 2005 14:51:44 -0000 1.18 --- Source.java 12 Apr 2005 11:27:41 -0000 1.19 *************** *** 89,92 **** --- 89,93 ---- * Does nothing. * It's supposed to close the source, but use {@link #destroy} instead. + * @exception IOException <em>not used</em> * @see #destroy */ *************** *** 139,143 **** * Reset the source. * Repositions the read point to begin at zero. - * @exception IllegalStateException If the source has been closed. */ public abstract void reset (); --- 140,143 ---- *************** *** 168,172 **** * @param n The number of characters to skip. * @return The number of characters actually skipped - * @exception IllegalArgumentException If <code>n</code> is negative. * @exception IOException If an I/O error occurs. */ --- 168,171 ---- Index: Page.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/lexer/Page.java,v retrieving revision 1.48 retrieving revision 1.49 diff -C2 -d -r1.48 -r1.49 *** Page.java 13 Mar 2005 14:51:43 -0000 1.48 --- Page.java 12 Apr 2005 11:27:41 -0000 1.49 *************** *** 288,291 **** --- 288,292 ---- * @param name The name to look up. One of the aliases for a character set. * @param _default The name to return if the lookup fails. + * @return The character set name. */ public static String findCharset (String name, String _default) *************** *** 449,452 **** --- 450,454 ---- /** * Close the page by destroying the source of characters. + * @exception IOException If destroying the source encounters an error. */ public void close () throws IOException *************** *** 597,600 **** --- 599,603 ---- /** * Get the source this page is reading from. + * @return The current source. */ public Source getSource () *************** *** 776,783 **** /** * Build a URL from the link and base provided. * @param link The (relative) URI. * @param base The base URL of the page, either from the <BASE> tag * or, if none, the URL the page is being fetched from. ! * @return An absolute URL. */ public URL constructUrl (String link, String base) --- 779,787 ---- /** * Build a URL from the link and base provided. + * @return An absolute URL. * @param link The (relative) URI. * @param base The base URL of the page, either from the <BASE> tag * or, if none, the URL the page is being fetched from. ! * @exception MalformedURLException If creating the URL fails. */ public URL constructUrl (String link, String base) *************** *** 913,916 **** --- 917,922 ---- */ public String getText (int start, int end) + throws + IllegalArgumentException { String ret; *************** *** 945,948 **** --- 951,956 ---- */ public void getText (StringBuffer buffer, int start, int end) + throws + IllegalArgumentException { int length; *************** *** 1005,1008 **** --- 1013,1018 ---- */ public void getText (char[] array, int offset, int start, int end) + throws + IllegalArgumentException { int length; Index: PageAttribute.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/lexer/PageAttribute.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** PageAttribute.java 13 Feb 2005 22:45:47 -0000 1.2 --- PageAttribute.java 12 Apr 2005 11:27:41 -0000 1.3 *************** *** 146,152 **** * @param value The value of this attribute. * @exception IllegalArgumentException if the value contains other than ! * whitespace. To set a real value use {@link Attribute#Attribute(String)}. */ public PageAttribute (String value) { super (value); --- 146,154 ---- * @param value The value of this attribute. * @exception IllegalArgumentException if the value contains other than ! * whitespace. To set a real value use {@link #PageAttribute(String,String)}. */ public PageAttribute (String value) + throws + IllegalArgumentException { super (value); Index: Cursor.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/lexer/Cursor.java,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** Cursor.java 31 Jul 2004 16:42:31 -0000 1.18 --- Cursor.java 12 Apr 2005 11:27:41 -0000 1.19 *************** *** 123,126 **** --- 123,131 ---- } + /** + * Return a string representation of this cursor + * @return A string of the form "n[r,c]", where n is the character position, + * r is the row (zero based) and c is the column (zero based) on the page. + */ public String toString () { *************** *** 150,153 **** --- 155,162 ---- /** * Compare one reference to another. + * @param that The object to compare this to. + * @return A negative integer, zero, or a positive + * integer as this object is less than, equal to, + * or greater than that object. * @see org.htmlparser.util.sort.Ordered */ |
From: Derrick O. <der...@us...> - 2005-04-12 11:28:07
|
Update of /cvsroot/htmlparser/htmlparser/src/org/htmlparser/lexerapplications/thumbelina In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23432/htmlparser/src/org/htmlparser/lexerapplications/thumbelina Modified Files: PicturePanel.java Log Message: Documentation revamp part two. Index: PicturePanel.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/lexerapplications/thumbelina/PicturePanel.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** PicturePanel.java 21 Sep 2003 18:20:56 -0000 1.1 --- PicturePanel.java 12 Apr 2005 11:27:41 -0000 1.2 *************** *** 233,236 **** --- 233,237 ---- * Runs through the list of tiles and for every one that intersects * the clip region performs a <code>drawImage()</code>. + * @param graphics The graphics context used to paint with. */ public void paint (final Graphics graphics) *************** *** 598,601 **** --- 599,605 ---- * * $Log$ + * Revision 1.2 2005/04/12 11:27:41 derrickoswald + * Documentation revamp part two. + * * Revision 1.1 2003/09/21 18:20:56 derrickoswald * Thumbelina |
From: Derrick O. <der...@us...> - 2005-04-12 11:27:53
|
Update of /cvsroot/htmlparser/htmlparser/src/org/htmlparser/parserapplications/filterbuilder In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23432/htmlparser/src/org/htmlparser/parserapplications/filterbuilder Modified Files: Filter.java FilterBuilder.java HtmlTreeCellRenderer.java HtmlTreeModel.java SubFilterList.java Log Message: Documentation revamp part two. Index: SubFilterList.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/parserapplications/filterbuilder/SubFilterList.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** SubFilterList.java 13 Feb 2005 22:45:48 -0000 1.2 --- SubFilterList.java 12 Apr 2005 11:27:42 -0000 1.3 *************** *** 35,50 **** import org.htmlparser.parserapplications.filterbuilder.layouts.VerticalLayoutManager; public class SubFilterList extends JPanel { protected int mExtra = 25; // for now ! protected Component mSpacer; ! protected Filter mHome; protected String mTitle; protected int mMax; --- 35,68 ---- import org.htmlparser.parserapplications.filterbuilder.layouts.VerticalLayoutManager; + /** + * A helper class for lists of filters within filters. + */ public class SubFilterList extends JPanel { + /** + * Padding for the drop target. + */ protected int mExtra = 25; // for now ! ! /** ! * The drop target spacer at the bottom of the list. ! */ protected Component mSpacer; ! ! /** ! * The parent filter wrapper. ! */ protected Filter mHome; + /** + * The textual title for the list. + */ protected String mTitle; + /** + * The number of filters limit. + */ protected int mMax; *************** *** 98,102 **** new EmptyBorder (3,3,3,3))); } ! protected void addSpacer () { --- 116,123 ---- new EmptyBorder (3,3,3,3))); } ! ! /** ! * Stuff a spacer component at the end of the list. ! */ protected void addSpacer () { *************** *** 113,116 **** --- 134,140 ---- } + /** + * Remove the spacer component at the end of the list. + */ protected void removeSpacer () { *************** *** 118,121 **** --- 142,146 ---- mSpacer = null; } + /** * Get the components in which to drop commands. *************** *** 222,225 **** --- 247,255 ---- } + /** + * Check if our maximum number of filters limit has been reached. + * @return <code>true</code> if the sublist can accept one more filter, + * <code>false</code> otherwise. + */ public boolean canAccept () { Index: HtmlTreeCellRenderer.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/parserapplications/filterbuilder/HtmlTreeCellRenderer.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** HtmlTreeCellRenderer.java 13 Feb 2005 20:43:06 -0000 1.1 --- HtmlTreeCellRenderer.java 12 Apr 2005 11:27:42 -0000 1.2 *************** *** 43,57 **** /** ! * @author derrick ! * ! * TODO To change the template for this generated type comment go to ! * Window - Preferences - Java - Code Style - Code Templates */ public class HtmlTreeCellRenderer ! extends ! DefaultTreeCellRenderer ! implements ! TreeCellRenderer { public HtmlTreeCellRenderer () { --- 43,57 ---- /** ! * Renderer for tree view of a NodeList. */ public class HtmlTreeCellRenderer ! extends ! DefaultTreeCellRenderer ! implements ! TreeCellRenderer { + /** + * Create a new tree cell renderer for Nodes. + */ public HtmlTreeCellRenderer () { *************** *** 65,70 **** * This is different from the tag's normal toHtml() method in that it * doesn't process children or end tags, just the initial tag, and ! * it also wraps the tag in something a label would expect. * @see org.htmlparser.Node#toHtml() */ public String toHtml (TagNode tag) --- 65,72 ---- * This is different from the tag's normal toHtml() method in that it * doesn't process children or end tags, just the initial tag, and ! * it also wraps the tag in html a label would expect. * @see org.htmlparser.Node#toHtml() + * @param tag The tag to convert to HTML. + * @return A string suitable for rendering the tag. */ public String toHtml (TagNode tag) *************** *** 113,116 **** --- 115,119 ---- * Control characters are replaced by their equivalent escape * sequence and contents is truncated to 80 characters. + * @param node The node to render. * @return A string representation of the string node. */ *************** *** 155,159 **** /** ! * @see javax.swing.tree.TreeCellRenderer#getTreeCellRendererComponent(javax.swing.JTree, java.lang.Object, boolean, boolean, boolean, int, boolean) */ public Component getTreeCellRendererComponent (JTree tree, Object value, --- 158,171 ---- /** ! * Render the node for the tree cell. ! * @see TreeCellRenderer#getTreeCellRendererComponent(JTree, Object, boolean, boolean, boolean, int, boolean) ! * @param tree {@inheritDoc} ! * @param value {@inheritDoc} ! * @param selected {@inheritDoc} ! * @param expanded {@inheritDoc} ! * @param leaf {@inheritDoc} ! * @param row {@inheritDoc} ! * @param hasFocus {@inheritDoc} ! * @return {@inheritDoc} */ public Component getTreeCellRendererComponent (JTree tree, Object value, Index: Filter.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/parserapplications/filterbuilder/Filter.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Filter.java 13 Feb 2005 20:43:06 -0000 1.1 --- Filter.java 12 Apr 2005 11:27:42 -0000 1.2 *************** *** 217,223 **** // public static byte[] pickle (Object object) ! throws ! IOException { ByteArrayOutputStream bos; --- 217,229 ---- // + /** + * Serialize an object to a byte array. + * @param object The object to be pickled. + * @return The serialized object. + * @exception IOException If the output stream complains (unlikely). + */ public static byte[] pickle (Object object) ! throws ! IOException { ByteArrayOutputStream bos; *************** *** 234,240 **** } public static Object unpickle (byte[] data) ! throws ! IOException, ClassNotFoundException { --- 240,254 ---- } + /** + * Reconstitute a serialized object. + * @param data The pickled object. + * @return The reconstituted object. + * @exception IOException If the input stream complains. + * @exception ClassNotFoundException If the serialized object class cannot + * be located. + */ public static Object unpickle (byte[] data) ! throws ! IOException, ClassNotFoundException { *************** *** 251,254 **** --- 265,275 ---- } + /** + * Serialize a byte array to a String. + * Convert each byte from the serialized object into a couple of hexadecimal + * characters. + * @param data The serialized object as a byte array. + * @return The string representing the serialized object. + */ public static String serialize (byte[] data) { *************** *** 269,272 **** --- 290,298 ---- } + /** + * Convert a sequence of hexadecimal characters back into a byte array. + * @param string The string to convert (must be correct hex characters). + * @return The bytes as an array. + */ public static byte[] deserialize (String string) { *************** *** 283,287 **** --- 309,315 ---- /** * Returns a string serialization of the filters. + * @param filters The list of filters to serialize. * @return A string representation of the filters. + * @exception IOException If serialization fails. */ public static String deconstitute (Filter[] filters) throws IOException *************** *** 303,307 **** --- 331,338 ---- * Returns the filters represented by the string. * @param string The string with serialized node filters. + * @param context The context from which to extract meaningful values + * for GUI choices (which aren't serialized). * @return The filters gleaned from the string. + * @see #wrap */ public static Filter[] reconstitute (String string, Parser context) *************** *** 317,340 **** try { ! while (string.startsWith ("[")) ! { ! index = string.indexOf (']'); ! if (-1 != index) ! { ! code = string.substring (1, index); ! string = string.substring (index + 1); ! object = unpickle (deserialize (code)); ! if (object instanceof NodeFilter) ! { ! filter = wrap ((NodeFilter)object, context); ! if (null != filter) ! vector.addElement (filter); ! } ! else ! break; ! } ! else ! break; ! } } catch (Exception e) --- 348,371 ---- try { ! while (string.startsWith ("[")) ! { ! index = string.indexOf (']'); ! if (-1 != index) ! { ! code = string.substring (1, index); ! string = string.substring (index + 1); ! object = unpickle (deserialize (code)); ! if (object instanceof NodeFilter) ! { ! filter = wrap ((NodeFilter)object, context); ! if (null != filter) ! vector.addElement (filter); ! } ! else ! break; ! } ! else ! break; ! } } catch (Exception e) *************** *** 361,368 **** if (component instanceof Container) { ! list = ((Container)component).getComponents (); ! for (int i = 0; i < list.length; i++) ! if (list[i] instanceof SubFilterList) ! return ((SubFilterList)list[i]); } --- 392,399 ---- if (component instanceof Container) { ! list = ((Container)component).getComponents (); ! for (int i = 0; i < list.length; i++) ! if (list[i] instanceof SubFilterList) ! return ((SubFilterList)list[i]); } *************** *** 393,411 **** { ret = Filter.instantiate (class_name); ! ret.setNodeFilter (filter, context); ! // recurse into subfilters ! filters = ret.getSubNodeFilters (); ! if (0 != filters.length) ! { ! list = getEnclosed (ret); ! if (null != list) ! { ! ret.setSubNodeFilters (new NodeFilter[0]); // clean out the unwrapped filters ! for (int i = 0; i < filters.length; i++) ! list.addFilter (wrap (filters[i], context)); ! } ! else ! throw new IllegalStateException ("filter can't have subnodes without a SubFilterList on the wrapper"); ! } } catch (Exception e) --- 424,442 ---- { ret = Filter.instantiate (class_name); ! ret.setNodeFilter (filter, context); ! // recurse into subfilters ! filters = ret.getSubNodeFilters (); ! if (0 != filters.length) ! { ! list = getEnclosed (ret); ! if (null != list) ! { ! ret.setSubNodeFilters (new NodeFilter[0]); // clean out the unwrapped filters ! for (int i = 0; i < filters.length; i++) ! list.addFilter (wrap (filters[i], context)); ! } ! else ! throw new IllegalStateException ("filter can't have subnodes without a SubFilterList on the wrapper"); ! } } catch (Exception e) *************** *** 429,441 **** if (selected) setBorder ( ! new CompoundBorder ( ! new EtchedBorder (), ! new CompoundBorder ( new LineBorder(Color.blue, 2), new EmptyBorder (1, 1, 1, 1)))); else setBorder ( ! new CompoundBorder ( ! new EtchedBorder (), new EmptyBorder (3,3,3,3))); } --- 460,472 ---- if (selected) setBorder ( ! new CompoundBorder ( ! new EtchedBorder (), ! new CompoundBorder ( new LineBorder(Color.blue, 2), new EmptyBorder (1, 1, 1, 1)))); else setBorder ( ! new CompoundBorder ( ! new EtchedBorder (), new EmptyBorder (3,3,3,3))); } *************** *** 458,461 **** --- 489,497 ---- } + /** + * Append count spaces to the buffer. + * @param out The buffer to append to. + * @param count The number of spaces to append. + */ public static void spaces (StringBuffer out, int count) { *************** *** 464,468 **** } ! public static void newline (StringBuffer out) { out.append ('\n'); --- 500,508 ---- } ! /** ! * Append a newline to the buffer. ! * @param out The buffer to append to. ! */ ! public static void newline (StringBuffer out) { out.append ('\n'); Index: HtmlTreeModel.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/parserapplications/filterbuilder/HtmlTreeModel.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** HtmlTreeModel.java 13 Feb 2005 20:43:06 -0000 1.1 --- HtmlTreeModel.java 12 Apr 2005 11:27:42 -0000 1.2 *************** *** 37,47 **** /** ! * Each leaf is a TreeItem or something that does toString(). */ public class HtmlTreeModel implements TreeModel { protected Vector mTreeListeners; protected Node mRoot; public HtmlTreeModel (NodeList root) { --- 37,62 ---- /** ! * Quick and dirty tree model for HTML nodes. */ public class HtmlTreeModel implements TreeModel { + /** + * The list of tree listeners. + */ protected Vector mTreeListeners; + + /** + * The root {@link Node}. + */ protected Node mRoot; + /** + * Create an HTML tree view. + * @param root The nodes at the root of the tree + * (the nodes are wrapped in an Html node that is never seen + * because it's the root, but this makes all downstream processing + * super-simple because every tree node is then a {@link Node}, + * not sometimes a {@link NodeList} at the root). + */ public HtmlTreeModel (NodeList root) { *************** *** 56,60 **** // ! // Adds a listener for the TreeModelEvent posted after the tree changes. public void addTreeModelListener (TreeModelListener l) { --- 71,78 ---- // ! /** ! * Adds a listener for the TreeModelEvent posted after the tree changes. ! * @param l {@inheritDoc} ! */ public void addTreeModelListener (TreeModelListener l) { *************** *** 66,70 **** } ! // Removes a listener previously added with addTreeModelListener(). public void removeTreeModelListener(TreeModelListener l) { --- 84,91 ---- } ! /** ! * Removes a listener previously added with addTreeModelListener(). ! * @param l {@inheritDoc} ! */ public void removeTreeModelListener(TreeModelListener l) { *************** *** 75,79 **** } ! // Returns the child of parent at index index in the parent's child array. public Object getChild (Object parent, int index) { --- 96,105 ---- } ! /** ! * Returns the child of parent at index index in the parent's child array. ! * @param parent {@inheritDoc} ! * @param index {@inheritDoc} ! * @return {@inheritDoc} ! */ public Object getChild (Object parent, int index) { *************** *** 92,96 **** } ! // Returns the number of children of parent. public int getChildCount (Object parent) { --- 118,126 ---- } ! /** ! * Returns the number of children of parent. ! * @param parent {@inheritDoc} ! * @return {@inheritDoc} ! */ public int getChildCount (Object parent) { *************** *** 110,114 **** ! // Returns the index of child in parent. public int getIndexOfChild (Object parent, Object child) { --- 140,149 ---- ! /** ! * Returns the index of child in parent. ! * @param parent {@inheritDoc} ! * @param child {@inheritDoc} ! * @return {@inheritDoc} ! */ public int getIndexOfChild (Object parent, Object child) { *************** *** 141,145 **** } ! // Returns the root of the tree. public Object getRoot () { --- 176,183 ---- } ! /** ! * Returns the root of the tree. ! * @return {@inheritDoc} ! */ public Object getRoot () { *************** *** 147,151 **** } ! // Returns true if node is a leaf. public boolean isLeaf (Object node) { --- 185,193 ---- } ! /** ! * Returns true if node is a leaf. ! * @param node {@inheritDoc} ! * @return {@inheritDoc} ! */ public boolean isLeaf (Object node) { *************** *** 162,166 **** } ! // Messaged when the user has altered the value for the item identified by path to newValue. public void valueForPathChanged (TreePath path, Object newValue) { --- 204,212 ---- } ! /** ! * Messaged when the user has altered the value for the item identified by path to newValue. ! * @param path {@inheritDoc} ! * @param newValue {@inheritDoc} ! */ public void valueForPathChanged (TreePath path, Object newValue) { Index: FilterBuilder.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/parserapplications/filterbuilder/FilterBuilder.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** FilterBuilder.java 10 Apr 2005 23:20:44 -0000 1.4 --- FilterBuilder.java 12 Apr 2005 11:27:42 -0000 1.5 *************** *** 221,227 **** --- 221,242 ---- protected Component mCurrentComponent; + /** + * The main panel GUI component. + */ protected JPanel mMainPanel; + + /** + * The main panel scrolling GUI component. + */ protected JScrollPane mMainScroller; + + /** + * The URL input GUI component. + */ protected JTextField mURLField; + + /** + * The output panel GUI component. + */ protected JDesktopPane mOutput; *************** *** 491,494 **** --- 506,512 ---- * Get a url for the given resource specification. * @param spec The name of the resource. + * @return The fully formed URL. + * @exception MalformedURLException In the case that the document base + * or name of the resource cannot be turned into a URL. */ protected URL getURL (String spec) *************** *** 536,539 **** --- 554,566 ---- } + /** + * Add a filter to the GUI. + * Adds the filter specified by class_name to the menu, toolbar and + * starts listening for actions. + * @param menu The menu to add the filter to. + * @param toolbar The toolbar to add the filter to. + * @param class_name The class name for the filter wrapper. + * From the wrapper, the NodeFilter, description and icon can be obtained. + */ public void addFilter (JMenu menu, JToolBar toolbar, String class_name) { *************** *** 569,572 **** --- 596,608 ---- } + /** + * Adds a set of filters to the main panel or a sublist. + * Sets up the GUI components as drop targets and mouse listeners, + * and performs a relayout to display them. + * @param filters The filter wrappers to add. + * @param point The point at which to start adding (list == null). + * @param list The list to add to (point not used), or <code>null</code> + * for the main panel. + */ protected void insertFilters (Filter[] filters, Point point, SubFilterList list) { *************** *** 649,687 **** } ! /* makes a program like: ! // Generated by FilterBuilder. http://htmlparser.org ! // [aced0005737200206f72672e68746d6c7061727365722e66696c746572732e416e6446696c74657224c30516b2b7b2120200015b000b6d5072656469636174657374001c5b4c6f72672f68746d6c7061727365722f4e6f646546696c7465723b78707572001c5b4c6f72672e68746d6c7061727365722e4e6f646546696c7465723b8f17479b1d5f7992020000787000000002737200246f72672e68746d6c7061727365722e66696c746572732e5461674e616d6546696c746572b28b2601a614890f0200014c00056d4e616d657400124c6a6176612f6c616e672f537472696e673b78707400044d455441737200296f72672e68746d6c7061727365722e66696c746572732e48617341747472696275746546696c74657296abdfb3b0714cda0200024c000a6d41747472696275746571007e00064c00066d56616c756571007e000678707400046e616d6570] ! ! import org.htmlparser.*; ! import org.htmlparser.filters.*; ! import org.htmlparser.beans.*; ! import org.htmlparser.util.*; ! ! public class Test ! { ! public static void main (String args[]) ! { ! TagNameFilter filter0 = new TagNameFilter (); ! filter0.setName ("META"); ! HasAttributeFilter filter1 = new HasAttributeFilter (); ! filter1.setAttributeName ("name"); ! NodeFilter[] array0 = new NodeFilter[2]; ! array0[0] = filter0; ! array0[1] = filter1; ! AndFilter filter2 = new AndFilter (); ! filter2.setPredicates (array0); ! NodeFilter[] array1 = new NodeFilter[1]; ! array1[0] = filter2; ! FilterBean bean = new FilterBean (); ! bean.setFilters (array1); ! if (0 != args.length) ! { ! bean.setURL (args[0]); ! System.out.println (bean.getNodes ().toHtml ()); ! } ! else ! System.out.println ("Usage: java -classpath .:htmlparser.jar Test <url>"); ! } ! } */ protected void makeProgram (String name, StringBuffer out, FilterBean bean) --- 685,730 ---- } ! ! /** ! * Makes a program like: ! * <pre> ! * // Generated by FilterBuilder. http://htmlparser.org ! * // [aced0005737200206f72672e68746d6c7061727365722e66696c746572732e416e6446696c74657224c30516b2b7b2120200015b000b6d5072656469636174657374001c5b4c6f72672f68746d6c7061727365722f4e6f646546696c7465723b78707572001c5b4c6f72672e68746d6c7061727365722e4e6f646546696c7465723b8f17479b1d5f7992020000787000000002737200246f72672e68746d6c7061727365722e66696c746572732e5461674e616d6546696c746572b28b2601a614890f0200014c00056d4e616d657400124c6a6176612f6c616e672f537472696e673b78707400044d455441737200296f72672e68746d6c7061727365722e66696c746572732e48617341747472696275746546696c74657296abdfb3b0714cda0200024c000a6d41747472696275746571007e00064c00066d56616c756571007e000678707400046e616d6570] ! * ! * import org.htmlparser.*; ! * import org.htmlparser.filters.*; ! * import org.htmlparser.beans.*; ! * import org.htmlparser.util.*; ! * ! * public class Test ! * { ! * public static void main (String args[]) ! * { ! * TagNameFilter filter0 = new TagNameFilter (); ! * filter0.setName ("META"); ! * HasAttributeFilter filter1 = new HasAttributeFilter (); ! * filter1.setAttributeName ("name"); ! * NodeFilter[] array0 = new NodeFilter[2]; ! * array0[0] = filter0; ! * array0[1] = filter1; ! * AndFilter filter2 = new AndFilter (); ! * filter2.setPredicates (array0); ! * NodeFilter[] array1 = new NodeFilter[1]; ! * array1[0] = filter2; ! * FilterBean bean = new FilterBean (); ! * bean.setFilters (array1); ! * if (0 != args.length) ! * { ! * bean.setURL (args[0]); ! * System.out.println (bean.getNodes ().toHtml ()); ! * } ! * else ! * System.out.println ("Usage: java -classpath .:htmlparser.jar Test <url>"); ! * } ! * } ! * </pre> ! * @param name The name of the class. ! * @param out The buffer to append to. ! * @param bean The bean to extract the filters from to make the program. */ protected void makeProgram (String name, StringBuffer out, FilterBean bean) *************** *** 1678,1681 **** --- 1721,1728 ---- // + /** + * Add a filter to the current selection set. + * @param filter The filter to add. + */ protected void addSelection (Filter filter) { *************** *** 1686,1689 **** --- 1733,1740 ---- } + /** + * Remove a filter from the current selection set. + * @param filter The filter to remove. + */ protected void removeSelection (Filter filter) { *************** *** 1692,1695 **** --- 1743,1751 ---- } + /** + * Select(highlight)/deselect the current selection set. + * @param select If <code>true</code> turn on highlighting, + * turn it off otherwise. + */ protected void selectSelection (boolean select) { *************** *** 1705,1708 **** --- 1761,1767 ---- } + /** + * Clear (empty) the current selection set. + */ protected void clearSelection () { *************** *** 1711,1714 **** --- 1770,1777 ---- } + /** + * Move the current selection set as a group. + * @param translation The displacement to move them all by. + */ protected void moveSelection (Point translation) { *************** *** 1731,1734 **** --- 1794,1803 ---- } + /** + * Check if the current selection set contains the given filter. + * @param filter The filter to check. + * @return <code>true</code> if the filter is a member, + * <code>false</code> otherwise. + */ protected boolean selectionContains (Filter filter) { *************** *** 1736,1739 **** --- 1805,1813 ---- } + /** + * Return the last filter added to the selection set. + * @return The last filter added or <code>null</code> if the current + * selection set is empty. + */ protected Filter lastSelected () { *************** *** 1748,1751 **** --- 1822,1829 ---- } + /** + * Return the current selection set as an array. + * @return The array of selected filters. + */ protected Filter[] getSelection () { *************** *** 1758,1761 **** --- 1836,1843 ---- } + /** + * Serialize the current selection set. + * @return The serialized form of the set of filters. + */ public String serializeSelection () { *************** *** 1765,1769 **** filters = getSelection (); - // serialize the selection writer = new StringWriter (200); out = new PrintWriter (writer, false); --- 1847,1850 ---- *************** *** 1784,1787 **** --- 1865,1871 ---- } + /** + * Delete the current selection set from the filters in the GUI. + */ public void deleteSelection () { *************** *** 1801,1804 **** --- 1885,1893 ---- } + /** + * Check if there is more than one filter selected. + * @return <code>true</code> if only one filter is selected, + * <code>false</code> otherwise. + */ public boolean isSingleSelection () { *************** *** 2167,2172 **** /** * This message goes to DragSourceListener, ! * informing it that the dragging has ended ! * */ public void dragDropEnd (DragSourceDropEvent event) --- 2256,2261 ---- /** * This message goes to DragSourceListener, ! * informing it that the dragging has ended. ! * @param event Details about the drop event. */ public void dragDropEnd (DragSourceDropEvent event) *************** *** 2180,2185 **** /** * This message goes to DragSourceListener, ! * informing it that the dragging has entered the DropSite ! * */ public void dragEnter (DragSourceDragEvent event) --- 2269,2274 ---- /** * This message goes to DragSourceListener, ! * informing it that the dragging has entered the DropSite. ! * @param event Details about the drag event. */ public void dragEnter (DragSourceDragEvent event) *************** *** 2189,2195 **** /** ! * this message goes to DragSourceListener, informing it that the dragging ! * has exited the DropSite ! * */ public void dragExit (DragSourceEvent event) --- 2278,2284 ---- /** ! * This message goes to DragSourceListener, informing it that the dragging ! * has exited the DropSite. ! * @param event Details about the drag event. */ public void dragExit (DragSourceEvent event) *************** *** 2199,2205 **** /** ! * this message goes to DragSourceListener, informing it that the dragging is currently ! * ocurring over the DropSite ! * */ public void dragOver (DragSourceDragEvent event) --- 2288,2294 ---- /** ! * This message goes to DragSourceListener, informing it that the dragging is currently ! * ocurring over the DropSite. ! * @param event Details about the drag event. */ public void dragOver (DragSourceDragEvent event) *************** *** 2209,2214 **** /** ! * is invoked when the user changes the dropAction ! * */ public void dropActionChanged (DragSourceDragEvent event) --- 2298,2303 ---- /** ! * This is invoked when the user changes the dropAction. ! * @param event Details about the drop action event. */ public void dropActionChanged (DragSourceDragEvent event) *************** *** 2222,2227 **** /** ! * is invoked when you are dragging over the DropSite ! * */ public void dragEnter (DropTargetDragEvent event) --- 2311,2316 ---- /** ! * This is invoked when you are dragging over the DropSite. ! * @param event Details about the drag event. */ public void dragEnter (DropTargetDragEvent event) *************** *** 2256,2261 **** /** ! * is invoked when you are exit the DropSite without dropping ! * */ public void dragExit (DropTargetEvent event) --- 2345,2350 ---- /** ! * Thi ss invoked when you are exit the DropSite without dropping. ! * @param event Details about the drag event. */ public void dragExit (DropTargetEvent event) *************** *** 2287,2292 **** /** ! * is invoked when a drag operation is going on ! * */ public void dragOver (DropTargetDragEvent event) --- 2376,2381 ---- /** ! * This is invoked when a drag operation is going on. ! * @param event Details about the drag event. */ public void dragOver (DropTargetDragEvent event) *************** *** 2296,2300 **** /** ! * a drop has occurred * @param event The drop event. */ --- 2385,2389 ---- /** ! * This is invoked when a drop has occurred. * @param event The drop event. */ *************** *** 2369,2378 **** /** ! * is invoked if the use modifies the current drop gesture ! * */ ! public void dropActionChanged ( DropTargetDragEvent event ) { ! System.out.println( "dropActionChanged"); } --- 2458,2467 ---- /** ! * This is invoked if the user modifies the current drop gesture. ! * @param event Details about the drop action change event. */ ! public void dropActionChanged (DropTargetDragEvent event) { ! // System.out.println( "dropActionChanged"); } |
From: Derrick O. <der...@us...> - 2005-04-12 11:27:53
|
Update of /cvsroot/htmlparser/htmlparser/src/org/htmlparser/parserapplications/filterbuilder/wrappers In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23432/htmlparser/src/org/htmlparser/parserapplications/filterbuilder/wrappers Modified Files: AndFilterWrapper.java HasAttributeFilterWrapper.java HasChildFilterWrapper.java HasParentFilterWrapper.java HasSiblingFilterWrapper.java NodeClassFilterWrapper.java NotFilterWrapper.java OrFilterWrapper.java RegexFilterWrapper.java StringFilterWrapper.java TagNameFilterWrapper.java Log Message: Documentation revamp part two. Index: HasParentFilterWrapper.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/parserapplications/filterbuilder/wrappers/HasParentFilterWrapper.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** HasParentFilterWrapper.java 13 Feb 2005 20:43:06 -0000 1.1 --- HasParentFilterWrapper.java 12 Apr 2005 11:27:42 -0000 1.2 *************** *** 43,49 **** */ public class HasParentFilterWrapper ! extends ! Filter ! implements ActionListener { --- 43,49 ---- */ public class HasParentFilterWrapper ! extends ! Filter ! implements ActionListener { *************** *** 85,88 **** --- 85,92 ---- // + /** + * Get the name of the filter. + * @return A descriptive name for the filter. + */ public String getDescription () { *************** *** 90,93 **** --- 94,101 ---- } + /** + * Get the resource name for the icon. + * @return The icon resource specification. + */ public String getIconSpec () { *************** *** 95,98 **** --- 103,110 ---- } + /** + * Get the underlying node filter object. + * @return The node filter object suitable for serialization. + */ public NodeFilter getNodeFilter () { *************** *** 110,113 **** --- 122,133 ---- } + /** + * Assign the underlying node filter for this wrapper. + * @param filter The filter to wrap. + * @param context The parser to use for conditioning this filter. + * Some filters need contextual information to provide to the user, + * i.e. for tag names or attribute names or values, + * so the Parser context is provided. + */ public void setNodeFilter (NodeFilter filter, Parser context) { *************** *** 116,119 **** --- 136,143 ---- } + /** + * Get the underlying node filter's subordinate filters. + * @return The node filter object's contained filters. + */ public NodeFilter[] getSubNodeFilters () { *************** *** 130,133 **** --- 154,161 ---- } + /** + * Assign the underlying node filter's subordinate filters. + * @param filters The filters to insert into the underlying node filter. + */ public void setSubNodeFilters (NodeFilter[] filters) { *************** *** 138,141 **** --- 166,179 ---- } + /** + * Convert this filter into Java code. + * Output whatever text necessary and return the variable name. + * @param out The output buffer. + * @param context Three integers as follows: + * <li>indent level - the number of spaces to insert at the beginning of each line</li> + * <li>filter number - the next available filter number</li> + * <li>filter array number - the next available array of filters number</li> + * @return The variable name to use when referencing this filter (usually "filter" + context[1]++) + */ public String toJavaCode (StringBuffer out, int[] context) { *************** *** 161,170 **** if (null != name) { ! spaces (out, context[0]); ! out.append (ret); ! out.append (".setParentFilter ("); ! out.append (name); ! out.append (");"); ! newline (out); } --- 199,208 ---- if (null != name) { ! spaces (out, context[0]); ! out.append (ret); ! out.append (".setParentFilter ("); ! out.append (name); ! out.append (");"); ! newline (out); } *************** *** 176,179 **** --- 214,226 ---- // + /** + * Predicate to determine whether or not to keep the given node. + * The behaviour based on this outcome is determined by the context + * in which it is called. It may lead to the node being added to a list + * or printed out. See the calling routine for details. + * @return <code>true</code> if the node is to be kept, <code>false</code> + * if it is to be discarded. + * @param node The node to test. + */ public boolean accept (Node node) { *************** *** 187,190 **** --- 234,238 ---- /** * Invoked when an action occurs on the check box. + * @param event Details about the action event. */ public void actionPerformed (ActionEvent event) *************** *** 197,201 **** { recursive = mRecursive.isSelected (); ! mFilter.setRecursive (recursive); } } --- 245,249 ---- { recursive = mRecursive.isSelected (); ! mFilter.setRecursive (recursive); } } Index: NotFilterWrapper.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/parserapplications/filterbuilder/wrappers/NotFilterWrapper.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** NotFilterWrapper.java 13 Feb 2005 20:43:06 -0000 1.1 --- NotFilterWrapper.java 12 Apr 2005 11:27:42 -0000 1.2 *************** *** 38,43 **** */ public class NotFilterWrapper ! extends ! Filter { /** --- 38,43 ---- */ public class NotFilterWrapper ! extends ! Filter { /** *************** *** 67,70 **** --- 67,74 ---- // + /** + * Get the name of the filter. + * @return A descriptive name for the filter. + */ public String getDescription () { *************** *** 72,75 **** --- 76,83 ---- } + /** + * Get the resource name for the icon. + * @return The icon resource specification. + */ public String getIconSpec () { *************** *** 77,80 **** --- 85,92 ---- } + /** + * Get the underlying node filter object. + * @return The node filter object suitable for serialization. + */ public NodeFilter getNodeFilter () { *************** *** 91,94 **** --- 103,114 ---- } + /** + * Assign the underlying node filter for this wrapper. + * @param filter The filter to wrap. + * @param context The parser to use for conditioning this filter. + * Some filters need contextual information to provide to the user, + * i.e. for tag names or attribute names or values, + * so the Parser context is provided. + */ public void setNodeFilter (NodeFilter filter, Parser context) { *************** *** 96,99 **** --- 116,123 ---- } + /** + * Get the underlying node filter's subordinate filters. + * @return The node filter object's contained filters. + */ public NodeFilter[] getSubNodeFilters () { *************** *** 110,113 **** --- 134,141 ---- } + /** + * Assign the underlying node filter's subordinate filters. + * @param filters The filters to insert into the underlying node filter. + */ public void setSubNodeFilters (NodeFilter[] filters) { *************** *** 118,121 **** --- 146,159 ---- } + /** + * Convert this filter into Java code. + * Output whatever text necessary and return the variable name. + * @param out The output buffer. + * @param context Three integers as follows: + * <li>indent level - the number of spaces to insert at the beginning of each line</li> + * <li>filter number - the next available filter number</li> + * <li>filter array number - the next available array of filters number</li> + * @return The variable name to use when referencing this filter (usually "filter" + context[1]++) + */ public String toJavaCode (StringBuffer out, int[] context) { *************** *** 135,144 **** if (null != name) { ! spaces (out, context[0]); ! out.append (ret); ! out.append (".setPredicate ("); ! out.append (name); ! out.append (");"); ! newline (out); } --- 173,182 ---- if (null != name) { ! spaces (out, context[0]); ! out.append (ret); ! out.append (".setPredicate ("); ! out.append (name); ! out.append (");"); ! newline (out); } *************** *** 150,153 **** --- 188,200 ---- // + /** + * Predicate to determine whether or not to keep the given node. + * The behaviour based on this outcome is determined by the context + * in which it is called. It may lead to the node being added to a list + * or printed out. See the calling routine for details. + * @return <code>true</code> if the node is to be kept, <code>false</code> + * if it is to be discarded. + * @param node The node to test. + */ public boolean accept (Node node) { Index: StringFilterWrapper.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/parserapplications/filterbuilder/wrappers/StringFilterWrapper.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** StringFilterWrapper.java 13 Feb 2005 20:43:06 -0000 1.1 --- StringFilterWrapper.java 12 Apr 2005 11:27:42 -0000 1.2 *************** *** 50,56 **** */ public class StringFilterWrapper ! extends ! Filter ! implements ActionListener, DocumentListener, --- 50,56 ---- */ public class StringFilterWrapper ! extends ! Filter ! implements ActionListener, DocumentListener, *************** *** 62,68 **** protected StringFilter mFilter; ! /** ! * Text to check for. ! */ protected JTextArea mPattern; --- 62,68 ---- protected StringFilter mFilter; ! /** ! * Text to check for. ! */ protected JTextArea mPattern; *************** *** 110,117 **** { mLocale.addItem (mFilter.getLocale ().getDisplayName ()); ! thread = new Thread (this); ! thread.setName ("locale_getter"); ! thread.setPriority (Thread.MIN_PRIORITY); ! thread.run (); } add (mLocale); --- 110,117 ---- { mLocale.addItem (mFilter.getLocale ().getDisplayName ()); ! thread = new Thread (this); ! thread.setName ("locale_getter"); ! thread.setPriority (Thread.MIN_PRIORITY); ! thread.run (); } add (mLocale); *************** *** 125,128 **** --- 125,132 ---- // + /** + * Get the name of the filter. + * @return A descriptive name for the filter. + */ public String getDescription () { *************** *** 130,133 **** --- 134,141 ---- } + /** + * Get the resource name for the icon. + * @return The icon resource specification. + */ public String getIconSpec () { *************** *** 135,138 **** --- 143,150 ---- } + /** + * Get the underlying node filter object. + * @return The node filter object suitable for serialization. + */ public NodeFilter getNodeFilter () { *************** *** 147,150 **** --- 159,170 ---- } + /** + * Assign the underlying node filter for this wrapper. + * @param filter The filter to wrap. + * @param context The parser to use for conditioning this filter. + * Some filters need contextual information to provide to the user, + * i.e. for tag names or attribute names or values, + * so the Parser context is provided. + */ public void setNodeFilter (NodeFilter filter, Parser context) { *************** *** 156,159 **** --- 176,183 ---- } + /** + * Get the underlying node filter's subordinate filters. + * @return The node filter object's contained filters. + */ public NodeFilter[] getSubNodeFilters () { *************** *** 161,164 **** --- 185,192 ---- } + /** + * Assign the underlying node filter's subordinate filters. + * @param filters The filters to insert into the underlying node filter. + */ public void setSubNodeFilters (NodeFilter[] filters) { *************** *** 166,169 **** --- 194,207 ---- } + /** + * Convert this filter into Java code. + * Output whatever text necessary and return the variable name. + * @param out The output buffer. + * @param context Three integers as follows: + * <li>indent level - the number of spaces to insert at the beginning of each line</li> + * <li>filter number - the next available filter number</li> + * <li>filter array number - the next available array of filters number</li> + * @return The variable name to use when referencing this filter (usually "filter" + context[1]++) + */ public String toJavaCode (StringBuffer out, int[] context) { *************** *** 206,209 **** --- 244,256 ---- // + /** + * Predicate to determine whether or not to keep the given node. + * The behaviour based on this outcome is determined by the context + * in which it is called. It may lead to the node being added to a list + * or printed out. See the calling routine for details. + * @return <code>true</code> if the node is to be kept, <code>false</code> + * if it is to be discarded. + * @param node The node to test. + */ public boolean accept (Node node) { *************** *** 217,220 **** --- 264,268 ---- /** * Invoked when an action occurs on the combo box. + * @param event Details about the action event. */ public void actionPerformed (ActionEvent event) *************** *** 228,235 **** if (source == mCaseSensitivity) { ! sensitive = mCaseSensitivity.isSelected (); ! mFilter.setCaseSensitive (sensitive); mLocale.setVisible (!sensitive); ! mLocale.setSelectedItem (mFilter.getLocale ().getDisplayName ()); } else if (source == mLocale) --- 276,283 ---- if (source == mCaseSensitivity) { ! sensitive = mCaseSensitivity.isSelected (); ! mFilter.setCaseSensitive (sensitive); mLocale.setVisible (!sensitive); ! mLocale.setSelectedItem (mFilter.getLocale ().getDisplayName ()); } else if (source == mLocale) *************** *** 237,248 **** synchronized (mLocale) { ! selection = mLocale.getSelectedObjects (); ! if ((null != selection) && (0 != selection.length)) ! { ! locale = (String)selection[0]; ! for (int i = 0; i < mLocales.length; i++) ! if (locale.equals (mLocales[i].getDisplayName ())) ! mFilter.setLocale (mLocales[i]); ! } } } --- 285,296 ---- synchronized (mLocale) { ! selection = mLocale.getSelectedObjects (); ! if ((null != selection) && (0 != selection.length)) ! { ! locale = (String)selection[0]; ! for (int i = 0; i < mLocales.length; i++) ! if (locale.equals (mLocales[i].getDisplayName ())) ! mFilter.setLocale (mLocales[i]); ! } } } *************** *** 252,256 **** // Runnable interface // ! public void run() { String locale; --- 300,308 ---- // Runnable interface // ! ! /** ! * Background thread task to get the available locales. ! */ ! public void run () { String locale; *************** *** 260,267 **** mLocales = Locale.getAvailableLocales (); locale = mFilter.getLocale ().getDisplayName (); ! for (int i = 0; i < mLocales.length; i++) ! if (!locale.equals (mLocales[i].getDisplayName ())) ! mLocale.addItem (mLocales[i].getDisplayName ()); ! mLocale.invalidate (); } } --- 312,319 ---- mLocales = Locale.getAvailableLocales (); locale = mFilter.getLocale ().getDisplayName (); ! for (int i = 0; i < mLocales.length; i++) ! if (!locale.equals (mLocales[i].getDisplayName ())) ! mLocale.addItem (mLocales[i].getDisplayName ()); ! mLocale.invalidate (); } } *************** *** 271,274 **** --- 323,330 ---- // + /** + * Handle an insert update event. + * @param e Details about the insert event. + */ public void insertUpdate (DocumentEvent e) { *************** *** 286,289 **** --- 342,349 ---- } + /** + * Handle a remove update event. + * @param e Details about the remove event. + */ public void removeUpdate (DocumentEvent e) { *************** *** 301,304 **** --- 361,368 ---- } + /** + * Handle a change update event. + * @param e Details about the change event. + */ public void changedUpdate (DocumentEvent e) { Index: HasChildFilterWrapper.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/parserapplications/filterbuilder/wrappers/HasChildFilterWrapper.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** HasChildFilterWrapper.java 13 Feb 2005 20:43:06 -0000 1.1 --- HasChildFilterWrapper.java 12 Apr 2005 11:27:42 -0000 1.2 *************** *** 43,49 **** */ public class HasChildFilterWrapper ! extends ! Filter ! implements ActionListener { --- 43,49 ---- */ public class HasChildFilterWrapper ! extends ! Filter ! implements ActionListener { *************** *** 85,88 **** --- 85,92 ---- // + /** + * Get the name of the filter. + * @return A descriptive name for the filter. + */ public String getDescription () { *************** *** 90,93 **** --- 94,101 ---- } + /** + * Get the resource name for the icon. + * @return The icon resource specification. + */ public String getIconSpec () { *************** *** 95,98 **** --- 103,110 ---- } + /** + * Get the underlying node filter object. + * @return The node filter object suitable for serialization. + */ public NodeFilter getNodeFilter () { *************** *** 110,113 **** --- 122,133 ---- } + /** + * Assign the underlying node filter for this wrapper. + * @param filter The filter to wrap. + * @param context The parser to use for conditioning this filter. + * Some filters need contextual information to provide to the user, + * i.e. for tag names or attribute names or values, + * so the Parser context is provided. + */ public void setNodeFilter (NodeFilter filter, Parser context) { *************** *** 116,119 **** --- 136,143 ---- } + /** + * Get the underlying node filter's subordinate filters. + * @return The node filter object's contained filters. + */ public NodeFilter[] getSubNodeFilters () { *************** *** 130,133 **** --- 154,161 ---- } + /** + * Assign the underlying node filter's subordinate filters. + * @param filters The filters to insert into the underlying node filter. + */ public void setSubNodeFilters (NodeFilter[] filters) { *************** *** 138,141 **** --- 166,179 ---- } + /** + * Convert this filter into Java code. + * Output whatever text necessary and return the variable name. + * @param out The output buffer. + * @param context Three integers as follows: + * <li>indent level - the number of spaces to insert at the beginning of each line</li> + * <li>filter number - the next available filter number</li> + * <li>filter array number - the next available array of filters number</li> + * @return The variable name to use when referencing this filter (usually "filter" + context[1]++) + */ public String toJavaCode (StringBuffer out, int[] context) { *************** *** 161,170 **** if (null != name) { ! spaces (out, context[0]); ! out.append (ret); ! out.append (".setChildFilter ("); ! out.append (name); ! out.append (");"); ! newline (out); } --- 199,208 ---- if (null != name) { ! spaces (out, context[0]); ! out.append (ret); ! out.append (".setChildFilter ("); ! out.append (name); ! out.append (");"); ! newline (out); } *************** *** 176,179 **** --- 214,226 ---- // + /** + * Predicate to determine whether or not to keep the given node. + * The behaviour based on this outcome is determined by the context + * in which it is called. It may lead to the node being added to a list + * or printed out. See the calling routine for details. + * @return <code>true</code> if the node is to be kept, <code>false</code> + * if it is to be discarded. + * @param node The node to test. + */ public boolean accept (Node node) { *************** *** 187,190 **** --- 234,238 ---- /** * Invoked when an action occurs on the check box. + * @param event Details about the action event. */ public void actionPerformed (ActionEvent event) *************** *** 197,201 **** { recursive = mRecursive.isSelected (); ! mFilter.setRecursive (recursive); } } --- 245,249 ---- { recursive = mRecursive.isSelected (); ! mFilter.setRecursive (recursive); } } Index: AndFilterWrapper.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/parserapplications/filterbuilder/wrappers/AndFilterWrapper.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** AndFilterWrapper.java 13 Feb 2005 20:43:06 -0000 1.1 --- AndFilterWrapper.java 12 Apr 2005 11:27:42 -0000 1.2 *************** *** 38,43 **** */ public class AndFilterWrapper ! extends ! Filter { /** --- 38,43 ---- */ public class AndFilterWrapper ! extends ! Filter { /** *************** *** 67,70 **** --- 67,74 ---- // + /** + * Get the name of the filter. + * @return A descriptive name for the filter. + */ public String getDescription () { *************** *** 72,75 **** --- 76,83 ---- } + /** + * Get the resource name for the icon. + * @return The icon resource specification. + */ public String getIconSpec () { *************** *** 77,80 **** --- 85,92 ---- } + /** + * Get the underlying node filter object. + * @return The node filter object suitable for serialization. + */ public NodeFilter getNodeFilter () { *************** *** 94,97 **** --- 106,117 ---- } + /** + * Assign the underlying node filter for this wrapper. + * @param filter The filter to wrap. + * @param context The parser to use for conditioning this filter. + * Some filters need contextual information to provide to the user, + * i.e. for tag names or attribute names or values, + * so the Parser context is provided. + */ public void setNodeFilter (NodeFilter filter, Parser context) { *************** *** 99,102 **** --- 119,126 ---- } + /** + * Get the underlying node filter's subordinate filters. + * @return The node filter object's contained filters. + */ public NodeFilter[] getSubNodeFilters () { *************** *** 104,107 **** --- 128,135 ---- } + /** + * Assign the underlying node filter's subordinate filters. + * @param filters The filters to insert into the underlying node filter. + */ public void setSubNodeFilters (NodeFilter[] filters) { *************** *** 109,112 **** --- 137,150 ---- } + /** + * Convert this filter into Java code. + * Output whatever text necessary and return the variable name. + * @param out The output buffer. + * @param context Three integers as follows: + * <li>indent level - the number of spaces to insert at the beginning of each line</li> + * <li>filter number - the next available filter number</li> + * <li>filter array number - the next available array of filters number</li> + * @return The variable name to use when referencing this filter (usually "filter" + context[1]++) + */ public String toJavaCode (StringBuffer out, int[] context) { *************** *** 126,147 **** } array = "array" + context[2]++; ! spaces (out, context[0]); ! out.append ("NodeFilter[] "); ! out.append (array); ! out.append (" = new NodeFilter["); ! out.append (predicates.length); ! out.append ("];"); ! newline (out); ! for (int i = 0; i < predicates.length; i++) ! { ! spaces (out, context[0]); ! out.append (array); ! out.append ("["); ! out.append (i); ! out.append ("] = "); ! out.append (names[i]); ! out.append (";"); ! newline (out); ! } } ret = "filter" + context[1]++; --- 164,185 ---- } array = "array" + context[2]++; ! spaces (out, context[0]); ! out.append ("NodeFilter[] "); ! out.append (array); ! out.append (" = new NodeFilter["); ! out.append (predicates.length); ! out.append ("];"); ! newline (out); ! for (int i = 0; i < predicates.length; i++) ! { ! spaces (out, context[0]); ! out.append (array); ! out.append ("["); ! out.append (i); ! out.append ("] = "); ! out.append (names[i]); ! out.append (";"); ! newline (out); ! } } ret = "filter" + context[1]++; *************** *** 153,162 **** if (0 != predicates.length) { ! spaces (out, context[0]); ! out.append (ret); ! out.append (".setPredicates ("); ! out.append (array); ! out.append (");"); ! newline (out); } --- 191,200 ---- if (0 != predicates.length) { ! spaces (out, context[0]); ! out.append (ret); ! out.append (".setPredicates ("); ! out.append (array); ! out.append (");"); ! newline (out); } *************** *** 168,171 **** --- 206,218 ---- // + /** + * Predicate to determine whether or not to keep the given node. + * The behaviour based on this outcome is determined by the context + * in which it is called. It may lead to the node being added to a list + * or printed out. See the calling routine for details. + * @return <code>true</code> if the node is to be kept, <code>false</code> + * if it is to be discarded. + * @param node The node to test. + */ public boolean accept (Node node) { Index: HasSiblingFilterWrapper.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/parserapplications/filterbuilder/wrappers/HasSiblingFilterWrapper.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** HasSiblingFilterWrapper.java 13 Feb 2005 20:43:06 -0000 1.1 --- HasSiblingFilterWrapper.java 12 Apr 2005 11:27:42 -0000 1.2 *************** *** 41,46 **** */ public class HasSiblingFilterWrapper ! extends ! Filter implements ActionListener --- 41,46 ---- */ public class HasSiblingFilterWrapper ! extends ! Filter implements ActionListener *************** *** 72,75 **** --- 72,79 ---- // + /** + * Get the name of the filter. + * @return A descriptive name for the filter. + */ public String getDescription () { *************** *** 77,80 **** --- 81,88 ---- } + /** + * Get the resource name for the icon. + * @return The icon resource specification. + */ public String getIconSpec () { *************** *** 82,85 **** --- 90,97 ---- } + /** + * Get the underlying node filter object. + * @return The node filter object suitable for serialization. + */ public NodeFilter getNodeFilter () { *************** *** 96,99 **** --- 108,119 ---- } + /** + * Assign the underlying node filter for this wrapper. + * @param filter The filter to wrap. + * @param context The parser to use for conditioning this filter. + * Some filters need contextual information to provide to the user, + * i.e. for tag names or attribute names or values, + * so the Parser context is provided. + */ public void setNodeFilter (NodeFilter filter, Parser context) { *************** *** 101,104 **** --- 121,128 ---- } + /** + * Get the underlying node filter's subordinate filters. + * @return The node filter object's contained filters. + */ public NodeFilter[] getSubNodeFilters () { *************** *** 115,118 **** --- 139,146 ---- } + /** + * Assign the underlying node filter's subordinate filters. + * @param filters The filters to insert into the underlying node filter. + */ public void setSubNodeFilters (NodeFilter[] filters) { *************** *** 123,126 **** --- 151,164 ---- } + /** + * Convert this filter into Java code. + * Output whatever text necessary and return the variable name. + * @param out The output buffer. + * @param context Three integers as follows: + * <li>indent level - the number of spaces to insert at the beginning of each line</li> + * <li>filter number - the next available filter number</li> + * <li>filter array number - the next available array of filters number</li> + * @return The variable name to use when referencing this filter (usually "filter" + context[1]++) + */ public String toJavaCode (StringBuffer out, int[] context) { *************** *** 140,149 **** if (null != name) { ! spaces (out, context[0]); ! out.append (ret); ! out.append (".setSiblingFilter ("); ! out.append (name); ! out.append (");"); ! newline (out); } --- 178,187 ---- if (null != name) { ! spaces (out, context[0]); ! out.append (ret); ! out.append (".setSiblingFilter ("); ! out.append (name); ! out.append (");"); ! newline (out); } *************** *** 155,158 **** --- 193,205 ---- // + /** + * Predicate to determine whether or not to keep the given node. + * The behaviour based on this outcome is determined by the context + * in which it is called. It may lead to the node being added to a list + * or printed out. See the calling routine for details. + * @return <code>true</code> if the node is to be kept, <code>false</code> + * if it is to be discarded. + * @param node The node to test. + */ public boolean accept (Node node) { *************** *** 166,169 **** --- 213,217 ---- /** * Invoked when an action occurs. + * @param event Details about the action event. */ public void actionPerformed (ActionEvent event) Index: TagNameFilterWrapper.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/parserapplications/filterbuilder/wrappers/TagNameFilterWrapper.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TagNameFilterWrapper.java 13 Feb 2005 20:43:06 -0000 1.1 --- TagNameFilterWrapper.java 12 Apr 2005 11:27:42 -0000 1.2 *************** *** 50,56 **** */ public class TagNameFilterWrapper ! extends ! Filter ! implements ActionListener { --- 50,56 ---- */ public class TagNameFilterWrapper ! extends ! Filter ! implements ActionListener { *************** *** 84,87 **** --- 84,91 ---- // + /** + * Get the name of the filter. + * @return A descriptive name for the filter. + */ public String getDescription () { *************** *** 89,92 **** --- 93,100 ---- } + /** + * Get the resource name for the icon. + * @return The icon resource specification. + */ public String getIconSpec () { *************** *** 94,97 **** --- 102,109 ---- } + /** + * Get the underlying node filter object. + * @return The node filter object suitable for serialization. + */ public NodeFilter getNodeFilter () { *************** *** 104,107 **** --- 116,127 ---- } + /** + * Assign the underlying node filter for this wrapper. + * @param filter The filter to wrap. + * @param context The parser to use for conditioning this filter. + * Some filters need contextual information to provide to the user, + * i.e. for tag names or attribute names or values, + * so the Parser context is provided. + */ public void setNodeFilter (NodeFilter filter, Parser context) { *************** *** 113,118 **** try { ! for (NodeIterator iterator = context.elements (); iterator.hasMoreNodes (); ) ! addName (set, iterator.nextNode ()); } catch (ParserException pe) --- 133,138 ---- try { ! for (NodeIterator iterator = context.elements (); iterator.hasMoreNodes (); ) ! addName (set, iterator.nextNode ()); } catch (ParserException pe) *************** *** 125,128 **** --- 145,152 ---- } + /** + * Get the underlying node filter's subordinate filters. + * @return The node filter object's contained filters. + */ public NodeFilter[] getSubNodeFilters () { *************** *** 130,133 **** --- 154,161 ---- } + /** + * Assign the underlying node filter's subordinate filters. + * @param filters The filters to insert into the underlying node filter. + */ public void setSubNodeFilters (NodeFilter[] filters) { *************** *** 135,138 **** --- 163,176 ---- } + /** + * Convert this filter into Java code. + * Output whatever text necessary and return the variable name. + * @param out The output buffer. + * @param context Three integers as follows: + * <li>indent level - the number of spaces to insert at the beginning of each line</li> + * <li>filter number - the next available filter number</li> + * <li>filter array number - the next available array of filters number</li> + * @return The variable name to use when referencing this filter (usually "filter" + context[1]++) + */ public String toJavaCode (StringBuffer out, int[] context) { *************** *** 155,158 **** --- 193,201 ---- } + /** + * Add the tag name and it's children's tag names to the set of tag names. + * @param set The set to add to. + * @param node The node to get the names from. + */ protected void addName (Set set, Node node) { *************** *** 175,178 **** --- 218,230 ---- // + /** + * Predicate to determine whether or not to keep the given node. + * The behaviour based on this outcome is determined by the context + * in which it is called. It may lead to the node being added to a list + * or printed out. See the calling routine for details. + * @return <code>true</code> if the node is to be kept, <code>false</code> + * if it is to be discarded. + * @param node The node to test. + */ public boolean accept (Node node) { *************** *** 186,189 **** --- 238,242 ---- /** * Invoked when an action occurs on the combo box. + * @param event Details about the action event. */ public void actionPerformed (ActionEvent event) Index: NodeClassFilterWrapper.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/parserapplications/filterbuilder/wrappers/NodeClassFilterWrapper.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** NodeClassFilterWrapper.java 13 Feb 2005 20:43:06 -0000 1.1 --- NodeClassFilterWrapper.java 12 Apr 2005 11:27:42 -0000 1.2 *************** *** 51,57 **** */ public class NodeClassFilterWrapper ! extends ! Filter ! implements ActionListener // , --- 51,57 ---- */ public class NodeClassFilterWrapper ! extends ! Filter ! implements ActionListener // , *************** *** 86,89 **** --- 86,93 ---- // + /** + * Get the name of the filter. + * @return A descriptive name for the filter. + */ public String getDescription () { *************** *** 91,94 **** --- 95,102 ---- } + /** + * Get the resource name for the icon. + * @return The icon resource specification. + */ public String getIconSpec () { *************** *** 96,99 **** --- 104,111 ---- } + /** + * Get the underlying node filter object. + * @return The node filter object suitable for serialization. + */ public NodeFilter getNodeFilter () { *************** *** 106,109 **** --- 118,129 ---- } + /** + * Assign the underlying node filter for this wrapper. + * @param filter The filter to wrap. + * @param context The parser to use for conditioning this filter. + * Some filters need contextual information to provide to the user, + * i.e. for tag names or attribute names or values, + * so the Parser context is provided. + */ public void setNodeFilter (NodeFilter filter, Parser context) { *************** *** 132,135 **** --- 152,159 ---- } + /** + * Get the underlying node filter's subordinate filters. + * @return The node filter object's contained filters. + */ public NodeFilter[] getSubNodeFilters () { *************** *** 137,140 **** --- 161,168 ---- } + /** + * Assign the underlying node filter's subordinate filters. + * @param filters The filters to insert into the underlying node filter. + */ public void setSubNodeFilters (NodeFilter[] filters) { *************** *** 142,145 **** --- 170,183 ---- } + /** + * Convert this filter into Java code. + * Output whatever text necessary and return the variable name. + * @param out The output buffer. + * @param context Three integers as follows: + * <li>indent level - the number of spaces to insert at the beginning of each line</li> + * <li>filter number - the next available filter number</li> + * <li>filter array number - the next available array of filters number</li> + * @return The variable name to use when referencing this filter (usually "filter" + context[1]++) + */ public String toJavaCode (StringBuffer out, int[] context) { *************** *** 167,170 **** --- 205,217 ---- // + /** + * Predicate to determine whether or not to keep the given node. + * The behaviour based on this outcome is determined by the context + * in which it is called. It may lead to the node being added to a list + * or printed out. See the calling routine for details. + * @return <code>true</code> if the node is to be kept, <code>false</code> + * if it is to be discarded. + * @param node The node to test. + */ public boolean accept (Node node) { *************** *** 178,181 **** --- 225,229 ---- /** * Invoked when an action occurs on the combo box. + * @param event Details about the action event. */ public void actionPerformed (ActionEvent event) *************** *** 189,196 **** mFilter.setMatchClass (Class.forName ((String)mClass.getSelectedItem ())); } ! catch (ClassNotFoundException cnfe) ! { ! cnfe.printStackTrace (); ! } } --- 237,244 ---- mFilter.setMatchClass (Class.forName ((String)mClass.getSelectedItem ())); } ! catch (ClassNotFoundException cnfe) ! { ! cnfe.printStackTrace (); ! } } Index: HasAttributeFilterWrapper.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/parserapplications/filterbuilder/wrappers/HasAttributeFilterWrapper.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** HasAttributeFilterWrapper.java 13 Feb 2005 20:43:06 -0000 1.1 --- HasAttributeFilterWrapper.java 12 Apr 2005 11:27:42 -0000 1.2 *************** *** 59,65 **** */ public class HasAttributeFilterWrapper ! extends ! Filter ! implements ActionListener, DocumentListener --- 59,65 ---- */ public class HasAttributeFilterWrapper ! extends ! Filter ! implements ActionListener, DocumentListener *************** *** 80,86 **** protected JCheckBox mValued; ! /** ! * Value to check for. ! */ protected JTextArea mAttributeValue; --- 80,86 ---- protected JCheckBox mValued; ! /** ! * Value to check for. ! */ protected JTextArea mAttributeValue; *************** *** 123,126 **** --- 123,131 ---- // + /** + * Add the attribute names from the node to the set of attribute names. + * @param set The set to add to. + * @param node The node with attributes to add. + */ protected void addAttributes (Set set, Node node) { *************** *** 150,153 **** --- 155,163 ---- } + /** + * Add the attribute values from the node to the set of attribute values. + * @param set The set to add to. + * @param node The node with attributes to add. + */ protected void addAttributeValues (Set set, Node node) { *************** *** 184,187 **** --- 194,201 ---- // + /** + * Get the name of the filter. + * @return A descriptive name for the filter. + */ public String getDescription () { *************** *** 189,192 **** --- 203,210 ---- } + /** + * Get the resource name for the icon. + * @return The icon resource specification. + */ public String getIconSpec () { *************** *** 194,197 **** --- 212,219 ---- } + /** + * Get the underlying node filter object. + * @return The node filter object suitable for serialization. + */ public NodeFilter getNodeFilter () { *************** *** 205,208 **** --- 227,238 ---- } + /** + * Assign the underlying node filter for this wrapper. + * @param filter The filter to wrap. + * @param context The parser to use for conditioning this filter. + * Some filters need contextual information to provide to the user, + * i.e. for tag names or attribute names or values, + * so the Parser context is provided. + */ public void setNodeFilter (NodeFilter filter, Parser context) { *************** *** 216,221 **** try { ! for (NodeIterator iterator = context.elements (); iterator.hasMoreNodes (); ) ! addAttributes (set, iterator.nextNode ()); } catch (ParserException pe) --- 246,251 ---- try { ! for (NodeIterator iterator = context.elements (); iterator.hasMoreNodes (); ) ! addAttributes (set, iterator.nextNode ()); } catch (ParserException pe) *************** *** 242,245 **** --- 272,279 ---- } + /** + * Get the underlying node filter's subordinate filters. + * @return The node filter object's contained filters. + */ public NodeFilter[] getSubNodeFilters () { *************** *** 247,250 **** --- 281,288 ---- } + /** + * Assign the underlying node filter's subordinate filters. + * @param filters The filters to insert into the underlying node filter. + */ public void setSubNodeFilters (NodeFilter[] filters) { *************** *** 252,255 **** --- 290,303 ---- } + /** + * Convert this filter into Java code. + * Output whatever text necessary and return the variable name. + * @param out The output buffer. + * @param context Three integers as follows: + * <li>indent level - the number of spaces to insert at the beginning of each line</li> + * <li>filter number - the next available filter number</li> + * <li>filter array number - the next available array of filters number</li> + * @return The variable name to use when referencing this filter (usually "filter" + context[1]++) + */ public String toJavaCode (StringBuffer out, int[] context) { *************** *** 270,279 **** if (null != mFilter.getAttributeValue ()) { ! spaces (out, context[0]); ! out.append (ret); ! out.append (".setAttributeValue (\""); ! out.append (mFilter.getAttributeValue ()); ! out.append ("\");"); ! newline (out); } --- 318,327 ---- if (null != mFilter.getAttributeValue ()) { ! spaces (out, context[0]); ! out.append (ret); ! out.append (".setAttributeValue (\""); ! out.append (mFilter.getAttributeValue ()); ! out.append ("\");"); ! newline (out); } *************** *** 285,288 **** --- 333,345 ---- // + /** + * Predicate to determine whether or not to keep the given node. + * The behaviour based on this outcome is determined by the context + * in which it is called. It may lead to the node being added to a list + * or printed out. See the calling routine for details. + * @return <code>true</code> if the node is to be kept, <code>false</code> + * if it is to be discarded. + * @param node The node to test. + */ public boolean accept (Node node) { *************** *** 296,299 **** --- 353,357 ---- /** * Invoked when an action occurs on the combo box. + * @param event Details about the action event. */ public void actionPerformed (ActionEvent event) *************** *** 312,327 **** else if (source == mValued) { ! valued = mValued.isSelected (); ! if (valued) ! { ! mFilter.setAttributeValue (mAttributeValue.getText ()); ! mAttributeValue.setVisible (true); ! } ! else ! { ! mAttributeValue.setVisible (false); ! mAttributeValue.setText (""); ! mFilter.setAttributeValue (null); ! } } } --- 370,385 ---- else if (source == mValued) { ! valued = mValued.isSelected (); ! if (valued) ! { ! mFilter.setAttributeValue (mAttributeValue.getText ()); ! mAttributeValue.setVisible (true); ! } ! else ! { ! mAttributeValue.setVisible (false); ! mAttributeValue.setText (""); ! mFilter.setAttributeValue (null); ! } } } *************** *** 331,334 **** --- 389,396 ---- // + /** + * Handle an insert update event. + * @param e Details about the insert event. + */ public void insertUpdate (DocumentEvent e) { *************** *** 346,349 **** --- 408,415 ---- } + /** + * Handle a remove update event. + * @param e Details about the remove event. + */ public void removeUpdate (DocumentEvent e) { *************** *** 361,364 **** --- 427,434 ---- } + /** + * Handle a change update event. + * @param e Details about the change event. + */ public void changedUpdate (DocumentEvent e) { Index: RegexFilterWrapper.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/parserapplications/filterbuilder/wrappers/RegexFilterWrapper.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** RegexFilterWrapper.java 13 Feb 2005 20:43:06 -0000 1.1 --- RegexFilterWrapper.java 12 Apr 2005 11:27:42 -0000 1.2 *************** *** 48,54 **** */ public class RegexFilterWrapper ! extends ! Filter ! implements ActionListener, DocumentListener --- 48,54 ---- */ public class RegexFilterWrapper ! extends ! Filter ! implements ActionListener, DocumentListener *************** *** 77,83 **** protected RegexFilter mFilter; ! /** ! * Text to check for ! */ protected JTextArea mPattern; --- 77,83 ---- protected RegexFilter mFilter; ! /** ! * Text to check for ! */ protected JTextArea mPattern; *************** *** 115,118 **** --- 115,122 ---- // + /** + * Get the name of the filter. + * @return A descriptive name for the filter. + */ public String getDescription () { *************** *** 120,123 **** --- 124,131 ---- } + /** + * Get the resource name for the icon. + * @return The icon resource specification. + */ public String getIconSpec () { *************** *** 125,128 **** --- 133,140 ---- } + /** + * Get the underlying node filter object. + * @return The node filter object suitable for serialization. + */ public NodeFilter getNodeFilter () { *************** *** 136,139 **** --- 148,159 ---- } + /** + * Assign the underlying node filter for this wrapper. + * @param filter The filter to wrap. + * @param context The parser to use for conditioning this filter. + * Some filters need contextual information to provide to the user, + * i.e. for tag names or attribute names or values, + * so the Parser context is provided. + */ public void setNodeFilter (NodeFilter filter, Parser context) { *************** *** 143,146 **** --- 163,170 ---- } + /** + * Get the underlying node filter's subordinate filters. + * @return The node filter object's contained filters. + */ public NodeFilter[] getSubNodeFilters () { *************** *** 148,151 **** --- 172,179 ---- } + /** + * Assign the underlying node filter's subordinate filters. + * @param filters The filters to insert into the underlying node filter. + */ public void setSubNodeFilters (NodeFilter[] filters) { *************** *** 153,156 **** --- 181,194 ---- } + /** + * Convert this filter into Java code. + * Output whatever text necessary and return the variable name. + * @param out The output buffer. + * @param context Three integers as follows: + * <li>indent level - the number of spaces to insert at the beginning of each line</li> + * <li>filter number - the next available filter number</li> + * <li>filter array number - the next available array of filters number</li> + * @return The variable name to use when referencing this filter (usually "filter" + context[1]++) + */ public String toJavaCode (StringBuffer out, int[] context) { *************** *** 179,182 **** --- 217,225 ---- } + /** + * Convert the regex strategy to a string. + * @param strategy The regex strategy. + * @return A string for display in the GUI or in the Java program. + */ public String strategyToString (int strategy) { *************** *** 187,190 **** --- 230,238 ---- } + /** + * Convert a string to a regex strategy. + * @param strategy The string equivalent of a regex strategy. + * @return The regex strategy to use in executing the regular expression. + */ public int stringToStrategy (String strategy) { *************** *** 195,198 **** --- 243,251 ---- } + /** + * Convert the regex strategy to an index into the map. + * @param strategy The regex strategy. + * @return The index of the regex strategy in the map. + */ public int strategyToIndex (int strategy) { *************** *** 203,206 **** --- 256,264 ---- } + /** + * Convert an index into a regex strategy. + * @param index The index of the regex strategy in the map. + * @return The regex strategy at that inxdex. + */ public int indexToStrategy (int index) { *************** *** 212,215 **** --- 270,282 ---- // + /** + * Predicate to determine whether or not to keep the given node. + * The behaviour based on this outcome is determined by the context + * in which it is called. It may lead to the node being added to a list + * or printed out. See the calling routine for details. + * @return <code>true</code> if the node is to be kept, <code>false</code> + * if it is to be discarded. + * @param node The node to test. + */ public boolean accept (Node node) { *************** *** 223,226 **** --- 290,294 ---- /** * Invoked when an action occurs on the combo box. + * @param event Details about the action event. */ public void actionPerformed (ActionEvent event) *************** *** 237,240 **** --- 305,312 ---- // + /** + * Handle an insert update event. + * @param e Details about the insert event. + */ public void insertUpdate (DocumentEvent e) { *************** *** 252,255 **** --- 324,331 ---- } + /** + * Handle a remove update event. + * @param e Details about the remove event. + */ public void removeUpdate (DocumentEvent e) { *************** *** 267,270 **** --- 343,350 ---- } + /** + * Handle a change update event. + * @param e Details about the change event. + */ public void changedUpdate (DocumentEvent e) { Index: OrFilterWrapper.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/parserapplications/filterbuilder/wrappers/OrFilterWrapper.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** OrFilterWrapper.java 13 Feb 2005 20:43:06 -0000 1.1 --- OrFilterWrapper.java 12 Apr 2005 11:27:42 -0000 1.2 *************** *** 38,43 **** */ public class OrFilterWrapper ! extends ! Filter { /** --- 38,43 ---- */ public class OrFilterWrapper ! extends ! Filter { /** *************** *** 67,70 **** --- 67,74 ---- // + /** + * Get the name of the filter. + * @return A descriptive name for the filter. + */ public String getDescription () { *************** *** 72,75 **** --- 76,83 ---- } + /** + * Get the resource name for the icon. + * @return The icon resource specification. + */ public String getIconSpec () { *************** *** 77,80 **** --- 85,92 ---- } + /** + * Get the underlying node filter object. + * @return The node filter object suitable for serialization. + */ public NodeFilter getNodeFilter () { *************** *** 94,97 **** --- 106,117 ---- } + /** + * Assign the underlying node filter for this wrapper. + * @param filter The filter to wrap. + * @param context The parser to use for conditioning this filter. + * Some filters need contextual information to provide to the user, + * i.e. for tag names or attribute names or values, + * so the Parser context is provided. + */ public void setNodeFilter (NodeFilter filter, Parser context) { *************** *** 99,102 **** --- 119,126 ---- } + /** + * Get the underlying node filter's subordinate filters. + * @return The node filter object's contained filters. + */ public NodeFilter[] getSubNodeFilters () { *************** *** 104,107 **** --- 128,135 ---- } + /** + * Assign the underlying node filter's subordinate filters. + * @param filters The filters to insert into the underlying node filter. + */ public void setSubNodeFilters (NodeFilter[] filters) { *************** *** 109,112 **** --- 137,150 ---- } + /** + * Convert this filter into Java code. + * Output whatever text necessary and return the variable name. + * @param out The output buffer. + * @param context Three integers as follows: + * <li>indent level - the number of spaces to insert at the beginning of each line</li> + * <li>filter number - the next available filter number</li> + * <li>filter array number - the next available array of filters number</li> + * @return The variable name to use when referencing this filter (usually "filter" + context[1]++) + */ public String toJavaCode (StringBuffer out, int[] context) { *************** *** 126,147 **** } array = "array" + context[2]++; ! spaces (out, context[0]); ! out.append ("NodeFilter[] "); ! out.append (array); ! out.append (" = new NodeFilter["); ! out.append (predicates.length); ! out.append ("];"); ! newline (out); ! for (int i = 0; i < predicates.length; i++) ! { ! spaces (out, context[0]); ! out.append (array); ! out.append ("["); ! out.append (i); ! out.append ("] = "); ! out.append (names[i]); ! out.append (";"); ! newline (out); ! } } ret = "filter" + context[1]++; --- 164,185 ---- } array = "array" + context[2]++; ! spaces (out, context[0]); ! out.append ("NodeFilter[] "); ! out.append (array); ! out.append (" = new NodeFilter["); ! out.append (predicates.leng... [truncated message content] |
From: Derrick O. <der...@us...> - 2005-04-12 11:27:51
|
Update of /cvsroot/htmlparser/htmlparser/src/org/htmlparser/parserapplications/filterbuilder/layouts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23432/htmlparser/src/org/htmlparser/parserapplications/filterbuilder/layouts Modified Files: NullLayoutManager.java VerticalLayoutManager.java Log Message: Documentation revamp part two. Index: NullLayoutManager.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/parserapplications/filterbuilder/layouts/NullLayoutManager.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** NullLayoutManager.java 13 Feb 2005 20:43:13 -0000 1.1 --- NullLayoutManager.java 12 Apr 2005 11:27:42 -0000 1.2 *************** *** 51,54 **** --- 51,55 ---- * panel given the components in the specified parent container. * @param target The component to be laid out. + * @return The minimum size. * @see #preferredLayoutSize */ *************** *** 61,66 **** * Calculates the preferred size dimensions for the specified * panel given the components in the specified parent container. - * @param target The component to be laid out. * @see #minimumLayoutSize */ public Dimension preferredLayoutSize (Container target) --- 62,68 ---- * Calculates the preferred size dimensions for the specified * panel given the components in the specified parent container. * @see #minimumLayoutSize + * @param target The component to be laid out. + * @return A size deemed suitable for laying out the container. */ public Dimension preferredLayoutSize (Container target) *************** *** 76,82 **** synchronized (target.getTreeLock ()) { ! count = target.getComponentCount (); ! if (0 == count) ! { // be the same size unless we have a parent ret = target.getSize (); --- 78,84 ---- synchronized (target.getTreeLock ()) { ! count = target.getComponentCount (); ! if (0 == count) ! { // be the same size unless we have a parent ret = target.getSize (); *************** *** 91,107 **** } } ! else ! { ! ret = new Dimension (0, 0); ! for (int i = 0 ; i < count ; i++) ! { ! component = target.getComponent (i); ! if (component.isVisible ()) ! { ! point = component.getLocation (); ! dimension = component.getPreferredSize(); ! ret.width = Math.max (ret.width, point.x + dimension.width); ! ret.height = Math.max (ret.height, point.y + dimension.height); ! } } insets = target.getInsets (); --- 93,109 ---- } } ! else ! { ! ret = new Dimension (0, 0); ! for (int i = 0 ; i < count ; i++) ! { ! component = target.getComponent (i); ! if (component.isVisible ()) ! { ! point = component.getLocation (); ! dimension = component.getPreferredSize(); ! ret.width = Math.max (ret.width, point.x + dimension.width); ! ret.height = Math.max (ret.height, point.y + dimension.height); ! } } insets = target.getInsets (); *************** *** 117,123 **** * Returns the maximum size of this component. * @param target The component to be laid out. ! * @see java.awt.Component#getMinimumSize ! * @see java.awt.Component#getPreferredSize ! * @see java.awt.LayoutManager */ public Dimension maximumLayoutSize (Container target) --- 119,124 ---- * Returns the maximum size of this component. * @param target The component to be laid out. ! * @return The maximum size for the container. ! * @see #preferredLayoutSize */ public Dimension maximumLayoutSize (Container target) *************** *** 154,174 **** public void layoutContainer (Container target) { ! int count; ! Component component; ! Dimension dimension; ! synchronized (target.getTreeLock ()) { ! count = target.getComponentCount (); ! for (int i = 0 ; i < count ; i++) ! { ! component = target.getComponent (i); ! if (component.isVisible ()) ! { ! dimension = component.getPreferredSize(); ! component.setSize (dimension.width, dimension.height); ! } ! } ! } } --- 155,175 ---- public void layoutContainer (Container target) { ! int count; ! Component component; ! Dimension dimension; ! synchronized (target.getTreeLock ()) { ! count = target.getComponentCount (); ! for (int i = 0 ; i < count ; i++) ! { ! component = target.getComponent (i); ! if (component.isVisible ()) ! { ! dimension = component.getPreferredSize(); ! component.setSize (dimension.width, dimension.height); ! } ! } ! } } *************** *** 194,197 **** --- 195,199 ---- * the furthest away from the origin, 0.5 is centered, etc. * @param target The target container. + * @return The X-axis alignment. */ public float getLayoutAlignmentX (Container target) *************** *** 207,210 **** --- 209,213 ---- * the furthest away from the origin, 0.5 is centered, etc. * @param target The target container. + * @return The Y-axis alignment. */ public float getLayoutAlignmentY (Container target) Index: VerticalLayoutManager.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/parserapplications/filterbuilder/layouts/VerticalLayoutManager.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** VerticalLayoutManager.java 13 Feb 2005 20:43:13 -0000 1.1 --- VerticalLayoutManager.java 12 Apr 2005 11:27:42 -0000 1.2 *************** *** 52,55 **** --- 52,56 ---- * panel given the components in the specified parent container. * @param target The component to be laid out. + * @return The minimum size. * @see #preferredLayoutSize */ *************** *** 63,66 **** --- 64,68 ---- * panel given the components in the specified parent container. * @param target The component to be laid out. + * @return A size deemed suitable for laying out the container. * @see #minimumLayoutSize */ *************** *** 99,105 **** * Returns the maximum size of this component. * @param target The component to be laid out. ! * @see java.awt.Component#getMinimumSize ! * @see java.awt.Component#getPreferredSize ! * @see java.awt.LayoutManager */ public Dimension maximumLayoutSize (Container target) --- 101,106 ---- * Returns the maximum size of this component. * @param target The component to be laid out. ! * @return The maximum size for the container. ! * @see #preferredLayoutSize */ public Dimension maximumLayoutSize (Container target) *************** *** 139,147 **** int x; int y; ! int count; ! int width; ! Component component; ! Dimension dimension; ! synchronized (target.getTreeLock ()) { --- 140,148 ---- int x; int y; ! int count; ! int width; ! Component component; ! Dimension dimension; ! synchronized (target.getTreeLock ()) { *************** *** 149,178 **** x = insets.left; y = insets.top; ! count = target.getComponentCount (); ! width = 0; ! for (int i = 0 ; i < count ; i++) ! { ! component = target.getComponent (i); ! if (component.isVisible ()) ! { ! dimension = component.getPreferredSize (); ! width = Math.max (width, dimension.width); ! component.setSize (dimension.width, dimension.height); ! component.setLocation (x, y); ! y += dimension.height; ! } ! } ! // now set them all to the same width ! for (int i = 0 ; i < count ; i++) ! { ! component = target.getComponent (i); ! if (component.isVisible ()) ! { ! dimension = component.getSize (); ! dimension.width = width; ! component.setSize (dimension.width, dimension.height); ! } ! } ! } } --- 150,179 ---- x = insets.left; y = insets.top; ! count = target.getComponentCount (); ! width = 0; ! for (int i = 0 ; i < count ; i++) ! { ! component = target.getComponent (i); ! if (component.isVisible ()) ! { ! dimension = component.getPreferredSize (); ! width = Math.max (width, dimension.width); ! component.setSize (dimension.width, dimension.height); ! component.setLocation (x, y); ! y += dimension.height; ! } ! } ! // now set them all to the same width ! for (int i = 0 ; i < count ; i++) ! { ! component = target.getComponent (i); ! if (component.isVisible ()) ! { ! dimension = component.getSize (); ! dimension.width = width; ! component.setSize (dimension.width, dimension.height); ! } ! } ! } } *************** *** 198,201 **** --- 199,203 ---- * the furthest away from the origin, 0.5 is centered, etc. * @param target The target container. + * @return The X-axis alignment. */ public float getLayoutAlignmentX (Container target) *************** *** 211,214 **** --- 213,217 ---- * the furthest away from the origin, 0.5 is centered, etc. * @param target The target container. + * @return The Y-axis alignment. */ public float getLayoutAlignmentY (Container target) |
From: Derrick O. <der...@us...> - 2005-04-12 11:27:51
|
Update of /cvsroot/htmlparser/htmlparser/src/org/htmlparser/parserapplications In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23432/htmlparser/src/org/htmlparser/parserapplications Modified Files: LinkExtractor.java SiteCapturer.java StringExtractor.java WikiCapturer.java package.html Log Message: Documentation revamp part two. Index: package.html =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/parserapplications/package.html,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** package.html 2 Jan 2004 16:24:54 -0000 1.19 --- package.html 12 Apr 2005 11:27:42 -0000 1.20 *************** *** 30,44 **** </head> <body bgcolor="white"> ! Developers and users alike should try out the applications in this package. The code of these applications will give ! a good idea about the capabilities of the HTML Parser, and its intended usage. The binary releases of html parser would ! typically contain these applications in runnable form. ! <h2>Related Documentation</h2> ! For overviews, tutorials, examples, guides, and tool documentation, please see: ! <ul> ! <li><a href="http://htmlparser.sourceforge.net">HTML Parser Home Page</a> ! </ul> <!-- Put @see and @since tags down here. --> --- 30,93 ---- </head> <body bgcolor="white"> ! Example applications. ! <p> ! <table width="94%" border="0"> ! <tr> ! <td valign="top"> ! <strong>Link Extractor</strong><br> ! </td> ! <td> ! <i>Extract links/mail addresses from a web page.</i><br> ! <a href="javadoc/org/htmlparser/parserapplications/LinkExtractor.html" target="_parent">org.htmlparser.parserapplications.LinkExtractor</a> ! <pre> ! <code>bin/linkextractor http://website_url [-maillinks]</code> ! the optional -maillinks argument causes mailto: links to be printed ! </pre> ! </td> ! </tr> ! <tr> ! <td valign="top"> ! <strong>String Extractor</strong><br> ! </td> ! <td> ! <i>Extract text from a web page.</i><br> ! <a href="javadoc/org/htmlparser/parserapplications/StringExtractor.html" target="_parent">org.htmlparser.parserapplications.StringExtractor</a> ! <pre> ! <code>bin/stringextractor http://website_url [-links]</code> + the optional -links argument causes hyperlinks to be shown within the text + </pre> + </td> + </tr> + <tr> + <td valign="top"> + <strong>Site Capturer</strong><br> + </td> + <td> + + <i>Save a web site locally.</i><br> + <a href="javadoc/org/htmlparser/parserapplications/SiteCapturer.html" target="_parent">org.htmlparser.parserapplications.SiteCapturer</a> + <pre> + <code>bin/sitecapturer http://source_website /target_directory/ [true|false]</code> + + the optional boolean argument determines whether resources such as images, + audio and video are to be captured + </pre> + </td> + </tr> + <tr> + <td valign="top"> + <strong>Wiki Capturer</strong><br> + </td> + <td> + + <i>Save a wiki locally.</i><br> + <a href="javadoc/org/htmlparser/parserapplications/WikiCapturer.html" target="_parent">org.htmlparser.parserapplications.WikiCapturer</a> + Subclass of SiteCapturer (see above) that eliminates specific Wiki pages. + </td> + </tr> + </table> <!-- Put @see and @since tags down here. --> Index: WikiCapturer.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/parserapplications/WikiCapturer.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** WikiCapturer.java 30 May 2004 01:43:54 -0000 1.2 --- WikiCapturer.java 12 Apr 2005 11:27:42 -0000 1.3 *************** *** 123,126 **** --- 123,128 ---- * such as images and video are to be captured as well. * These are requested via dialog boxes if not supplied. + * @exception MalformedURLException If the supplied URL is invalid. + * @exception IOException If an error occurs reading the pages or resources. */ public static void main (String[] args) Index: SiteCapturer.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/parserapplications/SiteCapturer.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** SiteCapturer.java 5 Apr 2005 00:48:12 -0000 1.8 --- SiteCapturer.java 12 Apr 2005 11:27:41 -0000 1.9 *************** *** 267,272 **** --- 267,274 ---- /** * Returns <code>true</code> if the link contains text/html content. + * @param link The URL to check for content type. * @return <code>true</code> if the HTTP header indicates the type is * "text/html". + * @exception ParserException If the supplied URL can't be read from. */ protected boolean isHtml (String link) *************** *** 469,472 **** --- 471,476 ---- /** * Process a single page. + * @param filter The filter to apply to the collected nodes. + * @exception ParserException If a parse error occurs. */ protected void process (NodeFilter filter) *************** *** 748,751 **** --- 752,757 ---- * such as images and video are to be captured as well. * These are requested via dialog boxes if not supplied. + * @exception MalformedURLException If the supplied URL is invalid. + * @exception IOException If an error occurs reading the page or resources. */ public static void main (String[] args) Index: StringExtractor.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/parserapplications/StringExtractor.java,v retrieving revision 1.47 retrieving revision 1.48 diff -C2 -d -r1.47 -r1.48 *** StringExtractor.java 29 Feb 2004 15:09:56 -0000 1.47 --- StringExtractor.java 12 Apr 2005 11:27:42 -0000 1.48 *************** *** 51,56 **** /** * Extract the text from a page. - * @param links if <code>true</code> include hyperlinks in output. * @return The textual contents of the page. */ public String extractStrings (boolean links) --- 51,57 ---- /** * Extract the text from a page. * @return The textual contents of the page. + * @param links if <code>true</code> include hyperlinks in output. + * @exception ParserException If a parse error occurs. */ public String extractStrings (boolean links) Index: LinkExtractor.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/parserapplications/LinkExtractor.java,v retrieving revision 1.51 retrieving revision 1.52 diff -C2 -d -r1.51 -r1.52 *** LinkExtractor.java 4 Jan 2004 03:23:09 -0000 1.51 --- LinkExtractor.java 12 Apr 2005 11:27:41 -0000 1.52 *************** *** 44,47 **** --- 44,50 ---- { /** + * Run the link extractor. + * @param args [0] Optional url to extract links from. + * An input dialog is displayed if it is not supplied. */ public static void main (String[] args) |
Update of /cvsroot/htmlparser/htmlparser/src/org/htmlparser/nodeDecorators In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30655/htmlparser/src/org/htmlparser/nodeDecorators Modified Files: AbstractNodeDecorator.java DecodingNode.java EscapeCharacterRemovingNode.java NonBreakingSpaceConvertingNode.java package.html Log Message: Documentation revamp part one. Deprecated node decorators. Added doSemanticAction for Text and Comment nodes. Added missing sitecapturer scripts. Fixed DOS batch files to work when called from any location. Index: NonBreakingSpaceConvertingNode.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/nodeDecorators/NonBreakingSpaceConvertingNode.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** NonBreakingSpaceConvertingNode.java 24 May 2004 16:18:18 -0000 1.14 --- NonBreakingSpaceConvertingNode.java 10 Apr 2005 23:20:43 -0000 1.15 *************** *** 29,32 **** --- 29,39 ---- import org.htmlparser.Text; + /** + * @deprecated Use direct subclasses or dynamic proxies instead. + * <p>Use either direct subclasses of the appropriate node and set them on the + * {@link org.htmlparser.PrototypicalNodeFactory PrototypicalNodeFactory}, + * or use a dynamic proxy implementing the required node type interface.</p> + * @see AbstractNodeDecorator + */ public class NonBreakingSpaceConvertingNode extends AbstractNodeDecorator { public NonBreakingSpaceConvertingNode(Text newDelegate) { Index: package.html =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/nodeDecorators/package.html,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** package.html 29 Feb 2004 15:09:57 -0000 1.1 --- package.html 10 Apr 2005 23:20:43 -0000 1.2 *************** *** 33,37 **** <BODY> The nodeDecorators package contains classes that use the Decorator pattern. ! The nodeDecorators package contains example decorators that alter node behaviour. For example, the DecodingNode class overrides the toPlainTextString() method of all nodes it wraps and applies the Translate class decode() method to the --- 33,41 ---- <BODY> The nodeDecorators package contains classes that use the Decorator pattern. ! <p><b>Deprecated.</b> <i>Use either prototypes or dynamic proxies instead.<br> ! Use either direct subclasses of the appropriate node and set them on the ! {@link org.htmlparser.PrototypicalNodeFactory PrototypicalNodeFactory}, ! or use a dynamic proxy implementing the required node type interface.</i></p> ! <p>The nodeDecorators package contains example decorators that alter node behaviour. For example, the DecodingNode class overrides the toPlainTextString() method of all nodes it wraps and applies the Translate class decode() method to the *************** *** 48,54 **** System.out.println (content.toString ()); </pre> ! Decorators are a powerful way of performing the same operation on every node. ! <pre> ! </pre> </BODY> </HTML> --- 52,58 ---- System.out.println (content.toString ()); </pre> ! Decorators are a powerful way of performing the same operation on every node.</p> ! @see org.htmlparser.StringNodeFactory ! @see org.htmlparser.nodeDecorators.AbstractNodeDecorator </BODY> </HTML> Index: DecodingNode.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/nodeDecorators/DecodingNode.java,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** DecodingNode.java 24 May 2004 16:18:18 -0000 1.16 --- DecodingNode.java 10 Apr 2005 23:20:43 -0000 1.17 *************** *** 30,33 **** --- 30,40 ---- import org.htmlparser.util.Translate; + /** + * @deprecated Use direct subclasses or dynamic proxies instead. + * <p>Use either direct subclasses of the appropriate node and set them on the + * {@link org.htmlparser.PrototypicalNodeFactory PrototypicalNodeFactory}, + * or use a dynamic proxy implementing the required node type interface.</p> + * @see AbstractNodeDecorator + */ public class DecodingNode extends AbstractNodeDecorator { public DecodingNode(Text node) { Index: AbstractNodeDecorator.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/nodeDecorators/AbstractNodeDecorator.java,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** AbstractNodeDecorator.java 2 Jul 2004 00:49:27 -0000 1.22 --- AbstractNodeDecorator.java 10 Apr 2005 23:20:43 -0000 1.23 *************** *** 35,38 **** --- 35,129 ---- import org.htmlparser.visitors.NodeVisitor; + /** + * Node wrapping base class. + * @deprecated Use direct subclasses or dynamic proxies instead. + * <p>Use either direct subclasses of the appropriate node and set them on the + * {@link org.htmlparser.PrototypicalNodeFactory PrototypicalNodeFactory}, + * or use a dynamic proxy implementing the required node type interface. + * In the former case this avoids the wrapping and delegation, while the latter + * case handles the wrapping and delegation without this class.</p> + * <p>Here is an example of how to use dynamic proxies to accomplish the same + * effect as using decorators to wrap Text nodes: + * <pre> + import java.lang.reflect.InvocationHandler; + import java.lang.reflect.InvocationTargetException; + import java.lang.reflect.Method; + import java.lang.reflect.Proxy; + + import org.htmlparser.Parser; + import org.htmlparser.PrototypicalNodeFactory; + import org.htmlparser.Text; + import org.htmlparser.nodes.TextNode; + import org.htmlparser.util.ParserException; + + public class TextProxy + implements + InvocationHandler + { + protected Object mObject; + + public static Object newInstance (Object object) + { + Class cls; + + cls = object.getClass (); + return (Proxy.newProxyInstance ( + cls.getClassLoader (), + cls.getInterfaces (), + new TextProxy (object))); + } + + private TextProxy (Object object) + { + mObject = object; + } + + public Object invoke (Object proxy, Method m, Object[] args) + throws Throwable + { + Object result; + String name; + try + { + result = m.invoke (mObject, args); + name = m.getName (); + if (name.equals ("clone")) + result = newInstance (result); // wrap the cloned object + else if (name.equals ("doSemanticAction")) // or other methods + System.out.println (mObject); // do the needful on the TextNode + } + catch (InvocationTargetException e) + { + throw e.getTargetException (); + } + catch (Exception e) + { + throw new RuntimeException ("unexpected invocation exception: " + + e.getMessage()); + } + finally + { + } + + return (result); + } + + public static void main (String[] args) + throws + ParserException + { + // create the wrapped text node and set it as the prototype + Text text = (Text) TextProxy.newInstance (new TextNode (null, 0, 0)); + PrototypicalNodeFactory factory = new PrototypicalNodeFactory (); + factory.setTextPrototype (text); + // perform the parse + Parser parser = new Parser (args[0]); + parser.setNodeFactory (factory); + parser.parse (null); + } + } + * </pre> + * </p> + */ public abstract class AbstractNodeDecorator implements Text { *************** *** 65,76 **** } - public int elementBegin() { - return delegate.elementBegin(); - } - - public int elementEnd() { - return delegate.elementEnd(); - } - /** * Gets the starting position of the node. --- 156,159 ---- Index: EscapeCharacterRemovingNode.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/nodeDecorators/EscapeCharacterRemovingNode.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** EscapeCharacterRemovingNode.java 24 May 2004 16:18:18 -0000 1.14 --- EscapeCharacterRemovingNode.java 10 Apr 2005 23:20:43 -0000 1.15 *************** *** 30,33 **** --- 30,40 ---- import org.htmlparser.util.ParserUtils; + /** + * @deprecated Use direct subclasses or dynamic proxies instead. + * <p>Use either direct subclasses of the appropriate node and set them on the + * {@link org.htmlparser.PrototypicalNodeFactory PrototypicalNodeFactory}, + * or use a dynamic proxy implementing the required node type interface.</p> + * @see AbstractNodeDecorator + */ public class EscapeCharacterRemovingNode extends AbstractNodeDecorator { public EscapeCharacterRemovingNode(Text newDelegate) { |
From: Derrick O. <der...@us...> - 2005-04-10 23:21:42
|
Update of /cvsroot/htmlparser/htmlparser/src/org/htmlparser/http In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30655/htmlparser/src/org/htmlparser/http Modified Files: ConnectionManager.java ConnectionMonitor.java Cookie.java package.html Log Message: Documentation revamp part one. Deprecated node decorators. Added doSemanticAction for Text and Comment nodes. Added missing sitecapturer scripts. Fixed DOS batch files to work when called from any location. Index: package.html =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/http/package.html,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** package.html 2 Sep 2004 02:28:15 -0000 1.1 --- package.html 10 Apr 2005 23:20:43 -0000 1.2 *************** *** 76,98 **** { public void preConnect (HttpURLConnection connection) ! { System.out.println (ConnectionManager.getRequestHeader (connection)); ! } ! public void postConnect (HttpURLConnection connection) ! { System.out.println (ConnectionManager.getResponseHeader (connection)); ! } ! } manager.setMonitor (monitor); // perform the connection Parser parser = new Parser ("http://frehmeat.net"); </pre> ! The ConnectionManager used by the Parser class is actually held by the Page class. ! It is accessible from either the Parser or the Page class via ! <code>getConnectionManager()</code>. It is a static (singleton) instance ! so that subsequent connections made by the parser will use the contents of the ! cookie jar from previous connections. By default, cookie processing is not ! enabled. It can be enabled by either setting a cookie or using ! <code>setCookieProcessingEnabled().</code>. </body> </html> --- 76,100 ---- { public void preConnect (HttpURLConnection connection) ! { System.out.println (ConnectionManager.getRequestHeader (connection)); ! } ! public void postConnect (HttpURLConnection connection) ! { System.out.println (ConnectionManager.getResponseHeader (connection)); ! } ! }; manager.setMonitor (monitor); // perform the connection Parser parser = new Parser ("http://frehmeat.net"); </pre> ! The ConnectionManager used by the Parser class is actually held by the ! {@link org.htmlparser.lexer.Page#mConnectionManager Page} class. ! It is accessible from the Parser (or the Page class) via ! {@link org.htmlparser.Parser#getConnectionManager getConnectionManager()}. ! It is a static (singleton) instance so that subsequent connections made by the ! parser will use the contents of the cookie jar from previous connections. ! By default, cookie processing is not enabled. It can be enabled by either ! setting a cookie or using ! {@link org.htmlparser.http.ConnectionManager#setCookieProcessingEnabled setCookieProcessingEnabled()}. </body> </html> Index: Cookie.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/http/Cookie.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Cookie.java 2 Sep 2004 02:28:15 -0000 1.1 --- Cookie.java 10 Apr 2005 23:20:43 -0000 1.2 *************** *** 47,51 **** * Cookies are assigned by servers, using fields added to HTTP response headers. * Cookies are passed back to those servers using fields added to HTTP request ! * headers.Several cookies with the same name can be returned; * they have different path attributes, but those attributes * will not be visible when using "old format" cookies. --- 47,51 ---- * Cookies are assigned by servers, using fields added to HTTP response headers. * Cookies are passed back to those servers using fields added to HTTP request ! * headers. Several cookies with the same name can be returned; * they have different path attributes, but those attributes * will not be visible when using "old format" cookies. *************** *** 116,128 **** * The path for the cookie is set to the root ("/") and there is no * expiry time set. ! * @param name ! * name of the cookie ! * @param value ! * value of the cookie ! * @throws IllegalArgumentException * if the cookie name is not an HTTP/1.1 "token", or if it is * one of the tokens reserved for use by the cookie protocol */ public Cookie (String name, String value) { if (!isToken (name) || name.equalsIgnoreCase ("Comment") // rfc2019 --- 116,128 ---- * The path for the cookie is set to the root ("/") and there is no * expiry time set. ! * @param name The name of the cookie. ! * @param value The value of the cookie. ! * @exception IllegalArgumentException * if the cookie name is not an HTTP/1.1 "token", or if it is * one of the tokens reserved for use by the cookie protocol */ public Cookie (String name, String value) + throws + IllegalArgumentException { if (!isToken (name) || name.equalsIgnoreCase ("Comment") // rfc2019 *************** *** 149,153 **** * cookie's purpose will be described using this comment. This is not * supported by version zero cookies. ! * * @see #getComment */ --- 149,153 ---- * cookie's purpose will be described using this comment. This is not * supported by version zero cookies. ! * @param purpose The cookie comment. * @see #getComment */ *************** *** 160,165 **** * Returns the comment describing the purpose of this cookie, or null if no * such comment has been defined. - * * @see #setComment */ public String getComment () --- 160,165 ---- * Returns the comment describing the purpose of this cookie, or null if no * such comment has been defined. * @see #setComment + * @return The cookie comment, or <code>null</code> if none. */ public String getComment () *************** *** 175,180 **** * cookie. By default, cookies are only returned to the host which saved * them. - * * @see #getDomain */ public void setDomain (String pattern) --- 175,181 ---- * cookie. By default, cookies are only returned to the host which saved * them. * @see #getDomain + * @param pattern The domain name pattern. The pattern is converted to + * lower case to accommodate less capable browsers. */ public void setDomain (String pattern) *************** *** 185,189 **** /** * Returns the domain of this cookie. ! * * @see #setDomain */ --- 186,190 ---- /** * Returns the domain of this cookie. ! * @return The cookie domain (the base URL name it applies to). * @see #setDomain */ *************** *** 198,202 **** * the cookie is not stored persistently, and will be deleted when the user * agent (web browser) exits. ! * * @see #getExpiryDate */ --- 199,204 ---- * the cookie is not stored persistently, and will be deleted when the user * agent (web browser) exits. ! * @param expiry The expiry date for this cookie, or <code>null</code> if ! * the cookie is persistent. * @see #getExpiryDate */ *************** *** 210,214 **** * null is returned, indicating the default behaviour described * with <em>setExpiryDate</em>. ! * * @see #setExpiryDate */ --- 212,216 ---- * null is returned, indicating the default behaviour described * with <em>setExpiryDate</em>. ! * @return The cookie expiry date, or <code>null</code> if it is persistent. * @see #setExpiryDate */ *************** *** 224,228 **** * and in subdirectories, can all see the cookie unless a different path is * set. ! * * @see #getPath */ --- 226,230 ---- * and in subdirectories, can all see the cookie unless a different path is * set. ! * @param uri The exclusion prefix for the cookie. * @see #getPath */ *************** *** 234,238 **** /** * Returns the prefix of all URLs for which this cookie is targetted. ! * * @see #setPath */ --- 236,240 ---- /** * Returns the prefix of all URLs for which this cookie is targetted. ! * @return The cookie path (or "/" if no specific path is specified). * @see #setPath */ *************** *** 246,251 **** * secure protocol (https). This should only be set when the cookie's * originating server used a secure protocol to set the cookie's value. - * * @see #getSecure */ public void setSecure (boolean flag) --- 248,254 ---- * secure protocol (https). This should only be set when the cookie's * originating server used a secure protocol to set the cookie's value. * @see #getSecure + * @param flag Use <code>true</code> if the cookie is to be sent using + * secure protocols, <code>false</code> otherwise. */ public void setSecure (boolean flag) *************** *** 256,260 **** /** * Returns the value of the 'secure' flag. ! * * @see #setSecure */ --- 259,264 ---- /** * Returns the value of the 'secure' flag. ! * @return The <code>true</code> if this cookie should only be sent using ! * a secure protocol, <code>false</code> otherwise. * @see #setSecure */ *************** *** 267,270 **** --- 271,275 ---- * Returns the name of the cookie. This name may not be changed after the * cookie is created. + * @return The name of the cookie. */ public String getName () *************** *** 276,287 **** * Sets the value of the cookie. BASE64 encoding is suggested for use with * binary values. ! * ! * <P> ! * With version zero cookies, you need to be careful about the kinds of * values you use. Values with various special characters (whitespace, * brackets and parentheses, the equals sign, comma, double quote, slashes, * question marks, the "at" sign, colon, and semicolon) should be avoided. ! * Empty values may not behave the same way on all browsers. ! * * @see #getValue */ --- 281,290 ---- * Sets the value of the cookie. BASE64 encoding is suggested for use with * binary values. ! * <p>With version zero cookies, you need to be careful about the kinds of * values you use. Values with various special characters (whitespace, * brackets and parentheses, the equals sign, comma, double quote, slashes, * question marks, the "at" sign, colon, and semicolon) should be avoided. ! * Empty values may not behave the same way on all browsers.</p> ! * @param newValue The new value for the cookie. * @see #getValue */ *************** *** 293,297 **** /** * Returns the value of the cookie. ! * * @see #setValue */ --- 296,300 ---- /** * Returns the value of the cookie. ! * @return The cookie value. * @see #setValue */ *************** *** 307,312 **** * interoperability. Cookies provided by a user agent will identify the * cookie version used by the browser. - * * @see #setVersion */ public int getVersion () --- 310,315 ---- * interoperability. Cookies provided by a user agent will identify the * cookie version used by the browser. * @see #setVersion + * @return The cookie version. */ public int getVersion () *************** *** 319,323 **** * itself. Since the IETF standards are still being finalized, consider * version 1 as experimental; do not use it (yet) on production sites. ! * * @see #getVersion */ --- 322,326 ---- * itself. Since the IETF standards are still being finalized, consider * version 1 as experimental; do not use it (yet) on production sites. ! * @param version The version of the cookie, either 0 or 1. * @see #getVersion */ *************** *** 329,332 **** --- 332,339 ---- /* * Return true iff the string counts as an HTTP/1.1 "token". + * Valid tokens cannot have characters outside the ASCII range 0x20-0x7e, + * and cannot contain any of these characters: "()<>@,;:\\\"/[]?={} \t". + * @return The <code>true</code> if the provided string is a valid + * token, <code>false</code> otherwise. */ private boolean isToken (String value) *************** *** 351,354 **** --- 358,362 ---- /** * Returns a copy of this object. + * @return The clone of this cookie. */ public Object clone () Index: ConnectionMonitor.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/http/ConnectionMonitor.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ConnectionMonitor.java 2 Sep 2004 02:28:15 -0000 1.1 --- ConnectionMonitor.java 10 Apr 2005 23:20:43 -0000 1.2 *************** *** 42,60 **** * connection, to alter the request method for example. * @param connection The connection which is about to be connected. ! * @exception This exception is thrown if the connection monitor ! * wants the ConnectionManager to bail out. */ void preConnect (HttpURLConnection connection) throws ! ParserException; /** Called just after calling connect. * The response code and header fields can be examined. * @param connection The connection that was just connected. ! * @exception This exception is thrown if the connection monitor ! * wants the ConnectionManager to bail out. */ void postConnect (HttpURLConnection connection) throws ! ParserException; } --- 42,60 ---- * connection, to alter the request method for example. * @param connection The connection which is about to be connected. ! * @exception ParserException This exception is thrown if the connection ! * monitor wants the ConnectionManager to bail out. */ void preConnect (HttpURLConnection connection) throws ! ParserException; /** Called just after calling connect. * The response code and header fields can be examined. * @param connection The connection that was just connected. ! * @exception ParserException This exception is thrown if the connection ! * monitor wants the ConnectionManager to bail out. */ void postConnect (HttpURLConnection connection) throws ! ParserException; } Index: ConnectionManager.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/http/ConnectionManager.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ConnectionManager.java 12 Mar 2005 11:52:21 -0000 1.2 --- ConnectionManager.java 10 Apr 2005 23:20:43 -0000 1.3 *************** *** 166,169 **** --- 166,173 ---- * A String-to-String map of header keys and values. * These fields are set by the parser when creating a connection. + * @return The default set of request header properties that will + * currently be used. + * @see #mDefaultRequestProperties + * @see #setRequestProperties */ public static Hashtable getDefaultRequestProperties () *************** *** 182,186 **** * connection is fetched. Setting these request header fields affects all * subsequent connections opened by the parser. For more direct control ! * create a <code>URLConnection</code> and set it on the parser.<p> * From <a href="http://www.ietf.org/rfc/rfc2616.txt">RFC 2616 Hypertext Transfer Protocol -- HTTP/1.1</a>: * <pre> --- 186,191 ---- * connection is fetched. Setting these request header fields affects all * subsequent connections opened by the parser. For more direct control ! * create a <code>URLConnection</code> massage it the way you want and ! * then set it on the parser.<p> * From <a href="http://www.ietf.org/rfc/rfc2616.txt">RFC 2616 Hypertext Transfer Protocol -- HTTP/1.1</a>: * <pre> *************** *** 220,223 **** --- 225,232 ---- * entity-header fields. * </pre> + * @param properties The new set of default request header properties to + * use. This affects all subsequently created connections. + * @see #mDefaultRequestProperties + * @see #setRequestProperties */ public static void setDefaultRequestProperties (Hashtable properties) *************** *** 321,324 **** --- 330,334 ---- * A String-to-String map of header keys and values, * excluding proxy items, cookies and URL authorization. + * @return The request header properties for this connection manager. */ public Hashtable getRequestProperties () *************** *** 344,347 **** --- 354,358 ---- /** + * Get the proxy host name, if any. * @return Returns the proxy host. */ *************** *** 352,357 **** /** * @param host The host to use for proxy access. ! * <em>Note: You must also set the proxy port.</em> */ public void setProxyHost (String host) --- 363,369 ---- /** + * Set the proxy host to use. * @param host The host to use for proxy access. ! * <em>Note: You must also set the proxy {@link #setProxyPort port}.</em> */ public void setProxyHost (String host) *************** *** 361,364 **** --- 373,377 ---- /** + * Get the proxy port number. * @return Returns the proxy port. */ *************** *** 369,373 **** --- 382,388 ---- /** + * Set the proxy port number. * @param port The proxy port. + * <em>Note: You must also set the proxy {@link #setProxyHost host}.</em> */ public void setProxyPort (int port) *************** *** 377,380 **** --- 392,396 ---- /** + * Get the user name for proxy authorization, if any. * @return Returns the proxy user, * or <code>null</code> if no proxy authorization is required. *************** *** 386,389 **** --- 402,406 ---- /** + * Set the user name for proxy authorization. * @param user The proxy user name. * <em>Note: You must also set the proxy {@link #setProxyPassword password}.</em> *************** *** 395,398 **** --- 412,416 ---- /** + * Set the proxy user's password. * @return Returns the proxy password. */ *************** *** 403,407 **** --- 421,427 ---- /** + * Get the proxy user's password. * @param password The password for the proxy user. + * <em>Note: You must also set the proxy {@link #setProxyUser user}.</em> */ public void setProxyPassword (String password) *************** *** 411,414 **** --- 431,435 ---- /** + * Get the user name to access the URL. * @return Returns the username that will be used to access the URL, * or <code>null</code> if no authorization is required. *************** *** 420,423 **** --- 441,445 ---- /** + * Set the user name to access the URL. * @param user The user name for accessing the URL. * <em>Note: You must also set the {@link #setPassword password}.</em> *************** *** 429,432 **** --- 451,455 ---- /** + * Get the URL users's password. * @return Returns the URL password. */ *************** *** 437,440 **** --- 460,464 ---- /** + * Set the URL users's password. * @param password The password for the URL. */ *************** *** 514,525 **** /** * @return Returns the monitor, or null if none has been assigned. */ public ConnectionMonitor getMonitor () { ! return mMonitor; } /** * @param monitor The monitor to set. */ --- 538,551 ---- /** + * Get the monitoring object, if any. * @return Returns the monitor, or null if none has been assigned. */ public ConnectionMonitor getMonitor () { ! return (mMonitor); } /** + * Set the monitoring object. * @param monitor The monitor to set. */ *************** *** 532,535 **** --- 558,562 ---- * Opens a connection using the given url. * @param url The url to open. + * @return The connection. * @exception ParserException if an i/o exception occurs accessing the url. */ *************** *** 775,778 **** --- 802,806 ---- * Embedded spaces are silently converted to %20 sequences. * @param string The name of a file or a url. + * @return The connection. * @exception ParserException if the string is not a valid url or file. */ *************** *** 1018,1021 **** --- 1046,1050 ---- /** * Check for cookie and parse into cookie jar. + * @param connection The connection to extract cookie information from. */ public void parseCookies (URLConnection connection) *************** *** 1134,1137 **** --- 1163,1171 ---- } + /** + * Save the cookies received in the response header. + * @param list The list of cookies extracted from the response header. + * @param connection The connection (used when a cookie has no domain). + */ protected void saveCookies (Vector list, URLConnection connection) { |
From: Derrick O. <der...@us...> - 2005-04-10 23:21:38
|
Update of /cvsroot/htmlparser/htmlparser/src/org/htmlparser/filters In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30655/htmlparser/src/org/htmlparser/filters Modified Files: AndFilter.java CssSelectorNodeFilter.java HasAttributeFilter.java HasChildFilter.java HasParentFilter.java HasSiblingFilter.java LinkRegexFilter.java LinkStringFilter.java NodeClassFilter.java NotFilter.java OrFilter.java RegexFilter.java TagNameFilter.java Log Message: Documentation revamp part one. Deprecated node decorators. Added doSemanticAction for Text and Comment nodes. Added missing sitecapturer scripts. Fixed DOS batch files to work when called from any location. Index: AndFilter.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/filters/AndFilter.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** AndFilter.java 13 Feb 2005 20:36:00 -0000 1.2 --- AndFilter.java 10 Apr 2005 23:20:43 -0000 1.3 *************** *** 95,98 **** --- 95,100 ---- * Accept nodes that are acceptable to all of it's predicate filters. * @param node The node to check. + * @return <code>true</code> if all the predicate filters find the node + * is acceptable, <code>false</code> otherwise. */ public boolean accept (Node node) Index: RegexFilter.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/filters/RegexFilter.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** RegexFilter.java 13 Feb 2005 20:36:00 -0000 1.2 --- RegexFilter.java 10 Apr 2005 23:20:43 -0000 1.3 *************** *** 54,58 **** * </pre> * which matches a date in yyyy-mm-dd format between 1900-01-01 and 2099-12-31, ! * with a choice of five separators, dash, space, either slash or a period. * The year is matched by (19|20)\d\d which uses alternation to allow the * either 19 or 20 as the first two digits. The round brackets are mandatory. --- 54,59 ---- * </pre> * which matches a date in yyyy-mm-dd format between 1900-01-01 and 2099-12-31, ! * with a choice of five separators, either a dash, a space, either kind of ! * slash or a period. * The year is matched by (19|20)\d\d which uses alternation to allow the * either 19 or 20 as the first two digits. The round brackets are mandatory. *************** *** 174,177 **** --- 175,180 ---- * Accept string nodes that match the regular expression. * @param node The node to check. + * @return <code>true</code> if the regular expression matches the + * text of the node, <code>false</code> otherwise. */ public boolean accept (Node node) Index: HasParentFilter.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/filters/HasParentFilter.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** HasParentFilter.java 13 Feb 2005 20:36:00 -0000 1.6 --- HasParentFilter.java 10 Apr 2005 23:20:43 -0000 1.7 *************** *** 128,131 **** --- 128,133 ---- * filter. * @param node The node to check. + * @return <code>true</code> if the node has an acceptable parent, + * <code>false</code> otherwise. */ public boolean accept (Node node) Index: LinkStringFilter.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/filters/LinkStringFilter.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** LinkStringFilter.java 6 Apr 2005 10:20:23 -0000 1.1 --- LinkStringFilter.java 10 Apr 2005 23:20:43 -0000 1.2 *************** *** 38,42 **** --- 38,49 ---- public class LinkStringFilter implements NodeFilter { + /** + * The pattern to search for in the link. + */ protected String mPattern; + + /** + * Flag indicating case sensitive/insensitive search. + */ protected boolean mCaseSensitive; Index: LinkRegexFilter.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/filters/LinkRegexFilter.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** LinkRegexFilter.java 6 Apr 2005 10:20:23 -0000 1.1 --- LinkRegexFilter.java 10 Apr 2005 23:20:43 -0000 1.2 *************** *** 40,43 **** --- 40,46 ---- public class LinkRegexFilter implements NodeFilter { + /** + * The regular expression to use on the link. + */ protected Pattern mRegex; *************** *** 47,51 **** * @param regexPattern The pattern to match. */ ! public LinkRegexFilter (String regexPattern) throws Exception { this (regexPattern, true); --- 50,54 ---- * @param regexPattern The pattern to match. */ ! public LinkRegexFilter (String regexPattern) { this (regexPattern, true); *************** *** 58,62 **** * @param caseSensitive Specifies case sensitivity for the matching process. */ ! public LinkRegexFilter (String regexPattern, boolean caseSensitive) throws Exception { if (caseSensitive) --- 61,65 ---- * @param caseSensitive Specifies case sensitivity for the matching process. */ ! public LinkRegexFilter (String regexPattern, boolean caseSensitive) { if (caseSensitive) Index: OrFilter.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/filters/OrFilter.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** OrFilter.java 13 Feb 2005 20:36:00 -0000 1.2 --- OrFilter.java 10 Apr 2005 23:20:43 -0000 1.3 *************** *** 93,96 **** --- 93,98 ---- * Accept nodes that are acceptable to any of it's predicate filters. * @param node The node to check. + * @return <code>true</code> if any of the predicate filters find the node + * is acceptable, <code>false</code> otherwise. */ public boolean accept (Node node) Index: HasChildFilter.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/filters/HasChildFilter.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** HasChildFilter.java 13 Feb 2005 20:36:00 -0000 1.3 --- HasChildFilter.java 10 Apr 2005 23:20:43 -0000 1.4 *************** *** 34,37 **** --- 34,40 ---- /** * This class accepts all tags that have a child acceptable to the filter. + * It can be set to operate recursively, that is perform a scan down + * through the node heirarchy in a breadth first traversal looking for any + * descendant that matches the predicate filter (which stops the search). */ public class HasChildFilter *************** *** 123,126 **** --- 126,131 ---- * Accept tags with children acceptable to the filter. * @param node The node to check. + * @return <code>true</code> if the node has an acceptable child, + * <code>false</code> otherwise. */ public boolean accept (Node node) Index: HasSiblingFilter.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/filters/HasSiblingFilter.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** HasSiblingFilter.java 13 Feb 2005 20:36:00 -0000 1.1 --- HasSiblingFilter.java 10 Apr 2005 23:20:43 -0000 1.2 *************** *** 85,88 **** --- 85,90 ---- * Accept tags with a sibling acceptable to the filter. * @param node The node to check. + * @return <code>true</code> if the node has an acceptable sibling, + * <code>false</code> otherwise. */ public boolean accept (Node node) Index: CssSelectorNodeFilter.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/filters/CssSelectorNodeFilter.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** CssSelectorNodeFilter.java 17 Jul 2004 13:45:04 -0000 1.4 --- CssSelectorNodeFilter.java 10 Apr 2005 23:20:43 -0000 1.5 *************** *** 72,75 **** --- 72,79 ---- private NodeFilter therule; + /** + * Create a Cascading Style Sheet node filter. + * @param selector The selector expression. + */ public CssSelectorNodeFilter(String selector) { *************** *** 79,85 **** } ! public boolean accept(Node n) { ! return therule.accept(n); } --- 83,95 ---- } ! /** ! * Accept nodes that match the selector expression. ! * @param node The node to check. ! * @return <code>true</code> if the node matches, ! * <code>false</code> otherwise. ! */ ! public boolean accept(Node node) { ! return therule.accept(node); } *************** *** 235,241 **** if ("~=".equals(rel) && val != null) n = new AttribMatchFilter(unescape(attrib), ! "\\b" ! + val.replaceAll("([^a-zA-Z0-9])", "\\\\$1") ! + "\\b"); else if ("=".equals(rel) && val != null) n = new HasAttributeFilter(attrib, val); --- 245,251 ---- if ("~=".equals(rel) && val != null) n = new AttribMatchFilter(unescape(attrib), ! "\\b" ! + val.replaceAll("([^a-zA-Z0-9])", "\\\\$1") ! + "\\b"); else if ("=".equals(rel) && val != null) n = new HasAttributeFilter(attrib, val); *************** *** 249,252 **** --- 259,268 ---- } + /** + * Replace escape sequences in a string. + * @param escaped The string to examine. + * @return The argument with escape sequences replaced by their + * equivalent character. + */ public static String unescape(String escaped) { *************** *** 258,262 **** if (m.group(1) != null) m.appendReplacement(result, ! String.valueOf((char)Integer.parseInt(m.group(1), 16))); else if (m.group(2) != null) m.appendReplacement(result, m.group(2)); --- 274,278 ---- if (m.group(1) != null) m.appendReplacement(result, ! String.valueOf((char)Integer.parseInt(m.group(1), 16))); else if (m.group(2) != null) m.appendReplacement(result, m.group(2)); Index: TagNameFilter.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/filters/TagNameFilter.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** TagNameFilter.java 13 Feb 2005 20:36:00 -0000 1.4 --- TagNameFilter.java 10 Apr 2005 23:20:43 -0000 1.5 *************** *** 87,90 **** --- 87,92 ---- * The end tags are available on the enclosing non-end tag. * @param node The node to check. + * @return <code>true</code> if the tag name matches, + * <code>false</code> otherwise. */ public boolean accept (Node node) Index: HasAttributeFilter.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/filters/HasAttributeFilter.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** HasAttributeFilter.java 13 Feb 2005 20:36:00 -0000 1.5 --- HasAttributeFilter.java 10 Apr 2005 23:20:43 -0000 1.6 *************** *** 119,122 **** --- 119,124 ---- * Accept tags with a certain attribute. * @param node The node to check. + * @return <code>true</code> if the node has the attribute + * (and value if that is being checked too), <code>false</code> otherwise. */ public boolean accept (Node node) Index: NodeClassFilter.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/filters/NodeClassFilter.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** NodeClassFilter.java 13 Feb 2005 20:36:00 -0000 1.2 --- NodeClassFilter.java 10 Apr 2005 23:20:43 -0000 1.3 *************** *** 78,81 **** --- 78,83 ---- * Accept nodes that are assignable from the class provided in the constructor. * @param node The node to check. + * @return <code>true</code> if the node is the right class, + * <code>false</code> otherwise. */ public boolean accept (Node node) Index: NotFilter.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/filters/NotFilter.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** NotFilter.java 13 Feb 2005 22:45:47 -0000 1.3 --- NotFilter.java 10 Apr 2005 23:20:43 -0000 1.4 *************** *** 85,88 **** --- 85,90 ---- * Accept nodes that are not acceptable to the predicate filter. * @param node The node to check. + * @return <code>true</code> if the node is not acceptable to the + * predicate filter, <code>false</code> otherwise. */ public boolean accept (Node node) |
Update of /cvsroot/htmlparser/htmlparser/src/org/htmlparser/beans In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30655/htmlparser/src/org/htmlparser/beans Modified Files: BeanyBaby.java FilterBean.java HTMLLinkBean.java HTMLTextBean.java LinkBean.java StringBean.java package.html Log Message: Documentation revamp part one. Deprecated node decorators. Added doSemanticAction for Text and Comment nodes. Added missing sitecapturer scripts. Fixed DOS batch files to work when called from any location. Index: package.html =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/beans/package.html,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** package.html 2 Jan 2004 16:24:53 -0000 1.19 --- package.html 10 Apr 2005 23:20:42 -0000 1.20 *************** *** 30,45 **** </head> <body bgcolor="white"> ! The beans package contains Java Beans that can integrate within IDEs. ! There are visual and non-visual beans, the former follow the naming pattern HTMLxxx. - BeanyBaby is an example application using these beans. - - <h2>Related Documentation</h2> - - For overviews, tutorials, examples, guides, and tool documentation, please see: <ul> ! <li><a href="http://htmlparser.sourceforge.net">HTML Parser Home Page</a> </ul> ! <!-- Put @see and @since tags down here. --> --- 30,53 ---- </head> <body bgcolor="white"> ! The beans package contains Java Beans using the HTML Parser. ! <p>There are visual and non-visual beans, the former follow the naming pattern HTMLxxx. <ul> ! <li>{@link org.htmlparser.beans.BeanyBaby} is an example application using the StringBean and LinkBean.</li> ! <li>{@link org.htmlparser.beans.FilterBean} is a bean accepting a filter and returning a ! {@link org.htmlparser.util.NodeList NodeList}.</li> ! <li>{@link org.htmlparser.beans.LinkBean} is a bean returning an array of URLs from a page.</li> ! <li>{@link org.htmlparser.beans.StringBean} is a bean returning the text of a page.</li> ! <li>{@link org.htmlparser.beans.HTMLLinkBean} is a GUI bean showing the URLs from a page.</li> ! <li>{@link org.htmlparser.beans.HTMLStringBean} is a GUI bean showing the text of a page.</li> </ul> ! </p> ! <p>For a quick look at the output of these beans, run beanybaby or filterbuilder: ! <pre> ! <code> ! bin/beanybaby [url] ! bin/filterbuilder [url] ! </code> ! </pre> <!-- Put @see and @since tags down here. --> Index: HTMLLinkBean.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/beans/HTMLLinkBean.java,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** HTMLLinkBean.java 2 Jan 2004 16:24:53 -0000 1.21 --- HTMLLinkBean.java 10 Apr 2005 23:20:42 -0000 1.22 *************** *** 73,76 **** --- 73,77 ---- /** * Return the minimum dimension for this visible bean. + * @return a minimum bounding box for this bean. */ public Dimension getMinimumSize () Index: FilterBean.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/beans/FilterBean.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** FilterBean.java 13 Feb 2005 20:36:03 -0000 1.1 --- FilterBean.java 10 Apr 2005 23:20:42 -0000 1.2 *************** *** 40,47 **** --- 40,51 ---- /** * Extract nodes from a URL using a filter. + * <pre> + * <code> * FilterBean fb = new FilterBean ("http://cbc.ca"); * fb.setFilters (new NodeFilter[] { new TagNameFilter ("META") }); * fb.setURL ("http://cbc.ca"); * System.out.println (fb.getNodes ().toHtml ()); + * </code> + * </pre> */ public class FilterBean Index: HTMLTextBean.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/beans/HTMLTextBean.java,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** HTMLTextBean.java 2 Jan 2004 16:24:53 -0000 1.22 --- HTMLTextBean.java 10 Apr 2005 23:20:42 -0000 1.23 *************** *** 59,62 **** --- 59,63 ---- /** * Return the minimum dimension for this visible bean. + * @return a minimum bounding box for this bean. */ public Dimension getMinimumSize () Index: LinkBean.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/beans/LinkBean.java,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** LinkBean.java 12 Mar 2005 21:39:45 -0000 1.30 --- LinkBean.java 10 Apr 2005 23:20:42 -0000 1.31 *************** *** 86,89 **** --- 86,94 ---- // + /** + * Internal routine to extract all the links from the parser. + * @return A list of all links on the page as URLs. + * @exception ParserException If the parse fails. + */ protected URL[] extractLinks () throws ParserException { Index: StringBean.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/beans/StringBean.java,v retrieving revision 1.42 retrieving revision 1.43 diff -C2 -d -r1.42 -r1.43 *** StringBean.java 12 Mar 2005 12:52:19 -0000 1.42 --- StringBean.java 10 Apr 2005 23:20:42 -0000 1.43 *************** *** 275,278 **** --- 275,279 ---- * Extract the text from a page. * @return The textual contents of the page. + * @exception ParserException If a parse error occurs. */ protected String extractStrings () *************** *** 630,633 **** --- 631,635 ---- * Appends a newline to the output if the tag breaks flow, and * possibly sets the state of the PRE and SCRIPT flags. + * @param tag The tag to examine. */ public void visitTag (Tag tag) Index: BeanyBaby.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/beans/BeanyBaby.java,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** BeanyBaby.java 12 Mar 2005 21:39:45 -0000 1.23 --- BeanyBaby.java 10 Apr 2005 23:20:42 -0000 1.24 *************** *** 27,30 **** --- 27,41 ---- package org.htmlparser.beans; + import java.awt.BorderLayout; + import java.awt.Dimension; + import java.awt.Toolkit; + import java.awt.event.ActionEvent; + import java.awt.event.ActionListener; + import java.awt.event.MouseEvent; + import java.awt.event.MouseListener; + import java.awt.event.WindowAdapter; + import java.awt.event.WindowEvent; + import java.beans.PropertyChangeListener; + import javax.swing.JCheckBoxMenuItem; import javax.swing.JMenuItem; *************** *** 39,45 **** javax.swing.JFrame implements ! java.beans.PropertyChangeListener, ! java.awt.event.ActionListener, ! java.awt.event.MouseListener { /** --- 50,56 ---- javax.swing.JFrame implements ! PropertyChangeListener, ! ActionListener, ! MouseListener { /** *************** *** 119,123 **** // ! public void actionPerformed (java.awt.event.ActionEvent event) { Object source; --- 130,141 ---- // ! /** ! * Handles UI events. ! * Changing the URL in the text field, altering a checkbox setting or ! * choosing a menu item winds up here, where the appropriate change ! * is made to the state of the bean. ! * @param event Details about the action. ! */ ! public void actionPerformed (ActionEvent event) { Object source; *************** *** 176,181 **** /** * Invoked when the mouse button has been clicked (pressed and released) on a component. */ ! public void mouseClicked (java.awt.event.MouseEvent event) { int index; --- 194,200 ---- /** * Invoked when the mouse button has been clicked (pressed and released) on a component. + * @param event Details on the mouse event. */ ! public void mouseClicked (MouseEvent event) { int index; *************** *** 192,197 **** /** * Invoked when the mouse enters a component. */ ! public void mouseEntered (java.awt.event.MouseEvent event) { } --- 211,217 ---- /** * Invoked when the mouse enters a component. + * @param event Details on the mouse event. */ ! public void mouseEntered (MouseEvent event) { } *************** *** 199,204 **** /** * Invoked when the mouse exits a component. */ ! public void mouseExited (java.awt.event.MouseEvent event) { } --- 219,225 ---- /** * Invoked when the mouse exits a component. + * @param event Details on the mouse event. */ ! public void mouseExited (MouseEvent event) { } *************** *** 206,211 **** /** * Invoked when a mouse button has been pressed on a component. */ ! public void mousePressed (java.awt.event.MouseEvent event) { } --- 227,233 ---- /** * Invoked when a mouse button has been pressed on a component. + * @param event Details on the mouse event. */ ! public void mousePressed (MouseEvent event) { } *************** *** 213,218 **** /** * Invoked when a mouse button has been released on a component. */ ! public void mouseReleased (java.awt.event.MouseEvent event) { } --- 235,241 ---- /** * Invoked when a mouse button has been released on a component. + * @param event Details on the mouse event. */ ! public void mouseReleased (MouseEvent event) { } *************** *** 221,224 **** --- 244,252 ---- // API control // + + /** + * Set the URL for the bean. + * @param url The URL to use in the bean. + */ public void setURL (String url) { *************** *** 313,319 **** setTitle("BeanyBaby"); ! addWindowListener(new java.awt.event.WindowAdapter() { ! public void windowClosing(java.awt.event.WindowEvent evt) { exitForm(evt); --- 341,347 ---- setTitle("BeanyBaby"); ! addWindowListener(new WindowAdapter() { ! public void windowClosing(WindowEvent evt) { exitForm(evt); *************** *** 321,325 **** }); ! panel.setLayout(new java.awt.BorderLayout()); pane1.setViewportView(mLinkBean); --- 349,353 ---- }); ! panel.setLayout(new BorderLayout()); pane1.setViewportView(mLinkBean); *************** *** 331,349 **** mSplitPane.setRightComponent(pane2); ! panel.add(mSplitPane, java.awt.BorderLayout.CENTER); mTextField.setToolTipText("Enter the URL to view"); ! panel.add(mTextField, java.awt.BorderLayout.SOUTH); ! getContentPane().add(panel, java.awt.BorderLayout.CENTER); pack(); ! java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize(); ! setSize(new java.awt.Dimension(640, 480)); setLocation((screenSize.width-640)/2,(screenSize.height-480)/2); }//GEN-END:initComponents /** Exit the Application */ ! private void exitForm (java.awt.event.WindowEvent evt) {//GEN-FIRST:event_exitForm System.exit (0); --- 359,377 ---- mSplitPane.setRightComponent(pane2); ! panel.add(mSplitPane, BorderLayout.CENTER); mTextField.setToolTipText("Enter the URL to view"); ! panel.add(mTextField, BorderLayout.SOUTH); ! getContentPane().add(panel, BorderLayout.CENTER); pack(); ! Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); ! setSize(new Dimension(640, 480)); setLocation((screenSize.width-640)/2,(screenSize.height-480)/2); }//GEN-END:initComponents /** Exit the Application */ ! private void exitForm (WindowEvent evt) {//GEN-FIRST:event_exitForm System.exit (0); *************** *** 364,367 **** --- 392,396 ---- /** * Unit test. + * @param args [0] The URL to use in the bean (optional). */ public static void main (String[] args) |
Update of /cvsroot/htmlparser/htmlparser/src/org/htmlparser In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30655/htmlparser/src/org/htmlparser Modified Files: Attribute.java Node.java NodeFactory.java PrototypicalNodeFactory.java Remark.java StringNodeFactory.java Tag.java Text.java Log Message: Documentation revamp part one. Deprecated node decorators. Added doSemanticAction for Text and Comment nodes. Added missing sitecapturer scripts. Fixed DOS batch files to work when called from any location. Index: Attribute.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/Attribute.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Attribute.java 13 Feb 2005 22:45:46 -0000 1.4 --- Attribute.java 10 Apr 2005 23:20:42 -0000 1.5 *************** *** 163,173 **** * element's start tag. They may appear in any order.<p> * In this example, the id attribute is set for an H1 element: * <code> ! * <H1 id="section1"> ! * </code> ! * This is an identified heading thanks to the id attribute ! * <code> ! * </H1> * </code> * By default, SGML requires that all attribute values be delimited using * either double quotation marks (ASCII decimal 34) or single quotation --- 163,174 ---- * element's start tag. They may appear in any order.<p> * In this example, the id attribute is set for an H1 element: + * <pre> * <code> ! * {@.html ! * <H1 id="section1"> ! * This is an identified heading thanks to the id attribute ! * </H1>} * </code> + * </pre> * By default, SGML requires that all attribute values be delimited using * either double quotation marks (ASCII decimal 34) or single quotation *************** *** 186,190 **** * Attribute values are generally case-insensitive. The definition of each * attribute in the reference manual indicates whether its value is case-insensitive.<p> ! * All the attributes defined by this specification are listed in the attribute index.<p> * </cite> * <p> --- 187,192 ---- * Attribute values are generally case-insensitive. The definition of each * attribute in the reference manual indicates whether its value is case-insensitive.<p> ! * All the attributes defined by this specification are listed in the ! * <a href="http://www.w3.org/TR/html4/index/attributes.html">attribute index</a>.<p> * </cite> * <p> Index: StringNodeFactory.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/StringNodeFactory.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** StringNodeFactory.java 24 May 2004 16:18:12 -0000 1.12 --- StringNodeFactory.java 10 Apr 2005 23:20:42 -0000 1.13 *************** *** 34,37 **** --- 34,66 ---- import org.htmlparser.nodeDecorators.NonBreakingSpaceConvertingNode; + /** + * @deprecated Use PrototypicalNodeFactory#setTextPrototype(Text) + * <p>A more efficient implementation of affecting all string nodes, is to replace + * the Text node prototype in the {@link PrototypicalNodeFactory} with a + * custom TextNode that performs the required operation.</p> + * <p>For example, if you were using: + * <pre> + * StringNodeFactory factory = new StringNodeFactory(); + * factory.setDecode(true); + * </pre> + * to decode all text issued from + * {@link org.htmlparser.nodes.TextNode#toPlainTextString() Text.toPlainTextString()}, + * you would instead create a subclass of {@link org.htmlparser.nodes.TextNode TextNode} + * and set it as the prototype for text node generation: + * <pre> + * PrototypicalNodeFactory factory = new PrototypicalNodeFactory (); + * factory.setTextPrototype (new TextNode () { + * public String toPlainTextString() + * { + * return (org.htmlparser.util.Translate.decode (super.toPlainTextString ())); + * } + * }); + * </pre> + * Similar constructs apply to removing escapes and converting non-breaking + * spaces, which were the examples previously provided.</p> + * <p>Using a subclass avoids the wrapping and delegation inherent in the + * decorator pattern, with subsequent improvements in processing speed + * and memory usage.</p> + */ public class StringNodeFactory extends Index: Node.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/Node.java,v retrieving revision 1.51 retrieving revision 1.52 diff -C2 -d -r1.51 -r1.52 *** Node.java 2 Jul 2004 00:49:26 -0000 1.51 --- Node.java 10 Apr 2005 23:20:42 -0000 1.52 *************** *** 133,148 **** /** - * Returns the beginning position of the tag. - * <br>deprecated Use {@link #getStartPosition} - */ - public abstract int elementBegin (); - - /** - * Returns the ending position fo the tag - * <br>deprecated Use {@link #getEndPosition} - */ - public abstract int elementEnd (); - - /** * Gets the starting position of the node. * This is the character (not byte) offset of this node in the page. --- 133,136 ---- Index: Tag.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/Tag.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Tag.java 2 Jul 2004 00:49:26 -0000 1.4 --- Tag.java 10 Apr 2005 23:20:42 -0000 1.5 *************** *** 33,38 **** /** ! * Identifies what a Tag such as <XXX xxx yyy="zzz"> can do. ! * Adds features to a Node that are specific to a tag. */ public interface Tag extends Node --- 33,38 ---- /** ! * This interface represents a tag such as <xxx yyy="zzz"> in the HTML document. ! * Adds capabilities to a Node that are specific to a tag. */ public interface Tag extends Node Index: Remark.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/Remark.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Remark.java 24 May 2004 16:18:12 -0000 1.1 --- Remark.java 10 Apr 2005 23:20:42 -0000 1.2 *************** *** 62,73 **** // } // - // public int elementBegin () - // { - // } - // - // public int elementEnd () - // { - // } - // // public org.htmlparser.util.NodeList getChildren () // { --- 62,65 ---- Index: Text.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/Text.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Text.java 24 May 2004 16:18:12 -0000 1.1 --- Text.java 10 Apr 2005 23:20:42 -0000 1.2 *************** *** 64,75 **** // } // - // public int elementBegin () - // { - // } - // - // public int elementEnd () - // { - // } - // // public org.htmlparser.util.NodeList getChildren () // { --- 64,67 ---- Index: NodeFactory.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/NodeFactory.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** NodeFactory.java 24 May 2004 16:18:12 -0000 1.1 --- NodeFactory.java 10 Apr 2005 23:20:42 -0000 1.2 *************** *** 37,50 **** /** * This interface defines the methods needed to create new nodes. ! * The factory is used when lexing to generate the nodes passed ! * back to the caller. */ public interface NodeFactory { /** ! * Create a new string node. * @param page The page the node is on. * @param start The beginning position of the string. * @param end The ending positiong of the string. */ public Text createStringNode (Page page, int start, int end) --- 37,62 ---- /** * This interface defines the methods needed to create new nodes. ! * <p>The factory is used when lexing to generate the nodes passed ! * back to the caller. By implementing this interface, and setting ! * that concrete object as the node factory for the ! * {@link org.htmlparser.lexer.Lexer#setNodeFactory lexer} (perhaps via the ! * {@link Parser#setNodeFactory parser}), the way that nodes are generated ! * can be customized.</p> ! * <p>In general, replacing the factory with a custom factory is not required ! * because of the flexibility of the {@link PrototypicalNodeFactory}.</p> ! * <p>Creation of Text and Remark nodes is straight forward, because essentially ! * they are just sequences of characters extracted from the page. Creation of a ! * Tag node requires that the attributes from the tag be remembered as well. ! * @see PrototypicalNodeFactory */ public interface NodeFactory { /** ! * Create a new text node. * @param page The page the node is on. * @param start The beginning position of the string. * @param end The ending positiong of the string. + * @throws ParserException If there is a problem encountered in creating the node. + * @return A text node comprising the indicated characters from the page. */ public Text createStringNode (Page page, int start, int end) *************** *** 57,60 **** --- 69,74 ---- * @param start The beginning position of the remark. * @param end The ending positiong of the remark. + * @throws ParserException If there is a problem encountered in creating the node. + * @return A remark node comprising the indicated characters from the page. */ public Remark createRemarkNode (Page page, int start, int end) *************** *** 72,75 **** --- 86,91 ---- * @param end The ending positiong of the tag. * @param attributes The attributes contained in this tag. + * @throws ParserException If there is a problem encountered in creating the node. + * @return A tag node comprising the indicated characters from the page. */ public Tag createTagNode (Page page, int start, int end, Vector attributes) Index: PrototypicalNodeFactory.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/PrototypicalNodeFactory.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** PrototypicalNodeFactory.java 31 Jul 2004 16:42:35 -0000 1.13 --- PrototypicalNodeFactory.java 10 Apr 2005 23:20:42 -0000 1.14 *************** *** 40,44 **** import org.htmlparser.Text; import org.htmlparser.lexer.Page; - import org.htmlparser.nodes.AbstractNode; import org.htmlparser.nodes.TextNode; import org.htmlparser.nodes.RemarkNode; --- 40,43 ---- *************** *** 79,93 **** * A node factory based on the prototype pattern. * This factory uses the prototype pattern to generate new nodes. ! * It generates generic text and remark nodes from prototypes accessed ! * via the textPrototype and remarkPrototype properties respectively. ! * These are cloned as needed to form new {@link Text} and {@link Remark} nodes. ! * Prototype tags, in the form of undifferentiated tags are held in a hash * table. On a request for a tag, the attributes are examined for the name ! * of the tag and if a prototype of that name is registered, it is cloned ! * and the clone is given the characteristics ! * {@link Attribute Attributes}, start and end position) of the requested tag. ! * If no tag is registered under the needed name, a generic tag is created. ! * Note that in all casses, the {@link Page} property is only set if the node ! * is a subclass of {@link AbstractNode}. */ public class PrototypicalNodeFactory --- 78,135 ---- * A node factory based on the prototype pattern. * This factory uses the prototype pattern to generate new nodes. ! * These are cloned as needed to form new {@link Text}, {@link Remark} and ! * {@link Tag} nodes.</p> ! * <p>Text and remark nodes are generated from prototypes accessed ! * via the {@link #setTextPrototype(Text) textPrototype} and ! * {@link #setRemarkPrototype(Remark) remarkPrototype} properties respectively. ! * Tag nodes are generated as follows: ! * <p>Prototype tags, in the form of undifferentiated tags, are held in a hash * table. On a request for a tag, the attributes are examined for the name ! * of the tag to be created. If a prototype of that name has been registered ! * (exists in the hash table), it is cloned and the clone is given the ! * characteristics ({@link Attribute Attributes}, start and end position) ! * of the requested tag.</p> ! * <p>In the case that no tag has been registered under that name, ! * a generic tag is created from the prototype acessed via the ! * {@link #setTagPrototype(Tag) tagPrototype} property.</p> ! * <p>The hash table of registered tags can be automatically populated with ! * all the know tags from the {@link org.htmlparser.tags} package when ! * the factory is constructed, or it can start out empty and be populated ! * explicitly.</p> ! * <p>Here is an example of how to override all text issued from ! * {@link org.htmlparser.nodes.TextNode#toPlainTextString() Text.toPlainTextString()}, ! * in this case decoding (converting character references), ! * which illustrates the use of setting the text prototype: ! * <pre> ! * PrototypicalNodeFactory factory = new PrototypicalNodeFactory (); ! * factory.setTextPrototype ( ! * // create a inner class that is a subclass of TextNode ! * new TextNode () { ! * public String toPlainTextString() ! * { ! * return (org.htmlparser.util.Translate.decode (super.toPlainTextString ())); ! * } ! * }); ! * Parser parser = new Parser (); ! * parser.setNodeFactory (factory); ! * </pre></p> ! * <p>Here is an example of using a custom link tag, in this case just ! * printing the URL, which illustrates registering a tag: ! * <pre> ! * ! * class PrintingLinkTag extends LinkTag ! * { ! * public void doSemanticAction () ! * throws ! * ParserException ! * { ! * System.out.println (getLink ()); ! * } ! * } ! * PrototypicalNodeFactory factory = new PrototypicalNodeFactory (); ! * factory.registerTag (new PrintingLinkTag ()); ! * Parser parser = new Parser (); ! * parser.setNodeFactory (factory); ! * </pre></p> */ public class PrototypicalNodeFactory *************** *** 119,122 **** --- 161,166 ---- /** * Create a new factory with all tags registered. + * Equivalent to + * {@link #PrototypicalNodeFactory() PrototypicalNodeFactory(false)}. */ public PrototypicalNodeFactory () *************** *** 126,132 **** /** ! * Create a new factory with no registered tags. * @param empty If <code>true</code>, creates an empty factory, ! * otherwise is equivalent to {@link #PrototypicalNodeFactory()}. */ public PrototypicalNodeFactory (boolean empty) --- 170,176 ---- /** ! * Create a new factory. * @param empty If <code>true</code>, creates an empty factory, ! * otherwise create a new factory with all tags registered. */ public PrototypicalNodeFactory (boolean empty) *************** *** 176,180 **** * Gets a tag from the registry. * @param id The name of the tag to return. ! * @return The tag registered under the <code>id</code> name or <code>null</code> if none. */ public Tag get (String id) --- 220,225 ---- * Gets a tag from the registry. * @param id The name of the tag to return. ! * @return The tag registered under the <code>id</code> name, ! * or <code>null</code> if none. */ public Tag get (String id) *************** *** 186,190 **** * Remove a tag from the registry. * @param id The name of the tag to remove. ! * @return The tag that was registered with that <code>id</code>. */ public Tag remove (String id) --- 231,236 ---- * Remove a tag from the registry. * @param id The name of the tag to remove. ! * @return The tag that was registered with that <code>id</code>, ! * or <code>null</code> if none. */ public Tag remove (String id) *************** *** 212,218 **** /** * Register a tag. ! * Registers the given tag under every id the tag has. ! * @param tag The tag to register (subclass of ! * {@link Tag}). */ public void registerTag (Tag tag) --- 258,264 ---- /** * Register a tag. ! * Registers the given tag under every {@link Tag#getIds() id} that the ! * tag has. ! * @param tag The tag to register. */ public void registerTag (Tag tag) *************** *** 227,233 **** /** * Unregister a tag. ! * Unregisters the given tag from every id the tag has. ! * @param tag The tag to unregister (subclass of ! * {@link Tag}). */ public void unregisterTag (Tag tag) --- 273,278 ---- /** * Unregister a tag. ! * Unregisters the given tag from every {@link Tag#getIds() id} the tag has. ! * @param tag The tag to unregister. */ public void unregisterTag (Tag tag) *************** *** 283,287 **** /** ! * Get the object being used to generate text nodes. * @return The prototype for {@link Text} nodes. */ --- 328,332 ---- /** ! * Get the object that is cloned to generate text nodes. * @return The prototype for {@link Text} nodes. */ *************** *** 294,302 **** * Set the object to be used to generate text nodes. * @param text The prototype for {@link Text} nodes. */ public void setTextPrototype (Text text) { if (null == text) ! throw new IllegalArgumentException ("text prototype node cannot be null"); else mText = text; --- 339,349 ---- * Set the object to be used to generate text nodes. * @param text The prototype for {@link Text} nodes. + * If <code>null</code> the prototype is set to the default + * ({@link TextNode}). */ public void setTextPrototype (Text text) { if (null == text) ! mText = new TextNode (null, 0, 0); else mText = text; *************** *** 304,308 **** /** ! * Get the object being used to generate remark nodes. * @return The prototype for {@link Remark} nodes. */ --- 351,355 ---- /** ! * Get the object that is cloned to generate remark nodes. * @return The prototype for {@link Remark} nodes. */ *************** *** 315,323 **** * Set the object to be used to generate remark nodes. * @param remark The prototype for {@link Remark} nodes. */ public void setRemarkPrototype (Remark remark) { if (null == remark) ! throw new IllegalArgumentException ("remark prototype node cannot be null"); else mRemark = remark; --- 362,372 ---- * Set the object to be used to generate remark nodes. * @param remark The prototype for {@link Remark} nodes. + * If <code>null</code> the prototype is set to the default + * ({@link RemarkNode}). */ public void setRemarkPrototype (Remark remark) { if (null == remark) ! mRemark = new RemarkNode (null, 0, 0); else mRemark = remark; *************** *** 325,331 **** /** ! * Get the object being used to generate generic tag nodes. ! * These are returned from {@link #createTagNode} when no specific tag ! * is found in the registered tag list. * @return The prototype for {@link Tag} nodes. */ --- 374,380 ---- /** ! * Get the object that is cloned to generate tag nodes. ! * Clones of this object are returned from {@link #createTagNode} when no ! * specific tag is found in the list of registered tags. * @return The prototype for {@link Tag} nodes. */ *************** *** 337,348 **** /** * Set the object to be used to generate tag nodes. ! * These are returned from {@link #createTagNode} when no specific tag ! * is found in the registered tag list. * @param tag The prototype for {@link Tag} nodes. */ public void setTagPrototype (Tag tag) { if (null == tag) ! throw new IllegalArgumentException ("tag prototype node cannot be null"); else mTag = tag; --- 386,399 ---- /** * Set the object to be used to generate tag nodes. ! * Clones of this object are returned from {@link #createTagNode} when no ! * specific tag is found in the list of registered tags. * @param tag The prototype for {@link Tag} nodes. + * If <code>null</code> the prototype is set to the default + * ({@link TagNode}). */ public void setTagPrototype (Tag tag) { if (null == tag) ! mTag = new TagNode (null, 0, 0, null); else mTag = tag; *************** *** 358,361 **** --- 409,413 ---- * @param start The beginning position of the string. * @param end The ending position of the string. + * @return A text node comprising the indicated characters from the page. */ public Text createStringNode (Page page, int start, int end) *************** *** 383,386 **** --- 435,439 ---- * @param start The beginning position of the remark. * @param end The ending positiong of the remark. + * @return A remark node comprising the indicated characters from the page. */ public Remark createRemarkNode (Page page, int start, int end) *************** *** 413,420 **** * @param end The ending positiong of the tag. * @param attributes The attributes contained in this tag. */ public Tag createTagNode (Page page, int start, int end, Vector attributes) - throws - ParserException { Attribute attribute; --- 466,472 ---- * @param end The ending positiong of the tag. * @param attributes The attributes contained in this tag. + * @return A tag node comprising the indicated characters from the page. */ public Tag createTagNode (Page page, int start, int end, Vector attributes) { Attribute attribute; |
From: Derrick O. <der...@us...> - 2005-04-10 23:21:11
|
Update of /cvsroot/htmlparser/htmlparser/bin In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30655/htmlparser/bin Added Files: beanybaby.cmd filterbuilder.cmd lexer.cmd linkextractor.cmd parser.cmd sitecapturer sitecapturer.cmd stringextractor.cmd thumbelina.cmd translate.cmd Removed Files: beanybaby.bat filterbuilder.bat lexer.bat linkextractor.bat parser.bat stringextractor.bat thumbelina.bat translate.bat Log Message: Documentation revamp part one. Deprecated node decorators. Added doSemanticAction for Text and Comment nodes. Added missing sitecapturer scripts. Fixed DOS batch files to work when called from any location. --- parser.bat DELETED --- --- stringextractor.bat DELETED --- --- translate.bat DELETED --- --- NEW FILE: parser.cmd --- @echo off rem HTMLParser Library $Name: $ - A java-based parser for HTML rem http://sourceforge.org/projects/htmlparser rem Copyright (C) 2005 Derrick Oswald rem rem Revision Control Information rem rem $Source: /cvsroot/htmlparser/htmlparser/bin/parser.cmd,v $ rem $Author: derrickoswald $ rem $Date: 2005/04/10 23:20:41 $ rem $Revision: 1.1 $ rem rem This library is free software; you can redistribute it and/or rem modify it under the terms of the GNU Lesser General Public rem License as published by the Free Software Foundation; either rem version 2.1 of the License, or (at your option) any later version. rem rem This library is distributed in the hope that it will be useful, rem but WITHOUT ANY WARRANTY; without even the implied warranty of rem MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU rem Lesser General Public License for more details. rem rem You should have received a copy of the GNU Lesser General Public rem License along with this library; if not, write to the Free Software rem Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA rem setlocal enableextensions if errorlevel 1 goto no_extensions_error for %%i in (%0) do set cmd_path= %%~dpi for /D %%i in (%cmd_path%..\lib\) do set lib_path=%%~dpi if not exist %lib_path%htmlparser.jar goto no_jar_error for %%i in (java.exe) do set java_executable=%%~$PATH:i if "%java_executable%"=="" goto no_java_error @echo on %java_executable% -classpath %lib_path%htmlparser.jar org.htmlparser.Parser %1 %2 @echo off goto end :no_extensions_error echo Unable to use CMD extensions goto end :no_jar_error echo Unable to find htmlparser.jar goto end :no_java_error echo Unable to find java.exe goto end :end --- NEW FILE: filterbuilder.cmd --- @echo off rem HTMLParser Library $Name: $ - A java-based parser for HTML rem http://sourceforge.org/projects/htmlparser rem Copyright (C) 2005 Derrick Oswald rem rem Revision Control Information rem rem $Source: /cvsroot/htmlparser/htmlparser/bin/filterbuilder.cmd,v $ rem $Author: derrickoswald $ rem $Date: 2005/04/10 23:20:41 $ rem $Revision: 1.1 $ rem rem This library is free software; you can redistribute it and/or rem modify it under the terms of the GNU Lesser General Public rem License as published by the Free Software Foundation; either rem version 2.1 of the License, or (at your option) any later version. rem rem This library is distributed in the hope that it will be useful, rem but WITHOUT ANY WARRANTY; without even the implied warranty of rem MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU rem Lesser General Public License for more details. rem rem You should have received a copy of the GNU Lesser General Public rem License along with this library; if not, write to the Free Software rem Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA rem setlocal enableextensions if errorlevel 1 goto no_extensions_error for %%i in (%0) do set cmd_path= %%~dpi for /D %%i in (%cmd_path%..\lib\) do set lib_path=%%~dpi if not exist %lib_path%htmlparser.jar goto no_htmlparser_jar_error if not exist %lib_path%filterbuilder.jar goto no_filterbuilder_jar_error for %%i in (java.exe) do set java_executable=%%~$PATH:i if "%java_executable%"=="" goto no_java_error @echo on %java_executable% -Xmx256M -classpath %lib_path%filterbuilder.jar;%lib_path%htmlparser.jar org.htmlparser.parserapplications.filterbuilder.FilterBuilder %1 @echo off goto end :no_extensions_error echo Unable to use CMD extensions goto end :no_htmlparser_jar_error echo Unable to find htmlparser.jar goto end :no_filterbuilder_jar_error echo Unable to find filterbuilder.jar goto end :no_java_error echo Unable to find java.exe goto end :end --- NEW FILE: sitecapturer.cmd --- @echo off rem HTMLParser Library $Name: $ - A java-based parser for HTML rem http://sourceforge.org/projects/htmlparser rem Copyright (C) 2005 Derrick Oswald rem rem Revision Control Information rem rem $Source: /cvsroot/htmlparser/htmlparser/bin/sitecapturer.cmd,v $ rem $Author: derrickoswald $ rem $Date: 2005/04/10 23:20:41 $ rem $Revision: 1.1 $ rem rem This library is free software; you can redistribute it and/or rem modify it under the terms of the GNU Lesser General Public rem License as published by the Free Software Foundation; either rem version 2.1 of the License, or (at your option) any later version. rem rem This library is distributed in the hope that it will be useful, rem but WITHOUT ANY WARRANTY; without even the implied warranty of rem MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU rem Lesser General Public License for more details. rem rem You should have received a copy of the GNU Lesser General Public rem License along with this library; if not, write to the Free Software rem Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA rem setlocal enableextensions if errorlevel 1 goto no_extensions_error for %%i in (%0) do set cmd_path= %%~dpi for /D %%i in (%cmd_path%..\lib\) do set lib_path=%%~dpi if not exist %lib_path%htmlparser.jar goto no_jar_error for %%i in (java.exe) do set java_executable=%%~$PATH:i if "%java_executable%"=="" goto no_java_error @echo on %java_executable% -classpath %lib_path%htmlparser.jar org.htmlparser.parserapplications.SiteCapturer %1 %2 %3 @echo off goto end :no_extensions_error echo Unable to use CMD extensions goto end :no_jar_error echo Unable to find htmlparser.jar goto end :no_java_error echo Unable to find java.exe goto end :end --- NEW FILE: translate.cmd --- @echo off rem HTMLParser Library $Name: $ - A java-based parser for HTML rem http://sourceforge.org/projects/htmlparser rem Copyright (C) 2005 Derrick Oswald rem rem Revision Control Information rem rem $Source: /cvsroot/htmlparser/htmlparser/bin/translate.cmd,v $ rem $Author: derrickoswald $ rem $Date: 2005/04/10 23:20:41 $ rem $Revision: 1.1 $ rem rem This library is free software; you can redistribute it and/or rem modify it under the terms of the GNU Lesser General Public rem License as published by the Free Software Foundation; either rem version 2.1 of the License, or (at your option) any later version. rem rem This library is distributed in the hope that it will be useful, rem but WITHOUT ANY WARRANTY; without even the implied warranty of rem MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU rem Lesser General Public License for more details. rem rem You should have received a copy of the GNU Lesser General Public rem License along with this library; if not, write to the Free Software rem Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA rem setlocal enableextensions if errorlevel 1 goto no_extensions_error for %%i in (%0) do set cmd_path= %%~dpi for /D %%i in (%cmd_path%..\lib\) do set lib_path=%%~dpi if not exist %lib_path%htmlparser.jar goto no_jar_error for %%i in (java.exe) do set java_executable=%%~$PATH:i if "%java_executable%"=="" goto no_java_error @echo on %java_executable% -classpath %lib_path%htmlparser.jar org.htmlparser.util.Translate %1 %2 @echo off goto end :no_extensions_error echo Unable to use CMD extensions goto end :no_jar_error echo Unable to find htmlparser.jar goto end :no_java_error echo Unable to find java.exe goto end :end --- NEW FILE: lexer.cmd --- @echo off rem HTMLParser Library $Name: $ - A java-based parser for HTML rem http://sourceforge.org/projects/htmlparser rem Copyright (C) 2005 Derrick Oswald rem rem Revision Control Information rem rem $Source: /cvsroot/htmlparser/htmlparser/bin/lexer.cmd,v $ rem $Author: derrickoswald $ rem $Date: 2005/04/10 23:20:41 $ rem $Revision: 1.1 $ rem rem This library is free software; you can redistribute it and/or rem modify it under the terms of the GNU Lesser General Public rem License as published by the Free Software Foundation; either rem version 2.1 of the License, or (at your option) any later version. rem rem This library is distributed in the hope that it will be useful, rem but WITHOUT ANY WARRANTY; without even the implied warranty of rem MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU rem Lesser General Public License for more details. rem rem You should have received a copy of the GNU Lesser General Public rem License along with this library; if not, write to the Free Software rem Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA rem setlocal enableextensions if errorlevel 1 goto no_extensions_error for %%i in (%0) do set cmd_path= %%~dpi for /D %%i in (%cmd_path%..\lib\) do set lib_path=%%~dpi if not exist %lib_path%htmllexer.jar goto no_jar_error for %%i in (java.exe) do set java_executable=%%~$PATH:i if "%java_executable%"=="" goto no_java_error @echo on %java_executable% -classpath %lib_path%htmllexer.jar org.htmlparser.lexer.Lexer %1 %2 @echo off goto end :no_extensions_error echo Unable to use CMD extensions goto end :no_jar_error echo Unable to find htmllexer.jar goto end :no_java_error echo Unable to find java.exe goto end :end --- NEW FILE: linkextractor.cmd --- @echo off rem HTMLParser Library $Name: $ - A java-based parser for HTML rem http://sourceforge.org/projects/htmlparser rem Copyright (C) 2005 Derrick Oswald rem rem Revision Control Information rem rem $Source: /cvsroot/htmlparser/htmlparser/bin/linkextractor.cmd,v $ rem $Author: derrickoswald $ rem $Date: 2005/04/10 23:20:41 $ rem $Revision: 1.1 $ rem rem This library is free software; you can redistribute it and/or rem modify it under the terms of the GNU Lesser General Public rem License as published by the Free Software Foundation; either rem version 2.1 of the License, or (at your option) any later version. rem rem This library is distributed in the hope that it will be useful, rem but WITHOUT ANY WARRANTY; without even the implied warranty of rem MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU rem Lesser General Public License for more details. rem rem You should have received a copy of the GNU Lesser General Public rem License along with this library; if not, write to the Free Software rem Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA rem setlocal enableextensions if errorlevel 1 goto no_extensions_error for %%i in (%0) do set cmd_path= %%~dpi for /D %%i in (%cmd_path%..\lib\) do set lib_path=%%~dpi if not exist %lib_path%htmlparser.jar goto no_jar_error for %%i in (java.exe) do set java_executable=%%~$PATH:i if "%java_executable%"=="" goto no_java_error @echo on %java_executable% -classpath %lib_path%htmlparser.jar org.htmlparser.parserapplications.LinkExtractor %1 %2 @echo off goto end :no_extensions_error echo Unable to use CMD extensions goto end :no_jar_error echo Unable to find htmlparser.jar goto end :no_java_error echo Unable to find java.exe goto end :end --- NEW FILE: stringextractor.cmd --- @echo off rem HTMLParser Library $Name: $ - A java-based parser for HTML rem http://sourceforge.org/projects/htmlparser rem Copyright (C) 2005 Derrick Oswald rem rem Revision Control Information rem rem $Source: /cvsroot/htmlparser/htmlparser/bin/stringextractor.cmd,v $ rem $Author: derrickoswald $ rem $Date: 2005/04/10 23:20:41 $ rem $Revision: 1.1 $ rem rem This library is free software; you can redistribute it and/or rem modify it under the terms of the GNU Lesser General Public rem License as published by the Free Software Foundation; either rem version 2.1 of the License, or (at your option) any later version. rem rem This library is distributed in the hope that it will be useful, rem but WITHOUT ANY WARRANTY; without even the implied warranty of rem MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU rem Lesser General Public License for more details. rem rem You should have received a copy of the GNU Lesser General Public rem License along with this library; if not, write to the Free Software rem Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA rem setlocal enableextensions if errorlevel 1 goto no_extensions_error for %%i in (%0) do set cmd_path= %%~dpi for /D %%i in (%cmd_path%..\lib\) do set lib_path=%%~dpi if not exist %lib_path%htmlparser.jar goto no_jar_error for %%i in (java.exe) do set java_executable=%%~$PATH:i if "%java_executable%"=="" goto no_java_error @echo on %java_executable% -classpath %lib_path%htmlparser.jar org.htmlparser.parserapplications.StringExtractor %1 %2 @echo off goto end :no_extensions_error echo Unable to use CMD extensions goto end :no_jar_error echo Unable to find htmlparser.jar goto end :no_java_error echo Unable to find java.exe goto end :end --- beanybaby.bat DELETED --- --- filterbuilder.bat DELETED --- --- linkextractor.bat DELETED --- --- NEW FILE: beanybaby.cmd --- @echo off rem HTMLParser Library $Name: $ - A java-based parser for HTML rem http://sourceforge.org/projects/htmlparser rem Copyright (C) 2005 Derrick Oswald rem rem Revision Control Information rem rem $Source: /cvsroot/htmlparser/htmlparser/bin/beanybaby.cmd,v $ rem $Author: derrickoswald $ rem $Date: 2005/04/10 23:20:41 $ rem $Revision: 1.1 $ rem rem This library is free software; you can redistribute it and/or rem modify it under the terms of the GNU Lesser General Public rem License as published by the Free Software Foundation; either rem version 2.1 of the License, or (at your option) any later version. rem rem This library is distributed in the hope that it will be useful, rem but WITHOUT ANY WARRANTY; without even the implied warranty of rem MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU rem Lesser General Public License for more details. rem rem You should have received a copy of the GNU Lesser General Public rem License along with this library; if not, write to the Free Software rem Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA rem setlocal enableextensions if errorlevel 1 goto no_extensions_error for %%i in (%0) do set cmd_path= %%~dpi for /D %%i in (%cmd_path%..\lib\) do set lib_path=%%~dpi if not exist %lib_path%htmlparser.jar goto no_jar_error for %%i in (java.exe) do set java_executable=%%~$PATH:i if "%java_executable%"=="" goto no_java_error @echo on %java_executable% -classpath %lib_path%htmlparser.jar org.htmlparser.beans.BeanyBaby %1 %2 @echo off goto end :no_extensions_error echo Unable to use CMD extensions goto end :no_jar_error echo Unable to find htmlparser.jar goto end :no_java_error echo Unable to find java.exe goto end :end --- lexer.bat DELETED --- --- NEW FILE: sitecapturer --- #! /bin/sh if [ -z "$HTMLPARSER_HOME" ] ; then ## resolve links - $0 may be a link to the home PRG="$0" progname=`basename "$0"` saveddir=`pwd` # need this for relative symlinks dirname_prg=`dirname "$PRG"` cd "$dirname_prg" while [ -h "$PRG" ] ; do ls=`ls -ld "$PRG"` link=`expr "$ls" : '.*-> \(.*\)$'` if expr "$link" : '/.*' > /dev/null; then PRG="$link" else PRG=`dirname "$PRG"`"/$link" fi done HTMLPARSER_HOME=`dirname "$PRG"`/.. cd "$saveddir" # make it fully qualified HTMLPARSER_HOME=`cd "$HTMLPARSER_HOME" && pwd` fi if [ -z "$JAVACMD" ] ; then if [ -n "$JAVA_HOME" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then # IBM's JDK on AIX uses strange locations for the executables JAVACMD="$JAVA_HOME/jre/sh/java" else JAVACMD="$JAVA_HOME/bin/java" fi else JAVACMD=`which java 2> /dev/null ` if [ -z "$JAVACMD" ] ; then JAVACMD=java fi fi fi if [ ! -x "$JAVACMD" ] ; then echo "Error: JAVA_HOME is not defined correctly." echo " We cannot execute $JAVACMD" exit 1 fi if [ -n "$CLASSPATH" ] ; then LOCALCLASSPATH="$CLASSPATH" fi HTMLPARSER_LIB="${HTMLPARSER_HOME}/lib" # add in the parser .jar file if [ -z "$LOCALCLASSPATH" ] ; then LOCALCLASSPATH="${HTMLPARSER_LIB}/htmlparser.jar" else LOCALCLASSPATH="${HTMLPARSER_LIB}/htmlparser.jar":"$LOCALCLASSPATH" fi # handle 1.1x JDKs if [ -n "$JAVA_HOME" ] ; then if [ -f "$JAVA_HOME/lib/classes.zip" ] ; then LOCALCLASSPATH="$LOCALCLASSPATH:$JAVA_HOME/lib/classes.zip" fi fi "$JAVACMD" -classpath "$LOCALCLASSPATH" org.htmlparser.parserapplications.SiteCapturer "$@" --- thumbelina.bat DELETED --- --- NEW FILE: thumbelina.cmd --- @echo off rem HTMLParser Library $Name: $ - A java-based parser for HTML rem http://sourceforge.org/projects/htmlparser rem Copyright (C) 2005 Derrick Oswald rem rem Revision Control Information rem rem $Source: /cvsroot/htmlparser/htmlparser/bin/thumbelina.cmd,v $ rem $Author: derrickoswald $ rem $Date: 2005/04/10 23:20:41 $ rem $Revision: 1.1 $ rem rem This library is free software; you can redistribute it and/or rem modify it under the terms of the GNU Lesser General Public rem License as published by the Free Software Foundation; either rem version 2.1 of the License, or (at your option) any later version. rem rem This library is distributed in the hope that it will be useful, rem but WITHOUT ANY WARRANTY; without even the implied warranty of rem MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU rem Lesser General Public License for more details. rem rem You should have received a copy of the GNU Lesser General Public rem License along with this library; if not, write to the Free Software rem Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA rem setlocal enableextensions if errorlevel 1 goto no_extensions_error for %%i in (%0) do set cmd_path= %%~dpi for /D %%i in (%cmd_path%..\lib\) do set lib_path=%%~dpi if not exist %lib_path%htmllexer.jar goto no_htmllexer_jar_error if not exist %lib_path%thumbelina.jar goto no_thumbelina_jar_error for %%i in (java.exe) do set java_executable=%%~$PATH:i if "%java_executable%"=="" goto no_java_error @echo on %java_executable% -Xmx256M -classpath %lib_path%thumbelina.jar;%lib_path%htmllexer.jar org.htmlparser.lexerapplications.thumbelina.Thumbelina %1 %2 @echo off goto end :no_extensions_error echo Unable to use CMD extensions goto end :no_htmllexer_jar_error echo Unable to find htmllexer.jar goto end :no_thumbelina_jar_error echo Unable to find thumbelina.jar goto end :no_java_error echo Unable to find java.exe goto end :end |
From: Derrick O. <der...@us...> - 2005-04-10 23:20:59
|
Update of /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tests/lexerTests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30655/htmlparser/src/org/htmlparser/tests/lexerTests Modified Files: KitTest.java LexerTests.java Log Message: Documentation revamp part one. Deprecated node decorators. Added doSemanticAction for Text and Comment nodes. Added missing sitecapturer scripts. Fixed DOS batch files to work when called from any location. Index: LexerTests.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tests/lexerTests/LexerTests.java,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** LexerTests.java 6 Mar 2005 21:46:32 -0000 1.23 --- LexerTests.java 10 Apr 2005 23:20:46 -0000 1.24 *************** *** 280,287 **** { string = node.toHtml (); ! if (position != node.elementBegin ()) fail ("non-contiguous" + string); buffer.append (string); ! position = node.elementEnd (); if (buffer.length () != position) fail ("text length differed after encountering node " + string); --- 280,287 ---- { string = node.toHtml (); ! if (position != node.getStartPosition ()) fail ("non-contiguous" + string); buffer.append (string); ! position = node.getEndPosition (); if (buffer.length () != position) fail ("text length differed after encountering node " + string); Index: KitTest.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tests/lexerTests/KitTest.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** KitTest.java 31 Jul 2004 16:42:31 -0000 1.8 --- KitTest.java 10 Apr 2005 23:20:46 -0000 1.9 *************** *** 150,154 **** ours = node.getText (); System.out.println ("theirs: " + theirs); ! Cursor cursor = new Cursor (((AbstractNode)node).getPage (), node.elementBegin ()); System.out.println ("ours " + cursor + ": " + ours); } --- 150,154 ---- ours = node.getText (); System.out.println ("theirs: " + theirs); ! Cursor cursor = new Cursor (((AbstractNode)node).getPage (), node.getStartPosition ()); System.out.println ("ours " + cursor + ": " + ours); } *************** *** 171,175 **** System.out.println ("to match:"); node = (Node)mNodes.elementAt (match); ! Cursor cursor = new Cursor (((AbstractNode)node).getPage (), node.elementBegin ()); System.out.println ("@" + cursor + ": " + node.toHtml ()); } --- 171,175 ---- System.out.println ("to match:"); node = (Node)mNodes.elementAt (match); ! Cursor cursor = new Cursor (((AbstractNode)node).getPage (), node.getStartPosition ()); System.out.println ("@" + cursor + ": " + node.toHtml ()); } *************** *** 214,218 **** ours = node.getText (); System.out.println ("theirs: " + theirs); ! Cursor cursor = new Cursor (((AbstractNode)node).getPage (), node.elementBegin ()); System.out.println ("ours " + cursor + ": " + ours); } --- 214,218 ---- ours = node.getText (); System.out.println ("theirs: " + theirs); ! Cursor cursor = new Cursor (((AbstractNode)node).getPage (), node.getStartPosition ()); System.out.println ("ours " + cursor + ": " + ours); } *************** *** 235,239 **** System.out.println ("to match:"); node = (Node)mNodes.elementAt (match); ! Cursor cursor = new Cursor (((AbstractNode)node).getPage (), node.elementBegin ()); System.out.println ("@" + cursor + ": " + node.toHtml ()); } --- 235,239 ---- System.out.println ("to match:"); node = (Node)mNodes.elementAt (match); ! Cursor cursor = new Cursor (((AbstractNode)node).getPage (), node.getStartPosition ()); System.out.println ("@" + cursor + ": " + node.toHtml ()); } *************** *** 279,283 **** ours = node.getText (); System.out.println ("theirs: " + theirs); ! Cursor cursor = new Cursor (((AbstractNode)node).getPage (), node.elementBegin ()); System.out.println ("ours " + cursor + ": " + ours); } --- 279,283 ---- ours = node.getText (); System.out.println ("theirs: " + theirs); ! Cursor cursor = new Cursor (((AbstractNode)node).getPage (), node.getStartPosition ()); System.out.println ("ours " + cursor + ": " + ours); } *************** *** 300,304 **** System.out.println ("to match:"); node = (Node)mNodes.elementAt (match); ! Cursor cursor = new Cursor (((AbstractNode)node).getPage (), node.elementBegin ()); System.out.println ("@" + cursor + ": " + node.toHtml ()); } --- 300,304 ---- System.out.println ("to match:"); node = (Node)mNodes.elementAt (match); ! Cursor cursor = new Cursor (((AbstractNode)node).getPage (), node.getStartPosition ()); System.out.println ("@" + cursor + ": " + node.toHtml ()); } *************** *** 343,347 **** ours = node.getText (); System.out.println ("theirs: " + theirs); ! Cursor cursor = new Cursor (((AbstractNode)node).getPage (), node.elementBegin ()); System.out.println ("ours " + cursor + ": " + ours); } --- 343,347 ---- ours = node.getText (); System.out.println ("theirs: " + theirs); ! Cursor cursor = new Cursor (((AbstractNode)node).getPage (), node.getStartPosition ()); System.out.println ("ours " + cursor + ": " + ours); } *************** *** 364,368 **** System.out.println ("to match:"); node = (Node)mNodes.elementAt (match); ! Cursor cursor = new Cursor (((AbstractNode)node).getPage (), node.elementBegin ()); System.out.println ("@" + cursor + ": " + node.toHtml ()); } --- 364,368 ---- System.out.println ("to match:"); node = (Node)mNodes.elementAt (match); ! Cursor cursor = new Cursor (((AbstractNode)node).getPage (), node.getStartPosition ()); System.out.println ("@" + cursor + ": " + node.toHtml ()); } *************** *** 413,417 **** ours = node.getText (); System.out.println ("theirs: " + theirs); ! Cursor cursor = new Cursor (((AbstractNode)node).getPage (), node.elementBegin ()); System.out.println ("ours " + cursor + ": " + ours); } --- 413,417 ---- ours = node.getText (); System.out.println ("theirs: " + theirs); ! Cursor cursor = new Cursor (((AbstractNode)node).getPage (), node.getStartPosition ()); System.out.println ("ours " + cursor + ": " + ours); } *************** *** 434,438 **** System.out.println ("to match:"); node = (Node)mNodes.elementAt (match); ! Cursor cursor = new Cursor (((AbstractNode)node).getPage (), node.elementBegin ()); System.out.println ("@" + cursor + ": " + node.toHtml ()); } --- 434,438 ---- System.out.println ("to match:"); node = (Node)mNodes.elementAt (match); ! Cursor cursor = new Cursor (((AbstractNode)node).getPage (), node.getStartPosition ()); System.out.println ("@" + cursor + ": " + node.toHtml ()); } *************** *** 599,602 **** --- 599,609 ---- * * $Log$ + * Revision 1.9 2005/04/10 23:20:46 derrickoswald + * Documentation revamp part one. + * Deprecated node decorators. + * Added doSemanticAction for Text and Comment nodes. + * Added missing sitecapturer scripts. + * Fixed DOS batch files to work when called from any location. + * * Revision 1.8 2004/07/31 16:42:31 derrickoswald * Remove unused variables and other fixes exposed by turning on compiler warnings. |
From: Derrick O. <der...@us...> - 2005-04-10 23:20:59
|
Update of /cvsroot/htmlparser/htmlparser/src/org/htmlparser/parserapplications/filterbuilder In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30655/htmlparser/src/org/htmlparser/parserapplications/filterbuilder Modified Files: FilterBuilder.java Log Message: Documentation revamp part one. Deprecated node decorators. Added doSemanticAction for Text and Comment nodes. Added missing sitecapturer scripts. Fixed DOS batch files to work when called from any location. Index: FilterBuilder.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/parserapplications/filterbuilder/FilterBuilder.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** FilterBuilder.java 4 Mar 2005 15:57:25 -0000 1.3 --- FilterBuilder.java 10 Apr 2005 23:20:44 -0000 1.4 *************** *** 2380,2383 **** --- 2380,2384 ---- * The entry point for this application. * Creates a new FilterBuilder and makes it visible. + * @param args [0] optional URL to operate on. */ public static void main (String args[]) *************** *** 2396,2399 **** --- 2397,2402 ---- // create a new instance of our application's frame, and make it visible FilterBuilder builder = new FilterBuilder (); + if (0 != args.length) + builder.mURLField.setText (args[0]); builder.setVisible (true); } |