Update of /cvsroot/htmlparser/htmlparser/src/org/htmlparser/scanners
In directory sc8-pr-cvs1:/tmp/cvs-serv2400/org/htmlparser/scanners
Modified Files:
BodyScanner.java
Added Files:
HeadScanner.java
Log Message:
From Dhaval: Created the HEAD tag-scanner pair and corrected the BodyScanner.
There were some mistakes after the redisgn that took place.
--- NEW FILE: HeadScanner.java ---
// HTMLParser Library v1_3_20030511 - A java-based parser for HTML
// Copyright (C) Dec 31, 2000 Somik Raha
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// For any questions or suggestions, you can write to me at :
// Email :so...@in...
//
// Postal Address :
// Somik Raha
// Extreme Programmer & Coach
// Industrial Logic Corporation
// 2583 Cedar Street, Berkeley,
// CA 94708, USA
// Website : http://www.industriallogic.com
//
// This class was contributed by Dhaval Udani
// dha...@or...
package org.htmlparser.scanners;
import org.htmlparser.tags.HeadTag;
import org.htmlparser.tags.Tag;
import org.htmlparser.tags.data.CompositeTagData;
import org.htmlparser.tags.data.TagData;
public class HeadScanner extends CompositeTagScanner {
private static final String MATCH_NAME [] = {"HEAD"};
private static final String ENDERS [] = {"BODY"};
private static final String END_TAG_ENDERS [] = {"HTML"};
public HeadScanner() {
this("");
}
public HeadScanner(String filter) {
super(filter,MATCH_NAME,ENDERS,END_TAG_ENDERS,false);
}
public String [] getID() {
return MATCH_NAME;
}
public Tag createTag(
TagData tagData,
CompositeTagData compositeTagData) {
return new HeadTag(tagData,compositeTagData);
}
}
Index: BodyScanner.java
===================================================================
RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/scanners/BodyScanner.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** BodyScanner.java 3 May 2003 02:33:33 -0000 1.3
--- BodyScanner.java 16 May 2003 11:38:38 -0000 1.4
***************
*** 40,46 ****
public class BodyScanner extends CompositeTagScanner {
private static final String MATCH_NAME [] = {"BODY"};
public BodyScanner(String filter) {
! super(filter,MATCH_NAME);
}
--- 40,52 ----
public class BodyScanner extends CompositeTagScanner {
private static final String MATCH_NAME [] = {"BODY"};
+ private static final String ENDERS [] = {};
+ private static final String END_TAG_ENDERS [] = {"HTML"};
+ public BodyScanner() {
+ this("");
+ }
+
public BodyScanner(String filter) {
! super(filter,MATCH_NAME,ENDERS,END_TAG_ENDERS,false);
}
***************
*** 49,58 ****
}
- public boolean evaluate(String tagNameBeingChecked, TagScanner previousOpenScanner)
- {
- absorbLeadingBlanks(tagNameBeingChecked);
- return (tagNameBeingChecked.toUpperCase ().startsWith (MATCH_NAME[0]) && null == previousOpenScanner);
- }
-
public Tag createTag(
TagData tagData,
--- 55,58 ----
|