KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > opensymphony > module > sitemesh > html > Tag


1 package com.opensymphony.module.sitemesh.html;
2
3 import com.opensymphony.module.sitemesh.html.util.CharArray;
4
5 /**
6  * Tag returned by HTMLTagTokenizer. Allows easy access to element name and attributes.
7  *
8  * @see com.opensymphony.module.sitemesh.html.tokenizer.TokenHandler
9  * @see com.opensymphony.module.sitemesh.html.tokenizer.TagTokenizer
10  *
11  * @author Joe Walnes
12  */

13 public interface Tag {
14
15     int OPEN = 1;
16     int CLOSE = 2;
17     int EMPTY = 3;
18     int OPEN_MAGIC_COMMENT = 4;
19     int CLOSE_MAGIC_COMMENT = 5;
20
21     /**
22      * Get the complete tag in its original form, preserving original formatting.
23      *
24      * This has a slight overhead in that it needs to construct a String. For improved performance, use writeTo() instead.
25      *
26      * @see #writeTo(com.opensymphony.module.sitemesh.html.util.CharArray)
27      */

28     String JavaDoc getContents();
29
30     /**
31      * Write out the complete tag in its original form, preserving original formatting.
32      */

33     void writeTo(CharArray out);
34
35     /**
36      * Name of tag (ie. element name).
37      */

38     String JavaDoc getName();
39
40     /**
41      * Type of tag: <br/>
42      * &lt;blah&gt; - Type.OPEN<br/>
43      * &lt;/blah&gt; - Type.CLOSE<br/>
44      * &lt;blah/&gt; - Type.EMPTY<br/>
45      */

46     int getType();
47
48     int getAttributeCount();
49     String JavaDoc getAttributeName(int index);
50     String JavaDoc getAttributeValue(int index);
51     String JavaDoc getAttributeValue(String JavaDoc name);
52     boolean hasAttribute(String JavaDoc name);
53
54 }
55
Popular Tags