KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > htmlparser > tags > FrameTag


1 // HTMLParser Library $Name: v1_5_20050313 $ - A java-based parser for HTML
2
// http://sourceforge.org/projects/htmlparser
3
// Copyright (C) 2004 Somik Raha
4
//
5
// Revision Control Information
6
//
7
// $Source: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tags/FrameTag.java,v $
8
// $Author: derrickoswald $
9
// $Date: 2004/07/02 00:49:28 $
10
// $Revision: 1.37 $
11
//
12
// This library is free software; you can redistribute it and/or
13
// modify it under the terms of the GNU Lesser General Public
14
// License as published by the Free Software Foundation; either
15
// version 2.1 of the License, or (at your option) any later version.
16
//
17
// This library is distributed in the hope that it will be useful,
18
// but WITHOUT ANY WARRANTY; without even the implied warranty of
19
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20
// Lesser General Public License for more details.
21
//
22
// You should have received a copy of the GNU Lesser General Public
23
// License along with this library; if not, write to the Free Software
24
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25
//
26

27 package org.htmlparser.tags;
28
29 import org.htmlparser.nodes.TagNode;
30
31 /**
32  * Identifies a frame tag
33  */

34 public class FrameTag
35     extends
36         TagNode
37 {
38     /**
39      * The set of names handled by this tag.
40      */

41     private static final String JavaDoc[] mIds = new String JavaDoc[] {"FRAME"};
42
43     /**
44      * Create a new frame tag.
45      */

46     public FrameTag ()
47     {
48     }
49
50     /**
51      * Return the set of names handled by this tag.
52      * @return The names to be matched that create tags of this type.
53      */

54     public String JavaDoc[] getIds ()
55     {
56         return (mIds);
57     }
58
59     /**
60      * Returns the location of the frame.
61      * @return The contents of the SRC attribute converted to an absolute URL.
62      */

63     public String JavaDoc getFrameLocation ()
64     {
65         String JavaDoc ret;
66         
67         ret = getAttribute ("SRC");
68         if (null == ret)
69             ret = "";
70         else if (null != getPage ())
71             ret = getPage ().getAbsoluteURL (ret);
72         
73         return (ret);
74     }
75
76     /**
77      * Sets the location of the frame.
78      * @param url The new frame location.
79      */

80     public void setFrameLocation (String JavaDoc url)
81     {
82         setAttribute ("SRC", url);
83     }
84
85     public String JavaDoc getFrameName()
86     {
87         return (getAttribute ("NAME"));
88     }
89
90     /**
91      * Print the contents of the FrameTag.
92      */

93     public String JavaDoc toString()
94     {
95         return "FRAME TAG : Frame " +getFrameName() + " at "+getFrameLocation()+"; begins at : "+getStartPosition ()+"; ends at : "+getEndPosition ();
96     }
97 }
98
Popular Tags