sebb        2004/03/24 19:18:34

  Added:       src/htmlparser/org/htmlparser/scanners LinkTagScanner.java
               src/htmlparser/org/htmlparser/tags LinkTagTag.java
  Log:
  New classes to pick up <LINK> tags.

  Seems strange that the tag was not already handled ...
  
  Revision  Changes    Path
  1.1                  
jakarta-jmeter/src/htmlparser/org/htmlparser/scanners/LinkTagScanner.java
  
  Index: LinkTagScanner.java
  ===================================================================
  // $Header: 
/home/cvs/jakarta-jmeter/src/htmlparser/org/htmlparser/scanners/LinkTagScanner.java,v 
1.1 2004/03/25 03:18:34 sebb Exp $
  /*
   * ====================================================================
   * Copyright 2002-2004 The Apache Software Foundation.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *   http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   * 
   */
  
  // The developers of JMeter and Apache are greatful to the developers
  // of HTMLParser for giving Apache Software Foundation a non-exclusive
  // license. The performance benefits of HTMLParser are clear and the
  // users of JMeter will benefit from the hard work the HTMLParser
  // team. For detailed information about HTMLParser, the project is
  // hosted on sourceforge at http://htmlparser.sourceforge.net/.
  //
  // HTMLParser was originally created by Somik Raha in 2000. Since then
  // a healthy community of users has formed and helped refine the
  // design so that it is able to tackle the difficult task of parsing
  // dirty HTML. Derrick Oswald is the current lead developer and was kind
  // enough to assist JMeter.
  
  package org.htmlparser.scanners;
  
  import java.util.Hashtable;
  
  import org.htmlparser.tags.LinkTagTag;
  import org.htmlparser.tags.Tag;
  import org.htmlparser.tags.data.TagData;
  import org.htmlparser.util.ParserException;
  
  public class LinkTagScanner extends TagScanner
  {
      public LinkTagScanner()
      {
          this("");
      }
  
      public LinkTagScanner(String filter)
      {
          super(filter);
      }
  
      public String[] getID()
      {
          String[] ids = new String[1];
          ids[0] = "LINK";
          return ids;
      }
  
      protected Tag createTag(TagData tagData, Tag tag, String url)
          throws ParserException
      {
          Hashtable table = tag.getAttributes();
          String metaTagRel = (String) table.get("REL");
          String metaTagType = (String) table.get("TYPE");
          String httpEquiv = (String) table.get("HREF");
  
          return new LinkTagTag(tagData, httpEquiv, metaTagRel, metaTagType);
      }
  
  }
  
  
  
  1.1                  
jakarta-jmeter/src/htmlparser/org/htmlparser/tags/LinkTagTag.java
  
  Index: LinkTagTag.java
  ===================================================================
  // $Header: 
/home/cvs/jakarta-jmeter/src/htmlparser/org/htmlparser/tags/LinkTagTag.java,v 1.1 
2004/03/25 03:18:34 sebb Exp $
  /*
   * ====================================================================
   * Copyright 2002-2004 The Apache Software Foundation.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *   http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   * 
   */
  
  // The developers of JMeter and Apache are greatful to the developers
  // of HTMLParser for giving Apache Software Foundation a non-exclusive
  // license. The performance benefits of HTMLParser are clear and the
  // users of JMeter will benefit from the hard work the HTMLParser
  // team. For detailed information about HTMLParser, the project is
  // hosted on sourceforge at http://htmlparser.sourceforge.net/.
  //
  // HTMLParser was originally created by Somik Raha in 2000. Since then
  // a healthy community of users has formed and helped refine the
  // design so that it is able to tackle the difficult task of parsing
  // dirty HTML. Derrick Oswald is the current lead developer and was kind
  // enough to assist JMeter.
  
  package org.htmlparser.tags;
  
  import org.htmlparser.tags.data.TagData;
  
  /**
   * A Meta Tag
   */
  public class LinkTagTag extends Tag
  {
      private String linkTagRel;
      private String linkTagType;
      private String linkTagHref;
      public LinkTagTag(
          TagData tagData,
          String linkTagRel,
          String linkTagType,
          String linkTagHref)
      {
          super(tagData);
          this.linkTagRel = linkTagRel;
          this.linkTagType = linkTagType;
          this.linkTagHref = linkTagHref;
      }
      public String getTagRel()
      {
          return linkTagRel;
      }
      public String getLinkHref()
      {
          return linkTagHref;
      }
      public String getLinkTagRel()
      {
          return linkTagRel;
      }
      public void setTagRel(String linkTagRel)
      {
          this.linkTagRel = linkTagRel;
      }
      public void setLinkTagType(String linkTagType)
      {
          this.linkTagType = linkTagType;
      }
      public void setLinkTagRel(String linkTagRel)
      {
          this.linkTagRel = linkTagRel;
      }
      public String toString()
      {
          return "META TAG\n"
              + "--------\n"
              + "Http-Equiv : "
              + getTagRel()
              + "\n"
              + "Name : "
              + linkTagRel
              + "\n"
              + "Contents : "
              + linkTagType
              + "\n";
      }
  }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to