[Htmlparser-cvs] htmlparser/src/org/htmlparser/tags BaseHrefTag.java,1.22,1.23 BodyTag.java,1.11,1.1
Brought to you by:
derrickoswald
Update of /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tags In directory sc8-pr-cvs1:/tmp/cvs-serv31228/tags Modified Files: BaseHrefTag.java BodyTag.java Bullet.java BulletList.java CompositeTag.java Div.java DoctypeTag.java EndTag.java FormTag.java FrameSetTag.java FrameTag.java HeadTag.java Html.java ImageTag.java InputTag.java JspTag.java LabelTag.java MetaTag.java OptionTag.java ScriptTag.java SelectTag.java Span.java StyleTag.java TableColumn.java TableRow.java TableTag.java Tag.java TextareaTag.java TitleTag.java Log Message: Change tabs to spaces in all source files. Index: BaseHrefTag.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tags/BaseHrefTag.java,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** BaseHrefTag.java 24 Aug 2003 21:59:42 -0000 1.22 --- BaseHrefTag.java 3 Sep 2003 23:36:20 -0000 1.23 *************** *** 41,60 **** */ public class BaseHrefTag extends Tag { ! private String baseUrl; ! public BaseHrefTag(TagData tagData, String baseUrl) { ! super(tagData); ! this.baseUrl = baseUrl; ! } ! public String getBaseUrl() { ! return baseUrl; ! } ! public void setBaseUrl(String baseUrl) { ! this.baseUrl = baseUrl; ! } ! public String toString() { ! return "BASE TAG\n"+ ! "--------\n"+ ! "Name : "+baseUrl; ! } } --- 41,60 ---- */ public class BaseHrefTag extends Tag { ! private String baseUrl; ! public BaseHrefTag(TagData tagData, String baseUrl) { ! super(tagData); ! this.baseUrl = baseUrl; ! } ! public String getBaseUrl() { ! return baseUrl; ! } ! public void setBaseUrl(String baseUrl) { ! this.baseUrl = baseUrl; ! } ! public String toString() { ! return "BASE TAG\n"+ ! "--------\n"+ ! "Name : "+baseUrl; ! } } Index: BodyTag.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tags/BodyTag.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** BodyTag.java 24 Aug 2003 21:59:42 -0000 1.11 --- BodyTag.java 3 Sep 2003 23:36:20 -0000 1.12 *************** *** 38,51 **** public class BodyTag extends CompositeTag { ! public BodyTag(TagData tagData, CompositeTagData compositeTagData) { ! super(tagData,compositeTagData); ! } ! ! public String getBody() { ! return toPlainTextString(); ! } ! ! public String toString() { ! return "BODY: "+getBody(); ! } } --- 38,51 ---- public class BodyTag extends CompositeTag { ! public BodyTag(TagData tagData, CompositeTagData compositeTagData) { ! super(tagData,compositeTagData); ! } ! ! public String getBody() { ! return toPlainTextString(); ! } ! ! public String toString() { ! return "BODY: "+getBody(); ! } } Index: Bullet.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tags/Bullet.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** Bullet.java 24 Aug 2003 21:59:42 -0000 1.11 --- Bullet.java 3 Sep 2003 23:36:20 -0000 1.12 *************** *** 35,41 **** public class Bullet extends CompositeTag { ! public Bullet(TagData tagData, CompositeTagData compositeTagData) { ! super(tagData, compositeTagData); ! } } --- 35,41 ---- public class Bullet extends CompositeTag { ! public Bullet(TagData tagData, CompositeTagData compositeTagData) { ! super(tagData, compositeTagData); ! } } Index: BulletList.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tags/BulletList.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** BulletList.java 24 Aug 2003 21:59:42 -0000 1.11 --- BulletList.java 3 Sep 2003 23:36:20 -0000 1.12 *************** *** 40,51 **** public class BulletList extends CompositeTag { ! public BulletList(TagData tagData, CompositeTagData compositeTagData) { ! super(tagData, compositeTagData); ! } ! public String toString() { ! // TODO Auto-generated method stub ! return "BulletList"; ! } } --- 40,51 ---- public class BulletList extends CompositeTag { ! public BulletList(TagData tagData, CompositeTagData compositeTagData) { ! super(tagData, compositeTagData); ! } ! public String toString() { ! // TODO Auto-generated method stub ! return "BulletList"; ! } } Index: CompositeTag.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tags/CompositeTag.java,v retrieving revision 1.51 retrieving revision 1.52 diff -C2 -d -r1.51 -r1.52 *** CompositeTag.java 24 Aug 2003 21:59:42 -0000 1.51 --- CompositeTag.java 3 Sep 2003 23:36:20 -0000 1.52 *************** *** 38,49 **** public abstract class CompositeTag extends Tag { ! protected Tag startTag, endTag; ! public CompositeTag(TagData tagData, CompositeTagData compositeTagData) { ! super(tagData); ! this.startTag = compositeTagData.getStartTag(); ! this.endTag = compositeTagData.getEndTag(); ! setChildren (compositeTagData.getChildren()); ! } /** --- 38,49 ---- public abstract class CompositeTag extends Tag { ! protected Tag startTag, endTag; ! public CompositeTag(TagData tagData, CompositeTagData compositeTagData) { ! super(tagData); ! this.startTag = compositeTagData.getStartTag(); ! this.endTag = compositeTagData.getEndTag(); ! setChildren (compositeTagData.getChildren()); ! } /** *************** *** 51,58 **** * @return Am iterator over the children of this node. */ ! public SimpleNodeIterator children () { ! return (getChildren ().elements ()); ! } /** --- 51,58 ---- * @return Am iterator over the children of this node. */ ! public SimpleNodeIterator children () { ! return (getChildren ().elements ()); ! } /** *************** *** 61,68 **** * @return The child at that index. */ ! public Node getChild (int index) { ! return (getChildren ().elementAt (index)); ! } /** --- 61,68 ---- * @return The child at that index. */ ! public Node getChild (int index) { ! return (getChildren ().elementAt (index)); ! } /** *************** *** 70,86 **** * @return The children in an array. */ ! public Node [] getChildrenAsNodeArray () { ! return (getChildren ().toNodeArray ()); ! } ! /** * Remove the child at the position given. * @param i The index of the child to remove. */ ! public void removeChild (int i) { ! getChildren ().remove (i); ! } /** --- 70,86 ---- * @return The children in an array. */ ! public Node [] getChildrenAsNodeArray () { ! return (getChildren ().toNodeArray ()); ! } ! /** * Remove the child at the position given. * @param i The index of the child to remove. */ ! public void removeChild (int i) { ! getChildren ().remove (i); ! } /** *************** *** 89,93 **** * @return An iterator over the children. */ ! public SimpleNodeIterator elements() { return (getChildren ().elements ()); --- 89,93 ---- * @return An iterator over the children. */ ! public SimpleNodeIterator elements() { return (getChildren ().elements ()); *************** *** 95,354 **** public String toPlainTextString() { ! StringBuffer stringRepresentation = new StringBuffer(); ! for (SimpleNodeIterator e=children();e.hasMoreNodes();) { ! stringRepresentation.append(e.nextNode().toPlainTextString()); ! } ! return stringRepresentation.toString(); ! } ! public void putStartTagInto(StringBuffer sb) { ! sb.append(startTag.toHtml()); ! } ! protected void putChildrenInto(StringBuffer sb) { ! Node node,prevNode=startTag; ! for (SimpleNodeIterator e=children();e.hasMoreNodes();) { ! node = e.nextNode(); ! if (prevNode!=null) { ! if (prevNode.elementEnd()>node.elementBegin()) { ! // Its a new line ! sb.append(Parser.getLineSeparator()); ! } ! } ! sb.append(node.toHtml()); ! prevNode=node; ! } ! if (prevNode.elementEnd()>endTag.elementBegin()) { ! sb.append(Parser.getLineSeparator()); ! } ! } ! protected void putEndTagInto(StringBuffer sb) { ! sb.append(endTag.toHtml()); ! } ! public String toHtml() { ! StringBuffer sb = new StringBuffer(); ! putStartTagInto(sb); ! if (!startTag.isEmptyXmlTag()) { ! putChildrenInto(sb); ! putEndTagInto(sb); ! } ! return sb.toString(); ! } ! /** ! * Searches all children who for a name attribute. Returns first match. ! * @param name Attribute to match in tag ! * @return Tag Tag matching the name attribute ! */ ! public Tag searchByName(String name) { ! Node node; ! Tag tag=null; ! boolean found = false; ! for (SimpleNodeIterator e = children();e.hasMoreNodes() && !found;) { ! node = (Node)e.nextNode(); ! if (node instanceof Tag) { ! tag = (Tag)node; ! String nameAttribute = tag.getAttribute("NAME"); ! if (nameAttribute!=null && nameAttribute.equals(name)) found=true; ! } ! } ! if (found) ! return tag; ! else ! return null; ! } ! /** ! * Searches for any node whose text representation contains the search ! * string. Collects all such nodes in a NodeList. ! * e.g. if you wish to find any textareas in a form tag containing "hello ! * world", the code would be : ! * <code> ! * NodeList nodeList = formTag.searchFor("Hello World"); ! * </code> ! * @param searchString search criterion ! * @param caseSensitive specify whether this search should be case ! * sensitive ! * @return NodeList Collection of nodes whose string contents or ! * representation have the searchString in them ! */ ! public NodeList searchFor(String searchString, boolean caseSensitive) { ! NodeList foundList = new NodeList(); ! Node node; ! if (!caseSensitive) searchString = searchString.toUpperCase(); ! for (SimpleNodeIterator e = children();e.hasMoreNodes();) { ! node = e.nextNode(); ! String nodeTextString = node.toPlainTextString(); ! if (!caseSensitive) nodeTextString=nodeTextString.toUpperCase(); ! if (nodeTextString.indexOf(searchString)!=-1) { ! foundList.add(node); ! } ! } ! return foundList; ! } ! /** ! * Collect all objects that are of a certain type ! * Note that this will not check for parent types, and will not ! * recurse through child tags ! * @param classType ! * @return NodeList ! */ ! public NodeList searchFor(Class classType) { ! return (getChildren ().searchFor (classType)); ! } ! /** ! * Searches for any node whose text representation contains the search ! * string. Collects all such nodes in a NodeList. ! * e.g. if you wish to find any textareas in a form tag containing "hello ! * world", the code would be : ! * <code> ! * NodeList nodeList = formTag.searchFor("Hello World"); ! * </code> ! * This search is <b>case-insensitive</b>. ! * @param searchString search criterion ! * @return NodeList Collection of nodes whose string contents or ! * representation have the searchString in them ! */ ! public NodeList searchFor(String searchString) { ! return searchFor(searchString, false); ! } ! /** ! * Returns the node number of the string node containing the ! * given text. This can be useful to index into the composite tag ! * and get other children. ! * @param text ! * @return int ! */ ! public int findPositionOf(String text) { ! Node node; ! int loc = 0; ! for (SimpleNodeIterator e=children();e.hasMoreNodes();) { ! node = e.nextNode(); ! if (node.toPlainTextString().toUpperCase().indexOf(text.toUpperCase())!=-1) { ! return loc; ! } ! loc++; ! } ! return -1; ! } ! ! /** ! * Returns the node number of a child node given the node object. ! * This would typically be used in conjuction with digUpStringNode, ! * after which the string node's parent can be used to find the ! * string node's position. Faster than calling findPositionOf(text) ! * again. Note that the position is at a linear level alone - there ! * is no recursion in this method. ! * @param searchNode The child node to find. ! * @return The offset of the child tag or -1 if it was not found. ! */ ! public int findPositionOf(Node searchNode) { ! Node node; ! int loc = 0; ! for (SimpleNodeIterator e=children();e.hasMoreNodes();) { ! node = e.nextNode(); ! if (node==searchNode) { ! return loc; ! } ! loc++; ! } ! return -1; ! } ! ! /** ! * Get child at given index ! * @param index ! * @return Node ! */ ! public Node childAt(int index) { ! return (getChildren ().elementAt (index)); ! } ! ! public void collectInto(NodeList collectionList, String filter) { ! super.collectInto(collectionList, filter); ! Node node; ! for (SimpleNodeIterator e = children();e.hasMoreNodes();) { ! node = e.nextNode(); ! node.collectInto(collectionList,filter); ! } ! } ! public void collectInto(NodeList collectionList, Class nodeType) { ! super.collectInto(collectionList,nodeType); ! for (SimpleNodeIterator e = children();e.hasMoreNodes();) { ! e.nextNode().collectInto(collectionList,nodeType); ! } ! } ! ! public String getChildrenHTML() { ! StringBuffer buff = new StringBuffer(); ! for (SimpleNodeIterator e = children();e.hasMoreNodes();) { ! AbstractNode node = (AbstractNode)e.nextNode(); ! buff.append(node.toHtml()); ! } ! return buff.toString(); ! } ! ! public void accept(NodeVisitor visitor) { ! if (visitor.shouldRecurseChildren()) { ! startTag.accept(visitor); ! SimpleNodeIterator children = children(); ! while (children.hasMoreNodes()) { ! Node child = (Node)children.nextNode(); ! child.accept(visitor); ! } ! endTag.accept(visitor); ! } ! if (visitor.shouldRecurseSelf()) ! visitor.visitTag(this); ! } ! public int getChildCount() { ! return (getChildren ().size ()); ! } ! public Tag getStartTag() { ! return startTag; ! } ! public Tag getEndTag() { ! return endTag; ! } ! /** ! * Finds a string node, however embedded it might be, and returns ! * it. The string node will retain links to its parents, so ! * further navigation is possible. ! * @param searchText ! * @return The list of string nodes (recursively) found. ! */ ! public StringNode [] digupStringNode(String searchText) { ! NodeList nodeList = searchFor(searchText); ! NodeList stringNodes = new NodeList(); ! for (int i=0;i<nodeList.size();i++) { ! Node node = nodeList.elementAt(i); ! if (node instanceof StringNode) { ! stringNodes.add(node); ! } else { ! if (node instanceof CompositeTag) { ! CompositeTag ctag = (CompositeTag)node; ! StringNode [] nodes = ctag.digupStringNode(searchText); ! for (int j=0;j<nodes.length;j++) ! stringNodes.add(nodes[j]); ! } ! } ! } ! StringNode [] stringNode = new StringNode[stringNodes.size()]; ! for (int i=0;i<stringNode.length;i++) { ! stringNode[i] = (StringNode)stringNodes.elementAt(i); ! } ! return stringNode; ! } --- 95,354 ---- public String toPlainTextString() { ! StringBuffer stringRepresentation = new StringBuffer(); ! for (SimpleNodeIterator e=children();e.hasMoreNodes();) { ! stringRepresentation.append(e.nextNode().toPlainTextString()); ! } ! return stringRepresentation.toString(); ! } ! public void putStartTagInto(StringBuffer sb) { ! sb.append(startTag.toHtml()); ! } ! protected void putChildrenInto(StringBuffer sb) { ! Node node,prevNode=startTag; ! for (SimpleNodeIterator e=children();e.hasMoreNodes();) { ! node = e.nextNode(); ! if (prevNode!=null) { ! if (prevNode.elementEnd()>node.elementBegin()) { ! // Its a new line ! sb.append(Parser.getLineSeparator()); ! } ! } ! sb.append(node.toHtml()); ! prevNode=node; ! } ! if (prevNode.elementEnd()>endTag.elementBegin()) { ! sb.append(Parser.getLineSeparator()); ! } ! } ! protected void putEndTagInto(StringBuffer sb) { ! sb.append(endTag.toHtml()); ! } ! public String toHtml() { ! StringBuffer sb = new StringBuffer(); ! putStartTagInto(sb); ! if (!startTag.isEmptyXmlTag()) { ! putChildrenInto(sb); ! putEndTagInto(sb); ! } ! return sb.toString(); ! } ! /** ! * Searches all children who for a name attribute. Returns first match. ! * @param name Attribute to match in tag ! * @return Tag Tag matching the name attribute ! */ ! public Tag searchByName(String name) { ! Node node; ! Tag tag=null; ! boolean found = false; ! for (SimpleNodeIterator e = children();e.hasMoreNodes() && !found;) { ! node = (Node)e.nextNode(); ! if (node instanceof Tag) { ! tag = (Tag)node; ! String nameAttribute = tag.getAttribute("NAME"); ! if (nameAttribute!=null && nameAttribute.equals(name)) found=true; ! } ! } ! if (found) ! return tag; ! else ! return null; ! } ! /** ! * Searches for any node whose text representation contains the search ! * string. Collects all such nodes in a NodeList. ! * e.g. if you wish to find any textareas in a form tag containing "hello ! * world", the code would be : ! * <code> ! * NodeList nodeList = formTag.searchFor("Hello World"); ! * </code> ! * @param searchString search criterion ! * @param caseSensitive specify whether this search should be case ! * sensitive ! * @return NodeList Collection of nodes whose string contents or ! * representation have the searchString in them ! */ ! public NodeList searchFor(String searchString, boolean caseSensitive) { ! NodeList foundList = new NodeList(); ! Node node; ! if (!caseSensitive) searchString = searchString.toUpperCase(); ! for (SimpleNodeIterator e = children();e.hasMoreNodes();) { ! node = e.nextNode(); ! String nodeTextString = node.toPlainTextString(); ! if (!caseSensitive) nodeTextString=nodeTextString.toUpperCase(); ! if (nodeTextString.indexOf(searchString)!=-1) { ! foundList.add(node); ! } ! } ! return foundList; ! } ! /** ! * Collect all objects that are of a certain type ! * Note that this will not check for parent types, and will not ! * recurse through child tags ! * @param classType ! * @return NodeList ! */ ! public NodeList searchFor(Class classType) { ! return (getChildren ().searchFor (classType)); ! } ! /** ! * Searches for any node whose text representation contains the search ! * string. Collects all such nodes in a NodeList. ! * e.g. if you wish to find any textareas in a form tag containing "hello ! * world", the code would be : ! * <code> ! * NodeList nodeList = formTag.searchFor("Hello World"); ! * </code> ! * This search is <b>case-insensitive</b>. ! * @param searchString search criterion ! * @return NodeList Collection of nodes whose string contents or ! * representation have the searchString in them ! */ ! public NodeList searchFor(String searchString) { ! return searchFor(searchString, false); ! } ! /** ! * Returns the node number of the string node containing the ! * given text. This can be useful to index into the composite tag ! * and get other children. ! * @param text ! * @return int ! */ ! public int findPositionOf(String text) { ! Node node; ! int loc = 0; ! for (SimpleNodeIterator e=children();e.hasMoreNodes();) { ! node = e.nextNode(); ! if (node.toPlainTextString().toUpperCase().indexOf(text.toUpperCase())!=-1) { ! return loc; ! } ! loc++; ! } ! return -1; ! } ! ! /** ! * Returns the node number of a child node given the node object. ! * This would typically be used in conjuction with digUpStringNode, ! * after which the string node's parent can be used to find the ! * string node's position. Faster than calling findPositionOf(text) ! * again. Note that the position is at a linear level alone - there ! * is no recursion in this method. ! * @param searchNode The child node to find. ! * @return The offset of the child tag or -1 if it was not found. ! */ ! public int findPositionOf(Node searchNode) { ! Node node; ! int loc = 0; ! for (SimpleNodeIterator e=children();e.hasMoreNodes();) { ! node = e.nextNode(); ! if (node==searchNode) { ! return loc; ! } ! loc++; ! } ! return -1; ! } ! ! /** ! * Get child at given index ! * @param index ! * @return Node ! */ ! public Node childAt(int index) { ! return (getChildren ().elementAt (index)); ! } ! ! public void collectInto(NodeList collectionList, String filter) { ! super.collectInto(collectionList, filter); ! Node node; ! for (SimpleNodeIterator e = children();e.hasMoreNodes();) { ! node = e.nextNode(); ! node.collectInto(collectionList,filter); ! } ! } ! public void collectInto(NodeList collectionList, Class nodeType) { ! super.collectInto(collectionList,nodeType); ! for (SimpleNodeIterator e = children();e.hasMoreNodes();) { ! e.nextNode().collectInto(collectionList,nodeType); ! } ! } ! ! public String getChildrenHTML() { ! StringBuffer buff = new StringBuffer(); ! for (SimpleNodeIterator e = children();e.hasMoreNodes();) { ! AbstractNode node = (AbstractNode)e.nextNode(); ! buff.append(node.toHtml()); ! } ! return buff.toString(); ! } ! ! public void accept(NodeVisitor visitor) { ! if (visitor.shouldRecurseChildren()) { ! startTag.accept(visitor); ! SimpleNodeIterator children = children(); ! while (children.hasMoreNodes()) { ! Node child = (Node)children.nextNode(); ! child.accept(visitor); ! } ! endTag.accept(visitor); ! } ! if (visitor.shouldRecurseSelf()) ! visitor.visitTag(this); ! } ! public int getChildCount() { ! return (getChildren ().size ()); ! } ! public Tag getStartTag() { ! return startTag; ! } ! public Tag getEndTag() { ! return endTag; ! } ! /** ! * Finds a string node, however embedded it might be, and returns ! * it. The string node will retain links to its parents, so ! * further navigation is possible. ! * @param searchText ! * @return The list of string nodes (recursively) found. ! */ ! public StringNode [] digupStringNode(String searchText) { ! NodeList nodeList = searchFor(searchText); ! NodeList stringNodes = new NodeList(); ! for (int i=0;i<nodeList.size();i++) { ! Node node = nodeList.elementAt(i); ! if (node instanceof StringNode) { ! stringNodes.add(node); ! } else { ! if (node instanceof CompositeTag) { ! CompositeTag ctag = (CompositeTag)node; ! StringNode [] nodes = ctag.digupStringNode(searchText); ! for (int j=0;j<nodes.length;j++) ! stringNodes.add(nodes[j]); ! } ! } ! } ! StringNode [] stringNode = new StringNode[stringNodes.size()]; ! for (int i=0;i<stringNode.length;i++) { ! stringNode[i] = (StringNode)stringNodes.elementAt(i); ! } ! return stringNode; ! } Index: Div.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tags/Div.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** Div.java 24 Aug 2003 21:59:42 -0000 1.11 --- Div.java 3 Sep 2003 23:36:20 -0000 1.12 *************** *** 34,40 **** public class Div extends CompositeTag { ! public Div(TagData tagData, CompositeTagData compositeTagData) { ! super(tagData, compositeTagData); ! } } --- 34,40 ---- public class Div extends CompositeTag { ! public Div(TagData tagData, CompositeTagData compositeTagData) { ! super(tagData, compositeTagData); ! } } Index: DoctypeTag.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tags/DoctypeTag.java,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** DoctypeTag.java 24 Aug 2003 21:59:42 -0000 1.24 --- DoctypeTag.java 3 Sep 2003 23:36:20 -0000 1.25 *************** *** 38,58 **** { /** ! * The HTMLDoctypeTag is constructed by providing the beginning posn, ending posn ! * and the tag contents. ! * @param tagData The data for this tag. ! */ ! public DoctypeTag(TagData tagData) ! { ! super(tagData); ! } ! /** ! * Print the contents of the remark tag. ! */ ! public String toString() ! { ! return "Doctype Tag : "+tagContents+"; begins at : "+elementBegin()+"; ends at : "+elementEnd(); ! } ! public String toHtml() { ! return "<!DOCTYPE "+tagContents+">"; ! } } --- 38,58 ---- { /** ! * The HTMLDoctypeTag is constructed by providing the beginning posn, ending posn ! * and the tag contents. ! * @param tagData The data for this tag. ! */ ! public DoctypeTag(TagData tagData) ! { ! super(tagData); ! } ! /** ! * Print the contents of the remark tag. ! */ ! public String toString() ! { ! return "Doctype Tag : "+tagContents+"; begins at : "+elementBegin()+"; ends at : "+elementEnd(); ! } ! public String toHtml() { ! return "<!DOCTYPE "+tagContents+">"; ! } } Index: EndTag.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tags/EndTag.java,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** EndTag.java 24 Aug 2003 21:59:42 -0000 1.27 --- EndTag.java 3 Sep 2003 23:36:20 -0000 1.28 *************** *** 37,133 **** public class EndTag extends Tag { ! public final static String TYPE="END_TAG"; ! public final static int ENDTAG_BEFORE_PARSING_STATE=0; public final static int ENDTAG_WAIT_FOR_SLASH_STATE=1; public final static int ENDTAG_BEGIN_PARSING_STATE=2; ! public final static int ENDTAG_FINISHED_PARSING_STATE=3; ! ! /** ! * Constructor takes 3 arguments to construct an EndTag object. ! * @param tagData The data for this tag. ! */ ! public EndTag(TagData tagData) ! { ! super(tagData); ! } ! /** ! * Locate the end tag withing the input string, by parsing from the given position ! * @param input Input String ! * @param position Position to start parsing from ! */ ! public static AbstractNode find(String input,int position) ! { ! int state = ENDTAG_BEFORE_PARSING_STATE; ! StringBuffer tagContents = new StringBuffer(); ! int tagBegin=0; ! int tagEnd=0; ! int inputLen = input.length(); ! char ch; ! int i ; ! for (i=position;(i<inputLen&& state!=ENDTAG_FINISHED_PARSING_STATE);i++) ! { ! ch = input.charAt(i); ! if (ch=='>' && state==ENDTAG_BEGIN_PARSING_STATE) ! { ! state = ENDTAG_FINISHED_PARSING_STATE; ! tagEnd = i; ! } ! if (state==ENDTAG_BEGIN_PARSING_STATE) ! { ! tagContents.append(ch); ! } ! if (state==ENDTAG_WAIT_FOR_SLASH_STATE) ! { ! if (ch=='/') ! { ! state = ENDTAG_BEGIN_PARSING_STATE; ! } ! else return null; ! } ! if (ch=='<') ! { ! if (state==ENDTAG_BEFORE_PARSING_STATE) ! { ! // Transition from State 0 to State 1 - Record data till > is encountered ! tagBegin = i; ! state = ENDTAG_WAIT_FOR_SLASH_STATE; ! } ! else if (state==ENDTAG_BEGIN_PARSING_STATE) ! { ! state=ENDTAG_FINISHED_PARSING_STATE; ! tagEnd=i; ! } ! } else if (state == ENDTAG_BEFORE_PARSING_STATE) // text before the end tag return (null); ! } ! // If parsing did not complete, it might be possible to accept ! if (state==ENDTAG_BEGIN_PARSING_STATE) { ! tagEnd=i; ! state=ENDTAG_FINISHED_PARSING_STATE; ! } ! if (state==ENDTAG_FINISHED_PARSING_STATE) ! return new EndTag(new TagData(tagBegin,tagEnd,tagContents.toString(),input)); ! else return null; ! } ! public String toPlainTextString() { ! return ""; ! } ! public String toHtml() { ! return "</"+getTagName()+">"; ! } ! public String toString() { ! return "EndTag : "+tagContents+"; begins at : "+elementBegin()+"; ends at : "+elementEnd(); ! } ! ! public void accept(NodeVisitor visitor) { ! visitor.visitEndTag(this); ! } ! public String getType() { ! return TYPE; ! } } --- 37,133 ---- public class EndTag extends Tag { ! public final static String TYPE="END_TAG"; ! public final static int ENDTAG_BEFORE_PARSING_STATE=0; public final static int ENDTAG_WAIT_FOR_SLASH_STATE=1; public final static int ENDTAG_BEGIN_PARSING_STATE=2; ! public final static int ENDTAG_FINISHED_PARSING_STATE=3; ! ! /** ! * Constructor takes 3 arguments to construct an EndTag object. ! * @param tagData The data for this tag. ! */ ! public EndTag(TagData tagData) ! { ! super(tagData); ! } ! /** ! * Locate the end tag withing the input string, by parsing from the given position ! * @param input Input String ! * @param position Position to start parsing from ! */ ! public static AbstractNode find(String input,int position) ! { ! int state = ENDTAG_BEFORE_PARSING_STATE; ! StringBuffer tagContents = new StringBuffer(); ! int tagBegin=0; ! int tagEnd=0; ! int inputLen = input.length(); ! char ch; ! int i ; ! for (i=position;(i<inputLen&& state!=ENDTAG_FINISHED_PARSING_STATE);i++) ! { ! ch = input.charAt(i); ! if (ch=='>' && state==ENDTAG_BEGIN_PARSING_STATE) ! { ! state = ENDTAG_FINISHED_PARSING_STATE; ! tagEnd = i; ! } ! if (state==ENDTAG_BEGIN_PARSING_STATE) ! { ! tagContents.append(ch); ! } ! if (state==ENDTAG_WAIT_FOR_SLASH_STATE) ! { ! if (ch=='/') ! { ! state = ENDTAG_BEGIN_PARSING_STATE; ! } ! else return null; ! } ! if (ch=='<') ! { ! if (state==ENDTAG_BEFORE_PARSING_STATE) ! { ! // Transition from State 0 to State 1 - Record data till > is encountered ! tagBegin = i; ! state = ENDTAG_WAIT_FOR_SLASH_STATE; ! } ! else if (state==ENDTAG_BEGIN_PARSING_STATE) ! { ! state=ENDTAG_FINISHED_PARSING_STATE; ! tagEnd=i; ! } ! } else if (state == ENDTAG_BEFORE_PARSING_STATE) // text before the end tag return (null); ! } ! // If parsing did not complete, it might be possible to accept ! if (state==ENDTAG_BEGIN_PARSING_STATE) { ! tagEnd=i; ! state=ENDTAG_FINISHED_PARSING_STATE; ! } ! if (state==ENDTAG_FINISHED_PARSING_STATE) ! return new EndTag(new TagData(tagBegin,tagEnd,tagContents.toString(),input)); ! else return null; ! } ! public String toPlainTextString() { ! return ""; ! } ! public String toHtml() { ! return "</"+getTagName()+">"; ! } ! public String toString() { ! return "EndTag : "+tagContents+"; begins at : "+elementBegin()+"; ends at : "+elementEnd(); ! } ! ! public void accept(NodeVisitor visitor) { ! visitor.visitEndTag(this); ! } ! public String getType() { ! return TYPE; ! } } Index: FormTag.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tags/FormTag.java,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** FormTag.java 24 Aug 2003 21:59:42 -0000 1.30 --- FormTag.java 3 Sep 2003 23:36:20 -0000 1.31 *************** *** 48,175 **** public class FormTag extends CompositeTag { ! public static final String POST="POST"; ! public static final String GET="GET"; ! protected String formURL; ! protected String formName; ! protected String formMethod; ! protected NodeList formInputList; ! private NodeList textAreaList; ! ! /** ! * Constructor takes in tagData, compositeTagData, formTagData ! * @param tagData ! * @param compositeTagData ! */ ! public FormTag(TagData tagData, CompositeTagData compositeTagData) ! { ! super(tagData,compositeTagData); ! ! this.formURL = compositeTagData.getStartTag().getAttribute("ACTION"); ! this.formName = compositeTagData.getStartTag().getAttribute("NAME"); ! this.formMethod = compositeTagData.getStartTag().getAttribute("METHOD"); ! this.formInputList = compositeTagData.getChildren().searchFor(InputTag.class, true); ! this.textAreaList = compositeTagData.getChildren().searchFor(TextareaTag.class, true); ! } ! ! /** * Get the list of input fields. ! * @return Input elements in the form. ! */ ! public NodeList getFormInputs() { ! return formInputList; ! } ! ! /** * Get the list of text areas. ! * @return Textarea elements in the form ! */ ! public NodeList getFormTextareas() { ! return textAreaList; ! } ! ! /** ! * @return String The url of the form ! */ ! public String getFormLocation() ! { ! return formURL; ! } ! ! /** ! * Returns the method of the form ! * @return String The method of the form (GET if nothing is specified) ! */ ! public String getFormMethod() { ! if(formMethod==null) ! { ! formMethod = "GET"; ! } ! return formMethod; ! } ! ! /** ! * Get the input tag in the form corresponding to the given name ! * @param name The name of the input tag to be retrieved ! * @return Tag The input tag corresponding to the name provided ! */ ! public InputTag getInputTag(String name) { ! InputTag inputTag=null; ! boolean found=false; ! for (SimpleNodeIterator e = formInputList.elements();e.hasMoreNodes() && !found;) { ! inputTag = (InputTag)e.nextNode(); ! String inputTagName = inputTag.getAttribute("NAME"); ! if (inputTagName!=null && inputTagName.equalsIgnoreCase(name)) { ! found=true; ! } ! } ! if (found) ! return inputTag; else return null; ! } ! ! /** ! * @return String The name of the form ! */ ! public String getFormName() { ! return formName; ! } ! ! /** ! * Set the form location. Modification of this element will cause the HTML rendering ! * to change as well (in a call to toHTML()). ! * @param formURL The new FORM location ! */ ! public void setFormLocation(String formURL) { setAttribute ("ACTION", formURL); ! this.formURL = formURL; ! } ! /** ! * @return String The contents of the FormTag ! */ ! public String toString() { ! return "FORM TAG : Form at "+formURL+"; begins at : "+elementBegin()+"; ends at : "+elementEnd(); ! } ! /** ! * Find the textarea tag matching the given name ! * @param name Name of the textarea tag to be found within the form ! */ ! public TextareaTag getTextAreaTag(String name) { ! TextareaTag textareaTag=null; ! boolean found = false; ! for (SimpleNodeIterator e=textAreaList.elements();e.hasMoreNodes() && !found;) { ! textareaTag = (TextareaTag)e.nextNode(); ! String textAreaName = textareaTag.getAttribute("NAME"); ! if (textAreaName!=null && textAreaName.equals(name)) { ! found = true; ! } ! } ! if (found) ! return textareaTag; ! else ! return null; ! } ! } --- 48,175 ---- public class FormTag extends CompositeTag { ! public static final String POST="POST"; ! public static final String GET="GET"; ! protected String formURL; ! protected String formName; ! protected String formMethod; ! protected NodeList formInputList; ! private NodeList textAreaList; ! ! /** ! * Constructor takes in tagData, compositeTagData, formTagData ! * @param tagData ! * @param compositeTagData ! */ ! public FormTag(TagData tagData, CompositeTagData compositeTagData) ! { ! super(tagData,compositeTagData); ! ! this.formURL = compositeTagData.getStartTag().getAttribute("ACTION"); ! this.formName = compositeTagData.getStartTag().getAttribute("NAME"); ! this.formMethod = compositeTagData.getStartTag().getAttribute("METHOD"); ! this.formInputList = compositeTagData.getChildren().searchFor(InputTag.class, true); ! this.textAreaList = compositeTagData.getChildren().searchFor(TextareaTag.class, true); ! } ! ! /** * Get the list of input fields. ! * @return Input elements in the form. ! */ ! public NodeList getFormInputs() { ! return formInputList; ! } ! ! /** * Get the list of text areas. ! * @return Textarea elements in the form ! */ ! public NodeList getFormTextareas() { ! return textAreaList; ! } ! ! /** ! * @return String The url of the form ! */ ! public String getFormLocation() ! { ! return formURL; ! } ! ! /** ! * Returns the method of the form ! * @return String The method of the form (GET if nothing is specified) ! */ ! public String getFormMethod() { ! if(formMethod==null) ! { ! formMethod = "GET"; ! } ! return formMethod; ! } ! ! /** ! * Get the input tag in the form corresponding to the given name ! * @param name The name of the input tag to be retrieved ! * @return Tag The input tag corresponding to the name provided ! */ ! public InputTag getInputTag(String name) { ! InputTag inputTag=null; ! boolean found=false; ! for (SimpleNodeIterator e = formInputList.elements();e.hasMoreNodes() && !found;) { ! inputTag = (InputTag)e.nextNode(); ! String inputTagName = inputTag.getAttribute("NAME"); ! if (inputTagName!=null && inputTagName.equalsIgnoreCase(name)) { ! found=true; ! } ! } ! if (found) ! return inputTag; else return null; ! } ! ! /** ! * @return String The name of the form ! */ ! public String getFormName() { ! return formName; ! } ! ! /** ! * Set the form location. Modification of this element will cause the HTML rendering ! * to change as well (in a call to toHTML()). ! * @param formURL The new FORM location ! */ ! public void setFormLocation(String formURL) { setAttribute ("ACTION", formURL); ! this.formURL = formURL; ! } ! /** ! * @return String The contents of the FormTag ! */ ! public String toString() { ! return "FORM TAG : Form at "+formURL+"; begins at : "+elementBegin()+"; ends at : "+elementEnd(); ! } ! /** ! * Find the textarea tag matching the given name ! * @param name Name of the textarea tag to be found within the form ! */ ! public TextareaTag getTextAreaTag(String name) { ! TextareaTag textareaTag=null; ! boolean found = false; ! for (SimpleNodeIterator e=textAreaList.elements();e.hasMoreNodes() && !found;) { ! textareaTag = (TextareaTag)e.nextNode(); ! String textAreaName = textareaTag.getAttribute("NAME"); ! if (textAreaName!=null && textAreaName.equals(name)) { ! found = true; ! } ! } ! if (found) ! return textareaTag; ! else ! return null; ! } ! } Index: FrameSetTag.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tags/FrameSetTag.java,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** FrameSetTag.java 24 Aug 2003 21:59:42 -0000 1.22 --- FrameSetTag.java 3 Sep 2003 23:36:20 -0000 1.23 *************** *** 39,95 **** public class FrameSetTag extends CompositeTag { ! /** ! * The URL where the image is stored. ! */ ! protected String frameURL; ! protected String frameName; ! protected NodeList frames; ! public FrameSetTag(TagData tagData,CompositeTagData compositeTagData) { ! super(tagData,compositeTagData); ! this.frames = compositeTagData.getChildren(); ! } ! ! /** ! * Returns the location of the frame ! */ ! public String getFrameLocation() { ! return frameURL; ! } ! ! public String getFrameName() { ! return frameName; ! } ! ! /** ! * Print the contents of the HTMLImageNode ! */ ! public String toString() { ! return "FRAME TAG : Image at "+frameURL+"; begins at : "+elementBegin()+"; ends at : "+elementEnd(); ! } ! ! /** ! * Returns the frames. ! * @return Vector ! */ ! public NodeList getFrames() { ! return frames; ! } ! public FrameTag getFrame(String frameName) { ! boolean found = false; ! FrameTag frameTag=null; ! for (SimpleNodeIterator e=frames.elements();e.hasMoreNodes() && !found;) { ! frameTag = (FrameTag)e.nextNode(); ! if (frameTag.getFrameName().toUpperCase().equals(frameName.toUpperCase())) found = true; ! } ! if (found) ! return frameTag; else return null; ! } ! /** ! * Sets the frames. ! * @param frames The frames to set ! */ ! public void setFrames(NodeList frames) { ! this.frames = frames; ! } } --- 39,95 ---- public class FrameSetTag extends CompositeTag { ! /** ! * The URL where the image is stored. ! */ ! protected String frameURL; ! protected String frameName; ! protected NodeList frames; ! public FrameSetTag(TagData tagData,CompositeTagData compositeTagData) { ! super(tagData,compositeTagData); ! this.frames = compositeTagData.getChildren(); ! } ! ! /** ! * Returns the location of the frame ! */ ! public String getFrameLocation() { ! return frameURL; ! } ! ! public String getFrameName() { ! return frameName; ! } ! ! /** ! * Print the contents of the HTMLImageNode ! */ ! public String toString() { ! return "FRAME TAG : Image at "+frameURL+"; begins at : "+elementBegin()+"; ends at : "+elementEnd(); ! } ! ! /** ! * Returns the frames. ! * @return Vector ! */ ! public NodeList getFrames() { ! return frames; ! } ! public FrameTag getFrame(String frameName) { ! boolean found = false; ! FrameTag frameTag=null; ! for (SimpleNodeIterator e=frames.elements();e.hasMoreNodes() && !found;) { ! frameTag = (FrameTag)e.nextNode(); ! if (frameTag.getFrameName().toUpperCase().equals(frameName.toUpperCase())) found = true; ! } ! if (found) ! return frameTag; else return null; ! } ! /** ! * Sets the frames. ! * @param frames The frames to set ! */ ! public void setFrames(NodeList frames) { ! this.frames = frames; ! } } Index: FrameTag.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tags/FrameTag.java,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** FrameTag.java 24 Aug 2003 21:59:42 -0000 1.22 --- FrameTag.java 3 Sep 2003 23:36:20 -0000 1.23 *************** *** 36,63 **** public class FrameTag extends Tag { ! /** ! * The URL where the image is stored. ! */ ! protected String frameURL; protected String frameName; ! public FrameTag(TagData tagData, String frameURL,String frameName) { ! super(tagData); ! this.frameURL = frameURL; this.frameName = frameName; ! } ! /** ! * Returns the location of the image ! */ ! public String getFrameLocation() { ! return frameURL; ! } ! public String getFrameName() { ! return frameName; ! } ! /** ! * Print the contents of the HTMLFrameTag ! */ ! public String toString() { ! return "FRAME TAG : Image at "+frameURL+"; begins at : "+elementBegin()+"; ends at : "+elementEnd(); ! } } --- 36,63 ---- public class FrameTag extends Tag { ! /** ! * The URL where the image is stored. ! */ ! protected String frameURL; protected String frameName; ! public FrameTag(TagData tagData, String frameURL,String frameName) { ! super(tagData); ! this.frameURL = frameURL; this.frameName = frameName; ! } ! /** ! * Returns the location of the image ! */ ! public String getFrameLocation() { ! return frameURL; ! } ! public String getFrameName() { ! return frameName; ! } ! /** ! * Print the contents of the HTMLFrameTag ! */ ! public String toString() { ! return "FRAME TAG : Image at "+frameURL+"; begins at : "+elementBegin()+"; ends at : "+elementEnd(); ! } } Index: HeadTag.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tags/HeadTag.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** HeadTag.java 24 Aug 2003 21:59:42 -0000 1.11 --- HeadTag.java 3 Sep 2003 23:36:20 -0000 1.12 *************** *** 1,46 **** ! // HTMLParser Library v1_4_20030824 - 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.tags; ! ! import org.htmlparser.tags.data.CompositeTagData; ! import org.htmlparser.tags.data.TagData; ! ! public class HeadTag extends CompositeTag { ! ! public HeadTag(TagData tagData, CompositeTagData compositeTagData) { ! super(tagData, compositeTagData); ! } ! ! public String toString() { ! return "HEAD: " + super.toString(); ! } ! } --- 1,46 ---- ! // HTMLParser Library v1_4_20030824 - 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.tags; ! ! import org.htmlparser.tags.data.CompositeTagData; ! import org.htmlparser.tags.data.TagData; ! ! public class HeadTag extends CompositeTag { ! ! public HeadTag(TagData tagData, CompositeTagData compositeTagData) { ! super(tagData, compositeTagData); ! } ! ! public String toString() { ! return "HEAD: " + super.toString(); ! } ! } Index: Html.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tags/Html.java,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** Html.java 24 Aug 2003 21:59:42 -0000 1.23 --- Html.java 3 Sep 2003 23:36:20 -0000 1.24 *************** *** 34,40 **** public class Html extends CompositeTag { ! public Html(TagData tagData, CompositeTagData compositeTagData) { ! super(tagData, compositeTagData); ! } ! } --- 34,40 ---- public class Html extends CompositeTag { ! public Html(TagData tagData, CompositeTagData compositeTagData) { ! super(tagData, compositeTagData); ! } ! } Index: ImageTag.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tags/ImageTag.java,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** ImageTag.java 24 Aug 2003 21:59:42 -0000 1.23 --- ImageTag.java 3 Sep 2003 23:36:20 -0000 1.24 *************** *** 37,77 **** public class ImageTag extends Tag { ! public static final String IMAGE_TAG_FILTER="-i"; ! /** ! * The URL where the image is stored. ! */ ! protected String imageURL; /** ! * Constructor creates an HTMLImageNode object, which stores the location ! * where the image is to be found. * @param tagData Specifies character position and content of the tag. ! * @param imageURL Location of the image. ! */ ! public ImageTag(TagData tagData,String imageURL) ! { ! super(tagData); ! this.imageURL = imageURL; ! } ! /** ! * Returns the location of the image ! */ ! public String getImageURL() ! { ! return imageURL; ! } ! public String toString() ! { ! return "IMAGE TAG : Image at "+imageURL+"; begins at : "+elementBegin()+"; ends at : "+elementEnd(); ! } ! public void setImageURL(String imageURL) { ! this.imageURL = imageURL; setAttribute ("SRC", imageURL); ! } ! public void accept(NodeVisitor visitor) { ! visitor.visitImageTag(this); ! } } --- 37,77 ---- public class ImageTag extends Tag { ! public static final String IMAGE_TAG_FILTER="-i"; ! /** ! * The URL where the image is stored. ! */ ! protected String imageURL; /** ! * Constructor creates an HTMLImageNode object, which stores the location ! * where the image is to be found. * @param tagData Specifies character position and content of the tag. ! * @param imageURL Location of the image. ! */ ! public ImageTag(TagData tagData,String imageURL) ! { ! super(tagData); ! this.imageURL = imageURL; ! } ! /** ! * Returns the location of the image ! */ ! public String getImageURL() ! { ! return imageURL; ! } ! public String toString() ! { ! return "IMAGE TAG : Image at "+imageURL+"; begins at : "+elementBegin()+"; ends at : "+elementEnd(); ! } ! public void setImageURL(String imageURL) { ! this.imageURL = imageURL; setAttribute ("SRC", imageURL); ! } ! public void accept(NodeVisitor visitor) { ! visitor.visitImageTag(this); ! } } Index: InputTag.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tags/InputTag.java,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** InputTag.java 24 Aug 2003 21:59:42 -0000 1.23 --- InputTag.java 3 Sep 2003 23:36:20 -0000 1.24 *************** *** 34,43 **** public class InputTag extends Tag { ! public InputTag(TagData tagData) { ! super(tagData); ! } ! ! public String toString() { ! return (ParserUtils.toString(this)); ! } } --- 34,43 ---- public class InputTag extends Tag { ! public InputTag(TagData tagData) { ! super(tagData); ! } ! ! public String toString() { ! return (ParserUtils.toString(this)); ! } } Index: JspTag.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tags/JspTag.java,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** JspTag.java 24 Aug 2003 21:59:42 -0000 1.25 --- JspTag.java 3 Sep 2003 23:36:20 -0000 1.26 *************** *** 36,59 **** public class JspTag extends Tag { ! /** ! * The HTMLJspTag is constructed by providing the beginning posn, ending posn ! * and the tag contents. ! * @param tagData The data for this tag. ! */ ! public JspTag(TagData tagData) ! { ! super(tagData); ! } ! ! public String toHtml() { ! return "<%"+tagContents+"%>"; ! } ! ! /** ! * Print the contents of the remark tag. ! */ ! public String toString() ! { ! return "JSP/ASP Tag : "+tagContents+"; begins at : "+elementBegin()+"; ends at : "+elementEnd(); ! } } --- 36,59 ---- public class JspTag extends Tag { ! /** ! * The HTMLJspTag is constructed by providing the beginning posn, ending posn ! * and the tag contents. ! * @param tagData The data for this tag. ! */ ! public JspTag(TagData tagData) ! { ! super(tagData); ! } ! ! public String toHtml() { ! return "<%"+tagContents+"%>"; ! } ! ! /** ! * Print the contents of the remark tag. ! */ ! public String toString() ! { ! return "JSP/ASP Tag : "+tagContents+"; begins at : "+elementBegin()+"; ends at : "+elementEnd(); ! } } Index: LabelTag.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tags/LabelTag.java,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** LabelTag.java 24 Aug 2003 21:59:42 -0000 1.24 --- LabelTag.java 3 Sep 2003 23:36:20 -0000 1.25 *************** *** 37,50 **** public class LabelTag extends CompositeTag { ! public LabelTag(TagData tagData, CompositeTagData compositeTagData) { ! super(tagData, compositeTagData); ! } ! ! public String getLabel() { ! return toPlainTextString(); ! } ! ! public String toString() { ! return "LABEL: "+getLabel(); ! } } --- 37,50 ---- public class LabelTag extends CompositeTag { ! public LabelTag(TagData tagData, CompositeTagData compositeTagData) { ! super(tagData, compositeTagData); ! } ! ! public String getLabel() { ! return toPlainTextString(); ! } ! ! public String toString() { ! return "LABEL: "+getLabel(); ! } } Index: MetaTag.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tags/MetaTag.java,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** MetaTag.java 24 Aug 2003 21:59:42 -0000 1.23 --- MetaTag.java 3 Sep 2003 23:36:20 -0000 1.24 *************** *** 35,71 **** */ public class MetaTag extends Tag { ! private String metaTagName; ! private String metaTagContents; ! private String httpEquiv; ! public MetaTag(TagData tagData, String httpEquiv, String metaTagName,String metaTagContents) { ! super(tagData); ! this.httpEquiv = httpEquiv; ! this.metaTagName = metaTagName; ! this.metaTagContents = metaTagContents; ! } ! public String getHttpEquiv() { ! return httpEquiv; ! } ! public String getMetaContent() { ! return metaTagContents; ! } ! public String getMetaTagName() { ! return metaTagName; ! } ! public void setHttpEquiv(String httpEquiv) { ! this.httpEquiv = httpEquiv; ! } ! public void setMetaTagContents(String metaTagContents) { ! this.metaTagContents = metaTagContents; ! } ! public void setMetaTagName(String metaTagName) { ! this.metaTagName = metaTagName; ! } ! public String toString() { ! return "META TAG\n"+ ! "--------\n"+ ! "Http-Equiv : "+getHttpEquiv()+"\n"+ ! "Name : "+metaTagName+"\n"+ ! "Contents : "+metaTagContents+"\n"; ! } } --- 35,71 ---- */ public class MetaTag extends Tag { ! private String metaTagName; ! private String metaTagContents; ! private String httpEquiv; ! public MetaTag(TagData tagData, String httpEquiv, String metaTagName,String metaTagContents) { ! super(tagData); ! this.httpEquiv = httpEquiv; ! this.metaTagName = metaTagName; ! this.metaTagContents = metaTagContents; ! } ! public String getHttpEquiv() { ! return httpEquiv; ! } ! public String getMetaContent() { ! return metaTagContents; ! } ! public String getMetaTagName() { ! return metaTagName; ! } ! public void setHttpEquiv(String httpEquiv) { ! this.httpEquiv = httpEquiv; ! } ! public void setMetaTagContents(String metaTagContents) { ! this.metaTagContents = metaTagContents; ! } ! public void setMetaTagName(String metaTagName) { ! this.metaTagName = metaTagName; ! } ! public String toString() { ! return "META TAG\n"+ ! "--------\n"+ ! "Http-Equiv : "+getHttpEquiv()+"\n"+ ! "Name : "+metaTagName+"\n"+ ! "Contents : "+metaTagContents+"\n"; ! } } Index: OptionTag.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tags/OptionTag.java,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** OptionTag.java 24 Aug 2003... [truncated message content] |