author | joehw |
Tue, 29 Jul 2014 20:52:36 -0700 | |
changeset 25834 | aba3efbf4ec5 |
parent 12457 | c348e06f0e82 |
permissions | -rw-r--r-- |
6 | 1 |
/* |
2 |
* reserved comment block |
|
3 |
* DO NOT REMOVE OR ALTER! |
|
4 |
*/ |
|
5 |
/* |
|
25834
aba3efbf4ec5
8035467: Xerces Update: Move to Xalan based DOM L3 serializer. Deprecate Xerces' native serializer.
joehw
parents:
12457
diff
changeset
|
6 |
* Licensed to the Apache Software Foundation (ASF) under one or more |
aba3efbf4ec5
8035467: Xerces Update: Move to Xalan based DOM L3 serializer. Deprecate Xerces' native serializer.
joehw
parents:
12457
diff
changeset
|
7 |
* contributor license agreements. See the NOTICE file distributed with |
aba3efbf4ec5
8035467: Xerces Update: Move to Xalan based DOM L3 serializer. Deprecate Xerces' native serializer.
joehw
parents:
12457
diff
changeset
|
8 |
* this work for additional information regarding copyright ownership. |
aba3efbf4ec5
8035467: Xerces Update: Move to Xalan based DOM L3 serializer. Deprecate Xerces' native serializer.
joehw
parents:
12457
diff
changeset
|
9 |
* The ASF licenses this file to You under the Apache License, Version 2.0 |
aba3efbf4ec5
8035467: Xerces Update: Move to Xalan based DOM L3 serializer. Deprecate Xerces' native serializer.
joehw
parents:
12457
diff
changeset
|
10 |
* (the "License"); you may not use this file except in compliance with |
aba3efbf4ec5
8035467: Xerces Update: Move to Xalan based DOM L3 serializer. Deprecate Xerces' native serializer.
joehw
parents:
12457
diff
changeset
|
11 |
* the License. You may obtain a copy of the License at |
6 | 12 |
* |
13 |
* http://www.apache.org/licenses/LICENSE-2.0 |
|
14 |
* |
|
15 |
* Unless required by applicable law or agreed to in writing, software |
|
16 |
* distributed under the License is distributed on an "AS IS" BASIS, |
|
17 |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
18 |
* See the License for the specific language governing permissions and |
|
19 |
* limitations under the License. |
|
20 |
*/ |
|
21 |
||
22 |
||
23 |
// Aug 21, 2000: |
|
24 |
// Fixed bug in isElement and made HTMLdtd public. |
|
25 |
// Contributed by Eric SCHAEFFER" <eschaeffer@posterconseil.com> |
|
26 |
||
27 |
||
28 |
package com.sun.org.apache.xml.internal.serialize; |
|
29 |
||
30 |
import com.sun.org.apache.xerces.internal.dom.DOMMessageFormatter; |
|
31 |
||
32 |
import java.io.InputStream; |
|
33 |
import java.io.InputStreamReader; |
|
34 |
import java.io.BufferedReader; |
|
35 |
import java.util.Hashtable; |
|
36 |
import java.util.Locale; |
|
37 |
||
38 |
||
39 |
/** |
|
40 |
* Utility class for accessing information specific to HTML documents. |
|
41 |
* The HTML DTD is expressed as three utility function groups. Two methods |
|
42 |
* allow for checking whether an element requires an open tag on printing |
|
43 |
* ({@link #isEmptyTag}) or on parsing ({@link #isOptionalClosing}). |
|
44 |
* <P> |
|
45 |
* Two other methods translate character references from name to value and |
|
46 |
* from value to name. A small entities resource is loaded into memory the |
|
47 |
* first time any of these methods is called for fast and efficient access. |
|
48 |
* |
|
25834
aba3efbf4ec5
8035467: Xerces Update: Move to Xalan based DOM L3 serializer. Deprecate Xerces' native serializer.
joehw
parents:
12457
diff
changeset
|
49 |
* @author <a href="mailto:arkin@intalio.com">Assaf Arkin</a> |
6 | 50 |
* |
25834
aba3efbf4ec5
8035467: Xerces Update: Move to Xalan based DOM L3 serializer. Deprecate Xerces' native serializer.
joehw
parents:
12457
diff
changeset
|
51 |
* @deprecated As of JDK 1.9, Xerces 2.9.0, Xerces DOM L3 Serializer implementation |
aba3efbf4ec5
8035467: Xerces Update: Move to Xalan based DOM L3 serializer. Deprecate Xerces' native serializer.
joehw
parents:
12457
diff
changeset
|
52 |
* is replaced by that of Xalan. Main class |
aba3efbf4ec5
8035467: Xerces Update: Move to Xalan based DOM L3 serializer. Deprecate Xerces' native serializer.
joehw
parents:
12457
diff
changeset
|
53 |
* {@link com.sun.org.apache.xml.internal.serialize.DOMSerializerImpl} is replaced |
aba3efbf4ec5
8035467: Xerces Update: Move to Xalan based DOM L3 serializer. Deprecate Xerces' native serializer.
joehw
parents:
12457
diff
changeset
|
54 |
* by {@link com.sun.org.apache.xml.internal.serializer.dom3.LSSerializerImpl}. |
6 | 55 |
*/ |
56 |
public final class HTMLdtd |
|
57 |
{ |
|
58 |
||
59 |
/** |
|
60 |
* Public identifier for HTML 4.01 (Strict) document type. |
|
61 |
*/ |
|
62 |
public static final String HTMLPublicId = "-//W3C//DTD HTML 4.01//EN"; |
|
63 |
||
64 |
/** |
|
65 |
* System identifier for HTML 4.01 (Strict) document type. |
|
66 |
*/ |
|
67 |
public static final String HTMLSystemId = |
|
68 |
"http://www.w3.org/TR/html4/strict.dtd"; |
|
69 |
||
70 |
/** |
|
71 |
* Public identifier for XHTML 1.0 (Strict) document type. |
|
72 |
*/ |
|
73 |
public static final String XHTMLPublicId = |
|
74 |
"-//W3C//DTD XHTML 1.0 Strict//EN"; |
|
75 |
||
76 |
/** |
|
77 |
* System identifier for XHTML 1.0 (Strict) document type. |
|
78 |
*/ |
|
79 |
public static final String XHTMLSystemId = |
|
80 |
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"; |
|
81 |
||
82 |
/** |
|
83 |
* Table of reverse character reference mapping. Character codes are held |
|
84 |
* as single-character strings, mapped to their reference name. |
|
85 |
*/ |
|
86 |
private static Hashtable _byChar; |
|
87 |
||
88 |
||
89 |
/** |
|
90 |
* Table of entity name to value mapping. Entities are held as strings, |
|
91 |
* character references as <TT>Character</TT> objects. |
|
92 |
*/ |
|
93 |
private static Hashtable _byName; |
|
94 |
||
95 |
||
96 |
private static Hashtable _boolAttrs; |
|
97 |
||
98 |
||
99 |
/** |
|
100 |
* Holds element definitions. |
|
101 |
*/ |
|
102 |
private static Hashtable _elemDefs; |
|
103 |
||
104 |
||
105 |
/** |
|
106 |
* Locates the HTML entities file that is loaded upon initialization. |
|
107 |
* This file is a resource loaded with the default class loader. |
|
108 |
*/ |
|
109 |
private static final String ENTITIES_RESOURCE = "HTMLEntities.res"; |
|
110 |
||
111 |
||
112 |
/** |
|
113 |
* Only opening tag should be printed. |
|
114 |
*/ |
|
115 |
private static final int ONLY_OPENING = 0x0001; |
|
116 |
||
117 |
/** |
|
118 |
* Element contains element content only. |
|
119 |
*/ |
|
120 |
private static final int ELEM_CONTENT = 0x0002; |
|
121 |
||
122 |
||
123 |
/** |
|
124 |
* Element preserve spaces. |
|
125 |
*/ |
|
126 |
private static final int PRESERVE = 0x0004; |
|
127 |
||
128 |
||
129 |
/** |
|
130 |
* Optional closing tag. |
|
131 |
*/ |
|
132 |
private static final int OPT_CLOSING = 0x0008; |
|
133 |
||
134 |
||
135 |
/** |
|
136 |
* Element is empty (also means only opening tag) |
|
137 |
*/ |
|
138 |
private static final int EMPTY = 0x0010 | ONLY_OPENING; |
|
139 |
||
140 |
||
141 |
/** |
|
142 |
* Allowed to appear in head. |
|
143 |
*/ |
|
144 |
private static final int ALLOWED_HEAD = 0x0020; |
|
145 |
||
146 |
||
147 |
/** |
|
148 |
* When opened, closes P. |
|
149 |
*/ |
|
150 |
private static final int CLOSE_P = 0x0040; |
|
151 |
||
152 |
||
153 |
/** |
|
154 |
* When opened, closes DD or DT. |
|
155 |
*/ |
|
156 |
private static final int CLOSE_DD_DT = 0x0080; |
|
157 |
||
158 |
||
159 |
/** |
|
160 |
* When opened, closes itself. |
|
161 |
*/ |
|
162 |
private static final int CLOSE_SELF = 0x0100; |
|
163 |
||
164 |
||
165 |
/** |
|
166 |
* When opened, closes another table section. |
|
167 |
*/ |
|
168 |
private static final int CLOSE_TABLE = 0x0200; |
|
169 |
||
170 |
||
171 |
/** |
|
172 |
* When opened, closes TH or TD. |
|
173 |
*/ |
|
174 |
private static final int CLOSE_TH_TD = 0x04000; |
|
175 |
||
176 |
||
177 |
/** |
|
178 |
* Returns true if element is declared to be empty. HTML elements are |
|
179 |
* defines as empty in the DTD, not by the document syntax. |
|
180 |
* |
|
181 |
* @param tagName The element tag name (upper case) |
|
182 |
* @return True if element is empty |
|
183 |
*/ |
|
184 |
public static boolean isEmptyTag( String tagName ) |
|
185 |
{ |
|
186 |
return isElement( tagName, EMPTY ); |
|
187 |
} |
|
188 |
||
189 |
||
190 |
/** |
|
191 |
* Returns true if element is declared to have element content. |
|
192 |
* Whitespaces appearing inside element content will be ignored, |
|
193 |
* other text will simply report an error. |
|
194 |
* |
|
195 |
* @param tagName The element tag name (upper case) |
|
196 |
* @return True if element content |
|
197 |
*/ |
|
198 |
public static boolean isElementContent( String tagName ) |
|
199 |
{ |
|
200 |
return isElement( tagName, ELEM_CONTENT ); |
|
201 |
} |
|
202 |
||
203 |
||
204 |
/** |
|
205 |
* Returns true if element's textual contents preserves spaces. |
|
206 |
* This only applies to PRE and TEXTAREA, all other HTML elements |
|
207 |
* do not preserve space. |
|
208 |
* |
|
209 |
* @param tagName The element tag name (upper case) |
|
210 |
* @return True if element's text content preserves spaces |
|
211 |
*/ |
|
212 |
public static boolean isPreserveSpace( String tagName ) |
|
213 |
{ |
|
214 |
return isElement( tagName, PRESERVE ); |
|
215 |
} |
|
216 |
||
217 |
||
218 |
/** |
|
219 |
* Returns true if element's closing tag is optional and need not |
|
220 |
* exist. An error will not be reported for such elements if they |
|
221 |
* are not closed. For example, <tt>LI</tt> is most often not closed. |
|
222 |
* |
|
223 |
* @param tagName The element tag name (upper case) |
|
224 |
* @return True if closing tag implied |
|
225 |
*/ |
|
226 |
public static boolean isOptionalClosing( String tagName ) |
|
227 |
{ |
|
228 |
return isElement( tagName, OPT_CLOSING ); |
|
229 |
} |
|
230 |
||
231 |
||
232 |
/** |
|
233 |
* Returns true if element's closing tag is generally not printed. |
|
234 |
* For example, <tt>LI</tt> should not print the closing tag. |
|
235 |
* |
|
236 |
* @param tagName The element tag name (upper case) |
|
237 |
* @return True if only opening tag should be printed |
|
238 |
*/ |
|
239 |
public static boolean isOnlyOpening( String tagName ) |
|
240 |
{ |
|
241 |
return isElement( tagName, ONLY_OPENING ); |
|
242 |
} |
|
243 |
||
244 |
||
245 |
/** |
|
246 |
* Returns true if the opening of one element (<tt>tagName</tt>) implies |
|
247 |
* the closing of another open element (<tt>openTag</tt>). For example, |
|
248 |
* every opening <tt>LI</tt> will close the previously open <tt>LI</tt>, |
|
249 |
* and every opening <tt>BODY</tt> will close the previously open <tt>HEAD</tt>. |
|
250 |
* |
|
251 |
* @param tagName The newly opened element |
|
252 |
* @param openTag The already opened element |
|
253 |
* @return True if closing tag closes opening tag |
|
254 |
*/ |
|
255 |
public static boolean isClosing( String tagName, String openTag ) |
|
256 |
{ |
|
257 |
// Several elements are defined as closing the HEAD |
|
258 |
if ( openTag.equalsIgnoreCase( "HEAD" ) ) |
|
259 |
return ! isElement( tagName, ALLOWED_HEAD ); |
|
260 |
// P closes iteself |
|
261 |
if ( openTag.equalsIgnoreCase( "P" ) ) |
|
262 |
return isElement( tagName, CLOSE_P ); |
|
263 |
// DT closes DD, DD closes DT |
|
264 |
if ( openTag.equalsIgnoreCase( "DT" ) || openTag.equalsIgnoreCase( "DD" ) ) |
|
265 |
return isElement( tagName, CLOSE_DD_DT ); |
|
266 |
// LI and OPTION close themselves |
|
267 |
if ( openTag.equalsIgnoreCase( "LI" ) || openTag.equalsIgnoreCase( "OPTION" ) ) |
|
268 |
return isElement( tagName, CLOSE_SELF ); |
|
269 |
// Each of these table sections closes all the others |
|
270 |
if ( openTag.equalsIgnoreCase( "THEAD" ) || openTag.equalsIgnoreCase( "TFOOT" ) || |
|
271 |
openTag.equalsIgnoreCase( "TBODY" ) || openTag.equalsIgnoreCase( "TR" ) || |
|
272 |
openTag.equalsIgnoreCase( "COLGROUP" ) ) |
|
273 |
return isElement( tagName, CLOSE_TABLE ); |
|
274 |
// TD closes TH and TH closes TD |
|
275 |
if ( openTag.equalsIgnoreCase( "TH" ) || openTag.equalsIgnoreCase( "TD" ) ) |
|
276 |
return isElement( tagName, CLOSE_TH_TD ); |
|
277 |
return false; |
|
278 |
} |
|
279 |
||
280 |
||
281 |
/** |
|
282 |
* Returns true if the specified attribute it a URI and should be |
|
283 |
* escaped appropriately. In HTML URIs are escaped differently |
|
284 |
* than normal attributes. |
|
285 |
* |
|
286 |
* @param tagName The element's tag name |
|
287 |
* @param attrName The attribute's name |
|
288 |
*/ |
|
289 |
public static boolean isURI( String tagName, String attrName ) |
|
290 |
{ |
|
291 |
// Stupid checks. |
|
292 |
return ( attrName.equalsIgnoreCase( "href" ) || attrName.equalsIgnoreCase( "src" ) ); |
|
293 |
} |
|
294 |
||
295 |
||
296 |
/** |
|
297 |
* Returns true if the specified attribute is a boolean and should be |
|
298 |
* printed without the value. This applies to attributes that are true |
|
299 |
* if they exist, such as selected (OPTION/INPUT). |
|
300 |
* |
|
301 |
* @param tagName The element's tag name |
|
302 |
* @param attrName The attribute's name |
|
303 |
*/ |
|
304 |
public static boolean isBoolean( String tagName, String attrName ) |
|
305 |
{ |
|
306 |
String[] attrNames; |
|
307 |
||
308 |
attrNames = (String[]) _boolAttrs.get( tagName.toUpperCase(Locale.ENGLISH) ); |
|
309 |
if ( attrNames == null ) |
|
310 |
return false; |
|
311 |
for ( int i = 0 ; i < attrNames.length ; ++i ) |
|
312 |
if ( attrNames[ i ].equalsIgnoreCase( attrName ) ) |
|
313 |
return true; |
|
314 |
return false; |
|
315 |
} |
|
316 |
||
317 |
||
318 |
/** |
|
319 |
* Returns the value of an HTML character reference by its name. If the |
|
320 |
* reference is not found or was not defined as a character reference, |
|
321 |
* returns EOF (-1). |
|
322 |
* |
|
323 |
* @param name Name of character reference |
|
324 |
* @return Character code or EOF (-1) |
|
325 |
*/ |
|
326 |
public static int charFromName( String name ) |
|
327 |
{ |
|
328 |
Object value; |
|
329 |
||
330 |
initialize(); |
|
331 |
value = _byName.get( name ); |
|
332 |
if ( value != null && value instanceof Integer ) |
|
333 |
return ( (Integer) value ).intValue(); |
|
334 |
else |
|
335 |
return -1; |
|
336 |
} |
|
337 |
||
338 |
||
339 |
/** |
|
340 |
* Returns the name of an HTML character reference based on its character |
|
341 |
* value. Only valid for entities defined from character references. If no |
|
342 |
* such character value was defined, return null. |
|
343 |
* |
|
344 |
* @param value Character value of entity |
|
345 |
* @return Entity's name or null |
|
346 |
*/ |
|
347 |
public static String fromChar(int value ) |
|
348 |
{ |
|
349 |
if (value > 0xffff) |
|
350 |
return null; |
|
351 |
||
352 |
String name; |
|
353 |
||
354 |
initialize(); |
|
355 |
name = (String) _byChar.get( new Integer( value ) ); |
|
356 |
return name; |
|
357 |
} |
|
358 |
||
359 |
||
360 |
/** |
|
361 |
* Initialize upon first access. Will load all the HTML character references |
|
362 |
* into a list that is accessible by name or character value and is optimized |
|
363 |
* for character substitution. This method may be called any number of times |
|
364 |
* but will execute only once. |
|
365 |
*/ |
|
366 |
private static void initialize() |
|
367 |
{ |
|
368 |
InputStream is = null; |
|
369 |
BufferedReader reader = null; |
|
370 |
int index; |
|
371 |
String name; |
|
372 |
String value; |
|
373 |
int code; |
|
374 |
String line; |
|
375 |
||
376 |
// Make sure not to initialize twice. |
|
377 |
if ( _byName != null ) |
|
378 |
return; |
|
379 |
try { |
|
380 |
_byName = new Hashtable(); |
|
381 |
_byChar = new Hashtable(); |
|
382 |
is = HTMLdtd.class.getResourceAsStream( ENTITIES_RESOURCE ); |
|
383 |
if ( is == null ) { |
|
384 |
throw new RuntimeException( |
|
385 |
DOMMessageFormatter.formatMessage( |
|
386 |
DOMMessageFormatter.SERIALIZER_DOMAIN, |
|
387 |
"ResourceNotFound", new Object[] {ENTITIES_RESOURCE})); |
|
388 |
} |
|
389 |
reader = new BufferedReader( new InputStreamReader( is, "ASCII" ) ); |
|
390 |
line = reader.readLine(); |
|
391 |
while ( line != null ) { |
|
392 |
if ( line.length() == 0 || line.charAt( 0 ) == '#' ) { |
|
393 |
line = reader.readLine(); |
|
394 |
continue; |
|
395 |
} |
|
396 |
index = line.indexOf( ' ' ); |
|
397 |
if ( index > 1 ) { |
|
398 |
name = line.substring( 0, index ); |
|
399 |
++index; |
|
400 |
if ( index < line.length() ) { |
|
401 |
value = line.substring( index ); |
|
402 |
index = value.indexOf( ' ' ); |
|
403 |
if ( index > 0 ) |
|
404 |
value = value.substring( 0, index ); |
|
405 |
code = Integer.parseInt( value ); |
|
406 |
defineEntity( name, (char) code ); |
|
407 |
} |
|
408 |
} |
|
409 |
line = reader.readLine(); |
|
410 |
} |
|
411 |
is.close(); |
|
412 |
} catch ( Exception except ) { |
|
413 |
throw new RuntimeException( |
|
414 |
DOMMessageFormatter.formatMessage( |
|
415 |
DOMMessageFormatter.SERIALIZER_DOMAIN, |
|
416 |
"ResourceNotLoaded", new Object[] {ENTITIES_RESOURCE, except.toString()})); |
|
417 |
} finally { |
|
418 |
if ( is != null ) { |
|
419 |
try { |
|
420 |
is.close(); |
|
421 |
} catch ( Exception except ) { } |
|
422 |
} |
|
423 |
} |
|
424 |
} |
|
425 |
||
426 |
||
427 |
/** |
|
428 |
* Defines a new character reference. The reference's name and value are |
|
429 |
* supplied. Nothing happens if the character reference is already defined. |
|
430 |
* <P> |
|
431 |
* Unlike internal entities, character references are a string to single |
|
432 |
* character mapping. They are used to map non-ASCII characters both on |
|
433 |
* parsing and printing, primarily for HTML documents. '<amp;' is an |
|
434 |
* example of a character reference. |
|
435 |
* |
|
436 |
* @param name The entity's name |
|
437 |
* @param value The entity's value |
|
438 |
*/ |
|
439 |
private static void defineEntity( String name, char value ) |
|
440 |
{ |
|
441 |
if ( _byName.get( name ) == null ) { |
|
442 |
_byName.put( name, new Integer( value ) ); |
|
443 |
_byChar.put( new Integer( value ), name ); |
|
444 |
} |
|
445 |
} |
|
446 |
||
447 |
||
448 |
private static void defineElement( String name, int flags ) |
|
449 |
{ |
|
450 |
_elemDefs.put( name, new Integer( flags ) ); |
|
451 |
} |
|
452 |
||
453 |
||
454 |
private static void defineBoolean( String tagName, String attrName ) |
|
455 |
{ |
|
456 |
defineBoolean( tagName, new String[] { attrName } ); |
|
457 |
} |
|
458 |
||
459 |
||
460 |
private static void defineBoolean( String tagName, String[] attrNames ) |
|
461 |
{ |
|
462 |
_boolAttrs.put( tagName, attrNames ); |
|
463 |
} |
|
464 |
||
465 |
||
466 |
private static boolean isElement( String name, int flag ) |
|
467 |
{ |
|
468 |
Integer flags; |
|
469 |
||
470 |
flags = (Integer) _elemDefs.get( name.toUpperCase(Locale.ENGLISH) ); |
|
471 |
if ( flags == null ) |
|
472 |
return false; |
|
473 |
else |
|
474 |
return ( ( flags.intValue() & flag ) == flag ); |
|
475 |
} |
|
476 |
||
477 |
||
478 |
static |
|
479 |
{ |
|
480 |
_elemDefs = new Hashtable(); |
|
481 |
defineElement( "ADDRESS", CLOSE_P ); |
|
482 |
defineElement( "AREA", EMPTY ); |
|
483 |
defineElement( "BASE", EMPTY | ALLOWED_HEAD ); |
|
484 |
defineElement( "BASEFONT", EMPTY ); |
|
485 |
defineElement( "BLOCKQUOTE", CLOSE_P ); |
|
486 |
defineElement( "BODY", OPT_CLOSING ); |
|
487 |
defineElement( "BR", EMPTY ); |
|
488 |
defineElement( "COL", EMPTY ); |
|
489 |
defineElement( "COLGROUP", ELEM_CONTENT | OPT_CLOSING | CLOSE_TABLE ); |
|
490 |
defineElement( "DD", OPT_CLOSING | ONLY_OPENING | CLOSE_DD_DT ); |
|
491 |
defineElement( "DIV", CLOSE_P ); |
|
492 |
defineElement( "DL", ELEM_CONTENT | CLOSE_P ); |
|
493 |
defineElement( "DT", OPT_CLOSING | ONLY_OPENING | CLOSE_DD_DT ); |
|
494 |
defineElement( "FIELDSET", CLOSE_P ); |
|
495 |
defineElement( "FORM", CLOSE_P ); |
|
496 |
defineElement( "FRAME", EMPTY | OPT_CLOSING ); |
|
497 |
defineElement( "H1", CLOSE_P ); |
|
498 |
defineElement( "H2", CLOSE_P ); |
|
499 |
defineElement( "H3", CLOSE_P ); |
|
500 |
defineElement( "H4", CLOSE_P ); |
|
501 |
defineElement( "H5", CLOSE_P ); |
|
502 |
defineElement( "H6", CLOSE_P ); |
|
503 |
defineElement( "HEAD", ELEM_CONTENT | OPT_CLOSING ); |
|
504 |
defineElement( "HR", EMPTY | CLOSE_P ); |
|
505 |
defineElement( "HTML", ELEM_CONTENT | OPT_CLOSING ); |
|
506 |
defineElement( "IMG", EMPTY ); |
|
507 |
defineElement( "INPUT", EMPTY ); |
|
508 |
defineElement( "ISINDEX", EMPTY | ALLOWED_HEAD ); |
|
509 |
defineElement( "LI", OPT_CLOSING | ONLY_OPENING | CLOSE_SELF ); |
|
510 |
defineElement( "LINK", EMPTY | ALLOWED_HEAD ); |
|
511 |
defineElement( "MAP", ALLOWED_HEAD ); |
|
512 |
defineElement( "META", EMPTY | ALLOWED_HEAD ); |
|
513 |
defineElement( "OL", ELEM_CONTENT | CLOSE_P ); |
|
514 |
defineElement( "OPTGROUP", ELEM_CONTENT ); |
|
515 |
defineElement( "OPTION", OPT_CLOSING | ONLY_OPENING | CLOSE_SELF ); |
|
516 |
defineElement( "P", OPT_CLOSING | CLOSE_P | CLOSE_SELF ); |
|
517 |
defineElement( "PARAM", EMPTY ); |
|
518 |
defineElement( "PRE", PRESERVE | CLOSE_P ); |
|
519 |
defineElement( "SCRIPT", ALLOWED_HEAD | PRESERVE ); |
|
520 |
defineElement( "NOSCRIPT", ALLOWED_HEAD | PRESERVE ); |
|
521 |
defineElement( "SELECT", ELEM_CONTENT ); |
|
522 |
defineElement( "STYLE", ALLOWED_HEAD | PRESERVE ); |
|
523 |
defineElement( "TABLE", ELEM_CONTENT | CLOSE_P ); |
|
524 |
defineElement( "TBODY", ELEM_CONTENT | OPT_CLOSING | CLOSE_TABLE ); |
|
525 |
defineElement( "TD", OPT_CLOSING | CLOSE_TH_TD ); |
|
526 |
defineElement( "TEXTAREA", PRESERVE ); |
|
527 |
defineElement( "TFOOT", ELEM_CONTENT | OPT_CLOSING | CLOSE_TABLE ); |
|
528 |
defineElement( "TH", OPT_CLOSING | CLOSE_TH_TD ); |
|
529 |
defineElement( "THEAD", ELEM_CONTENT | OPT_CLOSING | CLOSE_TABLE ); |
|
530 |
defineElement( "TITLE", ALLOWED_HEAD ); |
|
531 |
defineElement( "TR", ELEM_CONTENT | OPT_CLOSING | CLOSE_TABLE ); |
|
532 |
defineElement( "UL", ELEM_CONTENT | CLOSE_P ); |
|
533 |
||
534 |
_boolAttrs = new Hashtable(); |
|
535 |
defineBoolean( "AREA", "href" ); |
|
536 |
defineBoolean( "BUTTON", "disabled" ); |
|
537 |
defineBoolean( "DIR", "compact" ); |
|
538 |
defineBoolean( "DL", "compact" ); |
|
539 |
defineBoolean( "FRAME", "noresize" ); |
|
540 |
defineBoolean( "HR", "noshade" ); |
|
541 |
defineBoolean( "IMAGE", "ismap" ); |
|
542 |
defineBoolean( "INPUT", new String[] { "defaultchecked", "checked", "readonly", "disabled" } ); |
|
543 |
defineBoolean( "LINK", "link" ); |
|
544 |
defineBoolean( "MENU", "compact" ); |
|
545 |
defineBoolean( "OBJECT", "declare" ); |
|
546 |
defineBoolean( "OL", "compact" ); |
|
547 |
defineBoolean( "OPTGROUP", "disabled" ); |
|
548 |
defineBoolean( "OPTION", new String[] { "default-selected", "selected", "disabled" } ); |
|
549 |
defineBoolean( "SCRIPT", "defer" ); |
|
550 |
defineBoolean( "SELECT", new String[] { "multiple", "disabled" } ); |
|
551 |
defineBoolean( "STYLE", "disabled" ); |
|
552 |
defineBoolean( "TD", "nowrap" ); |
|
553 |
defineBoolean( "TH", "nowrap" ); |
|
554 |
defineBoolean( "TEXTAREA", new String[] { "disabled", "readonly" } ); |
|
555 |
defineBoolean( "UL", "compact" ); |
|
556 |
||
557 |
initialize(); |
|
558 |
} |
|
559 |
||
560 |
||
561 |
||
562 |
} |