Source Code Cross Referenced for AttributeTable.java in  » HTML-Parser » JTidy » org » w3c » tidy » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » HTML Parser » JTidy » org.w3c.tidy 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         *  Java HTML Tidy - JTidy
003:         *  HTML parser and pretty printer
004:         *
005:         *  Copyright (c) 1998-2000 World Wide Web Consortium (Massachusetts
006:         *  Institute of Technology, Institut National de Recherche en
007:         *  Informatique et en Automatique, Keio University). All Rights
008:         *  Reserved.
009:         *
010:         *  Contributing Author(s):
011:         *
012:         *     Dave Raggett <dsr@w3.org>
013:         *     Andy Quick <ac.quick@sympatico.ca> (translation to Java)
014:         *     Gary L Peskin <garyp@firstech.com> (Java development)
015:         *     Sami Lempinen <sami@lempinen.net> (release management)
016:         *     Fabrizio Giustina <fgiust at users.sourceforge.net>
017:         *
018:         *  The contributing author(s) would like to thank all those who
019:         *  helped with testing, bug fixes, and patience.  This wouldn't
020:         *  have been possible without all of you.
021:         *
022:         *  COPYRIGHT NOTICE:
023:         * 
024:         *  This software and documentation is provided "as is," and
025:         *  the copyright holders and contributing author(s) make no
026:         *  representations or warranties, express or implied, including
027:         *  but not limited to, warranties of merchantability or fitness
028:         *  for any particular purpose or that the use of the software or
029:         *  documentation will not infringe any third party patents,
030:         *  copyrights, trademarks or other rights. 
031:         *
032:         *  The copyright holders and contributing author(s) will not be
033:         *  liable for any direct, indirect, special or consequential damages
034:         *  arising out of any use of the software or documentation, even if
035:         *  advised of the possibility of such damage.
036:         *
037:         *  Permission is hereby granted to use, copy, modify, and distribute
038:         *  this source code, or portions hereof, documentation and executables,
039:         *  for any purpose, without fee, subject to the following restrictions:
040:         *
041:         *  1. The origin of this source code must not be misrepresented.
042:         *  2. Altered versions must be plainly marked as such and must
043:         *     not be misrepresented as being the original source.
044:         *  3. This Copyright notice may not be removed or altered from any
045:         *     source or altered source distribution.
046:         * 
047:         *  The copyright holders and contributing author(s) specifically
048:         *  permit, without fee, and encourage the use of this source code
049:         *  as a component for supporting the Hypertext Markup Language in
050:         *  commercial products. If you use this source code in a product,
051:         *  acknowledgment is not required but would be appreciated.
052:         *
053:         */
054:        package org.w3c.tidy;
055:
056:        import java.util.Hashtable;
057:        import java.util.Map;
058:
059:        /**
060:         * HTML attribute hash table.
061:         * @author Dave Raggett <a href="mailto:dsr@w3.org">dsr@w3.org </a>
062:         * @author Andy Quick <a href="mailto:ac.quick@sympatico.ca">ac.quick@sympatico.ca </a> (translation to Java)
063:         * @author Fabrizio Giustina
064:         * @version $Revision: 1.21 $ ($Author: fgiust $)
065:         */
066:        public class AttributeTable {
067:
068:            /**
069:             * href attribute.
070:             */
071:            protected static Attribute attrHref;
072:
073:            /**
074:             * src attribute.
075:             */
076:            protected static Attribute attrSrc;
077:
078:            /**
079:             * id attribute.
080:             */
081:            protected static Attribute attrId;
082:
083:            /**
084:             * name attribute.
085:             */
086:            protected static Attribute attrName;
087:
088:            /**
089:             * summary attribute.
090:             */
091:            protected static Attribute attrSummary;
092:
093:            /**
094:             * alt attribute.
095:             */
096:            protected static Attribute attrAlt;
097:
098:            /**
099:             * logdesc attribute.
100:             */
101:            protected static Attribute attrLongdesc;
102:
103:            /**
104:             * usemap attribute.
105:             */
106:            protected static Attribute attrUsemap;
107:
108:            /**
109:             * ismap attribute.
110:             */
111:            protected static Attribute attrIsmap;
112:
113:            /**
114:             * language attribute.
115:             */
116:            protected static Attribute attrLanguage;
117:
118:            /**
119:             * type attribute.
120:             */
121:            protected static Attribute attrType;
122:
123:            /**
124:             * title attribute.
125:             */
126:            protected static Attribute attrTitle;
127:
128:            /**
129:             * xmlns attribute.
130:             */
131:            protected static Attribute attrXmlns;
132:
133:            /**
134:             * value attribute.
135:             */
136:            protected static Attribute attrValue;
137:
138:            /**
139:             * content attribute.
140:             */
141:            protected static Attribute attrContent;
142:
143:            /**
144:             * datafld attribute.
145:             */
146:            protected static Attribute attrDatafld;
147:
148:            /**
149:             * width attribute.
150:             */
151:            protected static Attribute attrWidth;
152:
153:            /**
154:             * height attribute.
155:             */
156:            protected static Attribute attrHeight;
157:
158:            /**
159:             * attribute table instance.
160:             */
161:            private static AttributeTable defaultAttributeTable;
162:
163:            /**
164:             * all the known attributes.
165:             */
166:            private static final Attribute[] ATTRS = {
167:                    new Attribute("abbr", Dict.VERS_HTML40, AttrCheckImpl.TEXT),
168:                    new Attribute("accept-charset", Dict.VERS_HTML40,
169:                            AttrCheckImpl.CHARSET),
170:                    new Attribute("accept", Dict.VERS_ALL, AttrCheckImpl.TYPE),
171:                    new Attribute("accesskey", Dict.VERS_HTML40,
172:                            AttrCheckImpl.CHARACTER),
173:                    new Attribute("action", Dict.VERS_ALL, AttrCheckImpl.URL),
174:                    new Attribute("add_date", Dict.VERS_NETSCAPE,
175:                            AttrCheckImpl.TEXT), // A
176:                    new Attribute("align", Dict.VERS_ALL, AttrCheckImpl.ALIGN), // set varies with element
177:                    new Attribute("alink", Dict.VERS_LOOSE, AttrCheckImpl.COLOR),
178:                    new Attribute("alt", Dict.VERS_ALL, AttrCheckImpl.TEXT),
179:                    new Attribute("archive", Dict.VERS_HTML40,
180:                            AttrCheckImpl.URLS), // space or comma separated list
181:                    new Attribute("axis", Dict.VERS_HTML40, AttrCheckImpl.TEXT),
182:                    new Attribute("background", Dict.VERS_LOOSE,
183:                            AttrCheckImpl.URL),
184:                    new Attribute("bgcolor", Dict.VERS_LOOSE,
185:                            AttrCheckImpl.COLOR),
186:                    new Attribute("bgproperties", Dict.VERS_PROPRIETARY,
187:                            AttrCheckImpl.TEXT), // BODY "fixed" fixes background
188:                    new Attribute("border", Dict.VERS_ALL, AttrCheckImpl.BOOL), // like LENGTH + "border"
189:                    new Attribute("bordercolor", Dict.VERS_MICROSOFT,
190:                            AttrCheckImpl.COLOR), // used on TABLE
191:                    new Attribute("bottommargin", Dict.VERS_MICROSOFT,
192:                            AttrCheckImpl.NUMBER), // used on BODY
193:                    new Attribute("cellpadding", Dict.VERS_FROM32,
194:                            AttrCheckImpl.LENGTH), // % or pixel values
195:                    new Attribute("cellspacing", Dict.VERS_FROM32,
196:                            AttrCheckImpl.LENGTH),
197:                    new Attribute("char", Dict.VERS_HTML40,
198:                            AttrCheckImpl.CHARACTER),
199:                    new Attribute("charoff", Dict.VERS_HTML40,
200:                            AttrCheckImpl.LENGTH),
201:                    new Attribute("charset", Dict.VERS_HTML40,
202:                            AttrCheckImpl.CHARSET),
203:                    new Attribute("checked", Dict.VERS_ALL, AttrCheckImpl.BOOL), // i.e. "checked" or absent
204:                    new Attribute("cite", Dict.VERS_HTML40, AttrCheckImpl.URL),
205:                    new Attribute("class", Dict.VERS_HTML40, AttrCheckImpl.TEXT),
206:                    new Attribute("classid", Dict.VERS_HTML40,
207:                            AttrCheckImpl.URL),
208:                    new Attribute("clear", Dict.VERS_LOOSE, AttrCheckImpl.CLEAR), // BR: left, right, all
209:                    new Attribute("code", Dict.VERS_LOOSE, AttrCheckImpl.TEXT), // APPLET
210:                    new Attribute("codebase", Dict.VERS_HTML40,
211:                            AttrCheckImpl.URL), // OBJECT
212:                    new Attribute("codetype", Dict.VERS_HTML40,
213:                            AttrCheckImpl.TYPE), // OBJECT
214:                    new Attribute("color", Dict.VERS_LOOSE, AttrCheckImpl.COLOR), // BASEFONT, FONT
215:                    new Attribute("cols", Dict.VERS_IFRAME, AttrCheckImpl.COLS), // TABLE & FRAMESET
216:                    new Attribute("colspan", Dict.VERS_FROM32,
217:                            AttrCheckImpl.NUMBER),
218:                    new Attribute("compact", Dict.VERS_ALL, AttrCheckImpl.BOOL), // lists
219:                    new Attribute("content", Dict.VERS_ALL, AttrCheckImpl.TEXT), // META
220:                    new Attribute("coords", Dict.VERS_FROM32,
221:                            AttrCheckImpl.COORDS), // AREA, A
222:                    new Attribute("data", Dict.VERS_HTML40, AttrCheckImpl.URL), // OBJECT
223:                    new Attribute("datafld", Dict.VERS_MICROSOFT,
224:                            AttrCheckImpl.TEXT), // used on DIV, IMG
225:                    new Attribute("dataformatas", Dict.VERS_MICROSOFT,
226:                            AttrCheckImpl.TEXT), // used on DIV, IMG
227:                    new Attribute("datapagesize", Dict.VERS_MICROSOFT,
228:                            AttrCheckImpl.NUMBER), // used on DIV, IMG
229:                    new Attribute("datasrc", Dict.VERS_MICROSOFT,
230:                            AttrCheckImpl.URL), // used on TABLE
231:                    new Attribute("datetime", Dict.VERS_HTML40,
232:                            AttrCheckImpl.DATE), // INS, DEL
233:                    new Attribute("declare", Dict.VERS_HTML40,
234:                            AttrCheckImpl.BOOL), // OBJECT
235:                    new Attribute("defer", Dict.VERS_HTML40, AttrCheckImpl.BOOL), // SCRIPT
236:                    new Attribute("dir", Dict.VERS_HTML40,
237:                            AttrCheckImpl.TEXTDIR), // ltr or rtl
238:                    new Attribute("disabled", Dict.VERS_HTML40,
239:                            AttrCheckImpl.BOOL), // form fields
240:                    new Attribute("enctype", Dict.VERS_ALL, AttrCheckImpl.TYPE), // FORM
241:                    new Attribute("face", Dict.VERS_LOOSE, AttrCheckImpl.TEXT), // BASEFONT, FONT
242:                    new Attribute("for", Dict.VERS_HTML40, AttrCheckImpl.IDREF), // LABEL
243:                    new Attribute("frame", Dict.VERS_HTML40,
244:                            AttrCheckImpl.TFRAME), // TABLE
245:                    new Attribute("frameborder",
246:                            (short) (Dict.VERS_FRAMESET | Dict.VERS_IFRAME),
247:                            AttrCheckImpl.FBORDER), // 0 or 1
248:                    new Attribute("framespacing", Dict.VERS_PROPRIETARY,
249:                            AttrCheckImpl.NUMBER), // pixel value
250:                    new Attribute("gridx", Dict.VERS_PROPRIETARY,
251:                            AttrCheckImpl.NUMBER), // TABLE Adobe golive
252:                    new Attribute("gridy", Dict.VERS_PROPRIETARY,
253:                            AttrCheckImpl.NUMBER), // TABLE Adobe golive
254:                    new Attribute("headers", Dict.VERS_HTML40,
255:                            AttrCheckImpl.IDREF), // table cells
256:                    new Attribute("height", Dict.VERS_ALL, AttrCheckImpl.LENGTH), // pixels only for TH/TD
257:                    new Attribute("href", Dict.VERS_ALL, AttrCheckImpl.URL), // A, AREA, LINK and BASE
258:                    new Attribute("hreflang", Dict.VERS_HTML40,
259:                            AttrCheckImpl.LANG), // A, LINK
260:                    new Attribute("hspace", Dict.VERS_ALL, AttrCheckImpl.NUMBER), // APPLET, IMG, OBJECT
261:                    new Attribute("http-equiv", Dict.VERS_ALL,
262:                            AttrCheckImpl.TEXT), // META
263:                    new Attribute("id", Dict.VERS_HTML40, AttrCheckImpl.ID),
264:                    new Attribute("ismap", Dict.VERS_ALL, AttrCheckImpl.BOOL), // IMG
265:                    new Attribute("label", Dict.VERS_HTML40, AttrCheckImpl.TEXT), // OPT, OPTGROUP
266:                    new Attribute("lang", Dict.VERS_HTML40, AttrCheckImpl.LANG),
267:                    new Attribute("language", Dict.VERS_LOOSE,
268:                            AttrCheckImpl.TEXT), // SCRIPT
269:                    new Attribute("last_modified", Dict.VERS_NETSCAPE,
270:                            AttrCheckImpl.TEXT), // A
271:                    new Attribute("last_visit", Dict.VERS_NETSCAPE,
272:                            AttrCheckImpl.TEXT), // A
273:                    new Attribute("leftmargin", Dict.VERS_MICROSOFT,
274:                            AttrCheckImpl.NUMBER), // used on BODY
275:                    new Attribute("link", Dict.VERS_LOOSE, AttrCheckImpl.COLOR), // BODY
276:                    new Attribute("longdesc", Dict.VERS_HTML40,
277:                            AttrCheckImpl.URL), // IMG
278:                    new Attribute("lowsrc", Dict.VERS_PROPRIETARY,
279:                            AttrCheckImpl.URL), // IMG
280:                    new Attribute("marginheight", Dict.VERS_IFRAME,
281:                            AttrCheckImpl.NUMBER), // FRAME, IFRAME, BODY
282:                    new Attribute("marginwidth", Dict.VERS_IFRAME,
283:                            AttrCheckImpl.NUMBER), // ditto
284:                    new Attribute("maxlength", Dict.VERS_ALL,
285:                            AttrCheckImpl.NUMBER), // INPUT
286:                    new Attribute("media", Dict.VERS_HTML40,
287:                            AttrCheckImpl.MEDIA), // STYLE, LINK
288:                    new Attribute("method", Dict.VERS_ALL,
289:                            AttrCheckImpl.FSUBMIT), // FORM: get or post
290:                    new Attribute("multiple", Dict.VERS_ALL, AttrCheckImpl.BOOL), // SELECT
291:                    new Attribute("name", Dict.VERS_ALL, AttrCheckImpl.NAME),
292:                    new Attribute("nohref", Dict.VERS_FROM32,
293:                            AttrCheckImpl.BOOL), // AREA
294:                    new Attribute("noresize", Dict.VERS_FRAMESET,
295:                            AttrCheckImpl.BOOL), // FRAME
296:                    new Attribute("noshade", Dict.VERS_LOOSE,
297:                            AttrCheckImpl.BOOL), // HR
298:                    new Attribute("nowrap", Dict.VERS_LOOSE, AttrCheckImpl.BOOL), // table cells
299:                    new Attribute("object", Dict.VERS_HTML40_LOOSE,
300:                            AttrCheckImpl.TEXT), // APPLET
301:                    new Attribute("onblur", Dict.VERS_EVENTS,
302:                            AttrCheckImpl.SCRIPT), // event
303:                    new Attribute("onchange", Dict.VERS_EVENTS,
304:                            AttrCheckImpl.SCRIPT), // event
305:                    new Attribute("onclick", Dict.VERS_EVENTS,
306:                            AttrCheckImpl.SCRIPT), // event
307:                    new Attribute("ondblclick", Dict.VERS_EVENTS,
308:                            AttrCheckImpl.SCRIPT), // event
309:                    new Attribute("onkeydown", Dict.VERS_EVENTS,
310:                            AttrCheckImpl.SCRIPT), // event
311:                    new Attribute("onkeypress", Dict.VERS_EVENTS,
312:                            AttrCheckImpl.SCRIPT), // event
313:                    new Attribute("onkeyup", Dict.VERS_EVENTS,
314:                            AttrCheckImpl.SCRIPT), // event
315:                    new Attribute("onload", Dict.VERS_EVENTS,
316:                            AttrCheckImpl.SCRIPT), // event
317:                    new Attribute("onmousedown", Dict.VERS_EVENTS,
318:                            AttrCheckImpl.SCRIPT), // event
319:                    new Attribute("onmousemove", Dict.VERS_EVENTS,
320:                            AttrCheckImpl.SCRIPT), // event
321:                    new Attribute("onmouseout", Dict.VERS_EVENTS,
322:                            AttrCheckImpl.SCRIPT), // event
323:                    new Attribute("onmouseover", Dict.VERS_EVENTS,
324:                            AttrCheckImpl.SCRIPT), // event
325:                    new Attribute("onmouseup", Dict.VERS_EVENTS,
326:                            AttrCheckImpl.SCRIPT), // event
327:                    new Attribute("onsubmit", Dict.VERS_EVENTS,
328:                            AttrCheckImpl.SCRIPT), // event
329:                    new Attribute("onreset", Dict.VERS_EVENTS,
330:                            AttrCheckImpl.SCRIPT), // event
331:                    new Attribute("onselect", Dict.VERS_EVENTS,
332:                            AttrCheckImpl.SCRIPT), // event
333:                    new Attribute("onunload", Dict.VERS_EVENTS,
334:                            AttrCheckImpl.SCRIPT), // event
335:                    new Attribute("onfocus", Dict.VERS_EVENTS,
336:                            AttrCheckImpl.SCRIPT), // event
337:                    new Attribute("onafterupdate", Dict.VERS_MICROSOFT,
338:                            AttrCheckImpl.SCRIPT), // form fields
339:                    new Attribute("onbeforeupdate", Dict.VERS_MICROSOFT,
340:                            AttrCheckImpl.SCRIPT), // form fields
341:                    new Attribute("onerrorupdate", Dict.VERS_MICROSOFT,
342:                            AttrCheckImpl.SCRIPT), // form fields
343:                    new Attribute("onrowenter", Dict.VERS_MICROSOFT,
344:                            AttrCheckImpl.SCRIPT), // form fields
345:                    new Attribute("onrowexit", Dict.VERS_MICROSOFT,
346:                            AttrCheckImpl.SCRIPT), // form fields
347:                    new Attribute("onbeforeunload", Dict.VERS_MICROSOFT,
348:                            AttrCheckImpl.SCRIPT), // form fields
349:                    new Attribute("ondatasetchanged", Dict.VERS_MICROSOFT,
350:                            AttrCheckImpl.SCRIPT), // object, applet
351:                    new Attribute("ondataavailable", Dict.VERS_MICROSOFT,
352:                            AttrCheckImpl.SCRIPT), // object, applet
353:                    new Attribute("ondatasetcomplete", Dict.VERS_MICROSOFT,
354:                            AttrCheckImpl.SCRIPT), // object, applet
355:                    new Attribute("profile", Dict.VERS_HTML40,
356:                            AttrCheckImpl.URL), // HEAD
357:                    new Attribute("prompt", Dict.VERS_LOOSE, AttrCheckImpl.TEXT), // ISINDEX
358:                    new Attribute("readonly", Dict.VERS_HTML40,
359:                            AttrCheckImpl.BOOL), // form fields
360:                    new Attribute("rel", Dict.VERS_ALL, AttrCheckImpl.LINKTYPES), // A, LINK
361:                    new Attribute("rev", Dict.VERS_ALL, AttrCheckImpl.LINKTYPES), // A, LINK
362:                    new Attribute("rightmargin", Dict.VERS_MICROSOFT,
363:                            AttrCheckImpl.NUMBER), // used on BODY
364:                    new Attribute("rows", Dict.VERS_ALL, AttrCheckImpl.NUMBER), // TEXTAREA
365:                    new Attribute("rowspan", Dict.VERS_ALL,
366:                            AttrCheckImpl.NUMBER), // table cells
367:                    new Attribute("rules", Dict.VERS_HTML40,
368:                            AttrCheckImpl.TRULES), // TABLE
369:                    new Attribute("scheme", Dict.VERS_HTML40,
370:                            AttrCheckImpl.TEXT), // META
371:                    new Attribute("scope", Dict.VERS_HTML40,
372:                            AttrCheckImpl.SCOPE), // table cells
373:                    new Attribute("scrolling", Dict.VERS_IFRAME,
374:                            AttrCheckImpl.SCROLL), // yes, no or auto
375:                    new Attribute("selected", Dict.VERS_ALL, AttrCheckImpl.BOOL), // OPTION
376:                    new Attribute("shape", Dict.VERS_FROM32,
377:                            AttrCheckImpl.SHAPE), // AREA, A
378:                    new Attribute("showgrid", Dict.VERS_PROPRIETARY,
379:                            AttrCheckImpl.BOOL), // TABLE Adobe golive
380:                    new Attribute("showgridx", Dict.VERS_PROPRIETARY,
381:                            AttrCheckImpl.BOOL), // TABLE Adobe golive
382:                    new Attribute("showgridy", Dict.VERS_PROPRIETARY,
383:                            AttrCheckImpl.BOOL), // TABLE Adobe golive
384:                    new Attribute("size", Dict.VERS_LOOSE, AttrCheckImpl.NUMBER), // HR, FONT, BASEFONT, SELECT
385:                    new Attribute("span", Dict.VERS_HTML40,
386:                            AttrCheckImpl.NUMBER), // COL, COLGROUP
387:                    new Attribute("src", Dict.VERS_ALL, AttrCheckImpl.URL), // IMG, FRAME, IFRAME
388:                    new Attribute("standby", Dict.VERS_HTML40,
389:                            AttrCheckImpl.TEXT), // OBJECT
390:                    new Attribute("start", Dict.VERS_ALL, AttrCheckImpl.NUMBER), // OL
391:                    new Attribute("style", Dict.VERS_HTML40, AttrCheckImpl.TEXT),
392:                    new Attribute("summary", Dict.VERS_HTML40,
393:                            AttrCheckImpl.TEXT), // TABLE
394:                    new Attribute("tabindex", Dict.VERS_HTML40,
395:                            AttrCheckImpl.NUMBER), // fields, OBJECT and A
396:                    new Attribute("target", Dict.VERS_HTML40,
397:                            AttrCheckImpl.TARGET), // names a frame/window
398:                    new Attribute("text", Dict.VERS_LOOSE, AttrCheckImpl.COLOR), // BODY
399:                    new Attribute("title", Dict.VERS_HTML40, AttrCheckImpl.TEXT), // text tool tip
400:                    new Attribute("topmargin", Dict.VERS_MICROSOFT,
401:                            AttrCheckImpl.NUMBER), // used on BODY
402:                    new Attribute("type", Dict.VERS_FROM32, AttrCheckImpl.TYPE), // also used by SPACER
403:                    new Attribute("usemap", Dict.VERS_ALL, AttrCheckImpl.BOOL), // things with images
404:                    new Attribute("valign", Dict.VERS_FROM32,
405:                            AttrCheckImpl.VALIGN),
406:                    new Attribute("value", Dict.VERS_ALL, AttrCheckImpl.TEXT), // OPTION, PARAM
407:                    new Attribute("valuetype", Dict.VERS_HTML40,
408:                            AttrCheckImpl.VTYPE), // PARAM: data, ref, object
409:                    new Attribute("version", Dict.VERS_ALL, AttrCheckImpl.TEXT), // HTML
410:                    new Attribute("vlink", Dict.VERS_LOOSE, AttrCheckImpl.COLOR), // BODY
411:                    new Attribute("vspace", Dict.VERS_LOOSE,
412:                            AttrCheckImpl.NUMBER), // IMG, OBJECT, APPLET
413:                    new Attribute("width", Dict.VERS_ALL, AttrCheckImpl.LENGTH), // pixels only for TD/TH
414:                    new Attribute("wrap", Dict.VERS_NETSCAPE,
415:                            AttrCheckImpl.TEXT), // textarea
416:                    new Attribute("xml:lang", Dict.VERS_XML, AttrCheckImpl.TEXT), // XML language
417:                    new Attribute("xml:space", Dict.VERS_XML,
418:                            AttrCheckImpl.TEXT), // XML language
419:                    new Attribute("xmlns", Dict.VERS_ALL, AttrCheckImpl.TEXT), // name space
420:                    new Attribute("rbspan", Dict.VERS_XHTML11,
421:                            AttrCheckImpl.NUMBER), // ruby markup
422:            };
423:
424:            /**
425:             * Map containing all the installed attributes.
426:             */
427:            private Map attributeHashtable = new Hashtable();
428:
429:            /**
430:             * lookup an installed Attribute.
431:             * @param name attribute name
432:             * @return Attribute or null if the attribute is not found
433:             */
434:            public Attribute lookup(String name) {
435:                return (Attribute) this .attributeHashtable.get(name);
436:            }
437:
438:            /**
439:             * installs a new Attribute.
440:             * @param attr Atribute
441:             * @return installed Attribute
442:             */
443:            public Attribute install(Attribute attr) {
444:                return (Attribute) this .attributeHashtable.put(attr.getName(),
445:                        attr);
446:            }
447:
448:            /**
449:             * public method for finding attribute definition by name.
450:             * @param attval AttVal instance
451:             * @return Attribute with name = attval.name
452:             */
453:            public Attribute findAttribute(AttVal attval) {
454:                Attribute np;
455:
456:                if (attval.attribute != null) {
457:                    np = lookup(attval.attribute);
458:                    return np;
459:                }
460:
461:                return null;
462:            }
463:
464:            /**
465:             * Does the given attibute contains an url?
466:             * @param attrname attribute name
467:             * @return <code>true</code> if the given attribute is expected to contain an URL
468:             */
469:            public boolean isUrl(String attrname) {
470:                Attribute np;
471:
472:                np = lookup(attrname);
473:                return (np != null && np.getAttrchk() == AttrCheckImpl.URL);
474:            }
475:
476:            /**
477:             * Does the given attibute contains a script?
478:             * @param attrname attribute name
479:             * @return <code>true</code> if the given attribute is expected to contain a script
480:             */
481:            public boolean isScript(String attrname) {
482:                Attribute np;
483:
484:                np = lookup(attrname);
485:                return (np != null && np.getAttrchk() == AttrCheckImpl.SCRIPT);
486:            }
487:
488:            /**
489:             * Does the given attibute contains a literal attribute?
490:             * @param attrname attribute name
491:             * @return <code>true</code> if the given attribute is expected to contain a literal attribute
492:             */
493:            public boolean isLiteralAttribute(String attrname) {
494:                Attribute np;
495:
496:                np = lookup(attrname);
497:                return (np != null && np.isLiteral());
498:            }
499:
500:            /**
501:             * Declare a new literal attribute.
502:             * @param name atribute name
503:             */
504:            public void declareLiteralAttrib(String name) {
505:                // Henry Zrepa reports that some folk are using embed with script attributes where newlines are signficant.
506:                // These
507:                // need to be declared and handled specially!
508:                Attribute attrib = lookup(name);
509:
510:                if (attrib == null) {
511:                    attrib = install(new Attribute(name, Dict.VERS_PROPRIETARY,
512:                            null));
513:                }
514:
515:                attrib.setLiteral(true);
516:            }
517:
518:            /**
519:             * Returns the default attribute table instance.
520:             * @return AttributeTable instance
521:             */
522:            public static AttributeTable getDefaultAttributeTable() {
523:                if (defaultAttributeTable == null) {
524:                    defaultAttributeTable = new AttributeTable();
525:                    for (int i = 0; i < ATTRS.length; i++) {
526:                        defaultAttributeTable.install(ATTRS[i]);
527:                    }
528:                    attrHref = defaultAttributeTable.lookup("href");
529:                    attrSrc = defaultAttributeTable.lookup("src");
530:                    attrId = defaultAttributeTable.lookup("id");
531:                    attrName = defaultAttributeTable.lookup("name");
532:                    attrSummary = defaultAttributeTable.lookup("summary");
533:                    attrAlt = defaultAttributeTable.lookup("alt");
534:                    attrLongdesc = defaultAttributeTable.lookup("longdesc");
535:                    attrUsemap = defaultAttributeTable.lookup("usemap");
536:                    attrIsmap = defaultAttributeTable.lookup("ismap");
537:                    attrLanguage = defaultAttributeTable.lookup("language");
538:                    attrType = defaultAttributeTable.lookup("type");
539:                    attrTitle = defaultAttributeTable.lookup("title");
540:                    attrXmlns = defaultAttributeTable.lookup("xmlns");
541:                    attrValue = defaultAttributeTable.lookup("value");
542:                    attrContent = defaultAttributeTable.lookup("content");
543:                    attrDatafld = defaultAttributeTable.lookup("datafld");
544:                    attrWidth = defaultAttributeTable.lookup("width");
545:                    attrHeight = defaultAttributeTable.lookup("height");
546:
547:                    attrAlt.setNowrap(true);
548:                    attrValue.setNowrap(true);
549:                    attrContent.setNowrap(true);
550:                }
551:                return defaultAttributeTable;
552:            }
553:
554:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.