1 package mir.util.xml.html;
5 public class HTMLSchemaInformation {
8 public HTMLSchemaInformation() {
13 addInlineTag("acronym");
14 addInlineTag("address");
15 addInlineTag("applet");
19 addInlineTag("basefont");
22 addInlineTag("blockquote");
23 addBlockTag("body", new String[] {"head"});
25 addBodylessTag("button");
26 addInlineTag("caption");
27 addInlineTag("center");
31 addInlineTag("colgroup");
40 addInlineTag("fieldset");
41 // Zapata: Removed because of frequent abuse by html writers
42 // addInlineTag("font");
44 addBodylessTag("frame");
45 addInlineTag("frameset");
56 addBlockTag("iframe");
57 addBodylessTag("img");
58 addBodylessTag("input");
60 addInlineTag("isindex");
62 addInlineTag("label");
63 addInlineTag("legend");
68 addBodylessTag("meta");
69 addBlockTag("noframes");
70 addInlineTag("noscript");
71 addBodylessTag("object");
73 addInlineTag("optgroup");
74 addInlineTag("option");
75 addBlockTag("p", new String[] {"p"});
76 addInlineTag("param");
81 addInlineTag("script");
82 addInlineTag("select");
83 addInlineTag("small");
85 addInlineTag("strike");
86 addInlineTag("strong");
87 addInlineTag("style");
92 addBlockTag("td", new String[] {"td", "th"});
93 addInlineTag("textarea");
94 addInlineTag("tfoot");
95 addBlockTag("th", new String[] {"td", "th"});
96 addInlineTag("thead");
97 addInlineTag("title");
98 addBlockTag("tr", new String[] {"td", "th", "tr"});
105 public HTMLTagInformation lookupTag(String aTag) {
106 return (HTMLTagInformation) tags.get(aTag);
109 public void addInlineTag(String aTagName) {
110 addTag(aTagName, false, true, null);
113 public void addBodylessTag(String aTagName) {
114 addTag(aTagName, false, false, null);
117 public void addBlockTag(String aTagName) {
118 addTag(aTagName, true, true, null);
121 public void addBlockTag(String aTagName, String[] anAutoCloseList) {
122 addTag(aTagName, true, true, anAutoCloseList);
125 public void addTag(String aTagName, boolean anIsBlock, boolean aHasBody, String[] anAutoCloseList) {
126 HTMLTagInformation tagInformation = new HTMLTagInformation(aTagName, anIsBlock, aHasBody);
128 if (anAutoCloseList!=null) {
129 for (int i = 0; i < anAutoCloseList.length; i++) {
130 tagInformation.addAutoClosedTag(anAutoCloseList[i]);
134 tags.put(aTagName, tagInformation);
137 public class HTMLTagInformation {
138 private boolean isBlock;
139 private boolean hasBody;
140 private String tagName;
141 private List autoCloseList;
143 public HTMLTagInformation(String aTagName, boolean anIsBlock, boolean aHasBody) {
147 autoCloseList = new ArrayList();
150 void addAutoClosedTag(String aTag) {
151 autoCloseList.add(aTag);
154 public boolean autoClose(String aTag) {
155 return autoCloseList.contains(aTag);
158 public boolean getIsBlock() {
162 public boolean getHasBody() {
166 public String getTagName() {