Annotation of Amaya/amaya/XHTMLbuilder.c, revision 1.9
1.1 cvs 1: /*
2: *
3: * (c) COPYRIGHT MIT and INRIA, 1996.
4: * Please first read the full copyright statement in file COPYRIGHT.
5: *
6: */
7:
8: /*
9: *
10: * html2thot parses a HTML file and builds the corresponding abstract tree
11: * for a Thot document of type HTML.
12: *
13: * Author: V. Quint
14: * L. Carcone
15: */
16:
17: #define THOT_EXPORT extern
18: #include "amaya.h"
19: #include "css.h"
1.2 cvs 20: #include "parser.h"
21: #include "HTML.h"
22:
1.1 cvs 23: #include "HTMLactions_f.h"
24: #include "HTMLedit_f.h"
25: #include "HTMLimage_f.h"
26: #include "HTMLtable_f.h"
27: #include "HTMLimage_f.h"
28: #include "UIcss_f.h"
1.2 cvs 29: #include "XHTMLbuilder_f.h"
1.6 cvs 30: #include "fetchXMLname_f.h"
1.1 cvs 31: #include "styleparser_f.h"
1.2 cvs 32: #include "css_f.h"
1.1 cvs 33:
34: /* maximum length of a Thot structure schema name */
35: #define MAX_SS_NAME_LENGTH 32
36:
1.9 ! cvs 37: #ifdef EXPAT_PARSER
1.1 cvs 38:
1.2 cvs 39: typedef CHAR_T XhtmlEntityName[10];
40: typedef struct _XhtmlEntity
41: {
42: XhtmlEntityName charName; /* entity name */
43: int charCode; /* decimal code of ISO-Latin1 char */
1.1 cvs 44: }
1.2 cvs 45: XhtmlEntity;
1.1 cvs 46:
1.2 cvs 47: XhtmlEntity XhtmlEntityTable[] =
1.1 cvs 48: {
49: /* This table MUST be in alphabetical order */
50: {TEXT("AElig"), 198}, /* latin capital letter AE = */
51: /* latin capital ligature AE, U+00C6 ISOlat1 */
52: {TEXT("Aacute"), 193}, /* latin capital letter A with acute, U+00C1 ISOlat1 */
53: {TEXT("Acirc"), 194}, /* latin capital letter A with circumflex, U+00C2 ISOlat1 */
54: {TEXT("Agrave"), 192}, /* latin capital letter A with grave = */
55: /* latin capital letter A grave, U+00C0 ISOlat1 */
56: {TEXT("Alpha"), 913}, /* greek capital letter alpha, U+0391 */
57: {TEXT("Aring"), 197}, /* latin capital letter A with ring above = */
58: /* latin capital letter A ring, U+00C5 ISOlat1 */
59: {TEXT("Atilde"), 195}, /* latin capital letter A with tilde, U+00C3 ISOlat1 */
60: {TEXT("Auml"), 196}, /* latin capital letter A with diaeresis, U+00C4 ISOlat1 */
61: {TEXT("Beta"), 914}, /* greek capital letter beta, U+0392 */
62: {TEXT("Ccedil"), 199}, /* latin capital letter C with cedilla, U+00C7 ISOlat1 */
63: {TEXT("Chi"), 935}, /* greek capital letter chi, U+03A7 */
64: {TEXT("Dagger"), 8225}, /* double dagger, U+2021 ISOpub */
65: {TEXT("Delta"), 916}, /* greek capital letter delta, U+0394 ISOgrk3 */
66: {TEXT("ETH"), 208}, /* latin capital letter ETH, U+00D0 ISOlat1 */
67: {TEXT("Eacute"), 201}, /* latin capital letter E with acute, U+00C9 ISOlat1 */
68: {TEXT("Ecirc"), 202}, /* latin capital letter E with circumflex, U+00CA ISOlat1 */
69: {TEXT("Egrave"), 200}, /* latin capital letter E with grave, U+00C8 ISOlat1 */
70: {TEXT("Epsilon"), 917}, /* greek capital letter epsilon, U+0395 */
71: {TEXT("Eta"), 919}, /* greek capital letter eta, U+0397 */
72: {TEXT("Euml"), 203}, /* latin capital letter E with diaeresis, U+00CB ISOlat1 */
73: {TEXT("Gamma"), 915}, /* greek capital letter gamma, U+0393 ISOgrk3 */
74: {TEXT("Iacute"), 205}, /* latin capital letter I with acute, U+00CD ISOlat1 */
75: {TEXT("Icirc"), 206}, /* latin capital letter I with circumflex, U+00CE ISOlat1 */
76: {TEXT("Igrave"), 204}, /* latin capital letter I with grave, U+00CC ISOlat1 */
77: {TEXT("Iota"), 921}, /* greek capital letter iota, U+0399 */
78: {TEXT("Iuml"), 207}, /* latin capital letter I with diaeresis, U+00CF ISOlat1 */
79: {TEXT("Kappa"), 922}, /* greek capital letter kappa, U+039A */
80: {TEXT("Lambda"), 923}, /* greek capital letter lambda, U+039B ISOgrk3 */
81: {TEXT("Mu"), 924}, /* greek capital letter mu, U+039C */
82: {TEXT("Ntilde"), 209}, /* latin capital letter N with tilde, U+00D1 ISOlat1 */
83: {TEXT("Nu"), 925}, /* greek capital letter nu, U+039D */
84: {TEXT("OElig"), 338}, /* latin capital ligature OE, U+0152 ISOlat2 */
85: {TEXT("Oacute"), 211}, /* latin capital letter O with acute, U+00D3 ISOlat1 */
86: {TEXT("Ocirc"), 212}, /* latin capital letter O with circumflex, U+00D4 ISOlat1 */
87: {TEXT("Ograve"), 210}, /* latin capital letter O with grave, U+00D2 ISOlat1 */
88: {TEXT("Omega"), 937}, /* greek capital letter omega, U+03A9 ISOgrk3 */
89: {TEXT("Omicron"), 927}, /* greek capital letter omicron, U+039F */
90: {TEXT("Oslash"), 216}, /* latin capital letter O with stroke = */
91: /* latin capital letter O slash, U+00D8 ISOlat1 */
92: {TEXT("Otilde"), 213}, /* latin capital letter O with tilde, U+00D5 ISOlat1 */
93: {TEXT("Ouml"), 214}, /* latin capital letter O with diaeresis, U+00D6 ISOlat1 */
94: {TEXT("Phi"), 934}, /* greek capital letter phi, U+03A6 ISOgrk3 */
95: {TEXT("Pi"), 928}, /* greek capital letter pi, U+03A0 ISOgrk3 */
96: {TEXT("Prime"), 8243}, /* double prime = seconds = inches, U+2033 ISOtech */
97: {TEXT("Psi"), 936}, /* greek capital letter psi, U+03A8 ISOgrk3 */
98: {TEXT("Rho"), 929}, /* greek capital letter rho, U+03A1 */
99: {TEXT("Scaron"), 352}, /* latin capital letter S with caron, U+0160 ISOlat2 */
100: {TEXT("Sigma"), 931}, /* greek capital letter sigma, U+03A3 ISOgrk3 */
101: {TEXT("THORN"), 222}, /* latin capital letter THORN, U+00DE ISOlat1 */
102: {TEXT("Tau"), 932}, /* greek capital letter tau, U+03A4 */
103: {TEXT("Theta"), 920}, /* greek capital letter theta, U+0398 ISOgrk3 */
104: {TEXT("Uacute"), 218}, /* latin capital letter U with acute, U+00DA ISOlat1 */
105: {TEXT("Ucirc"), 219}, /* latin capital letter U with circumflex, U+00DB ISOlat1 */
106: {TEXT("Ugrave"), 217}, /* latin capital letter U with grave, U+00D9 ISOlat1 */
107: {TEXT("Upsilon"), 933}, /* greek capital letter upsilon, U+03A5 ISOgrk3 */
108: {TEXT("Uuml"), 220}, /* latin capital letter U with diaeresis, U+00DC ISOlat1 */
109: {TEXT("Xi"), 926}, /* greek capital letter xi, U+039E ISOgrk3 */
110: {TEXT("Yacute"), 221}, /* latin capital letter Y with acute, U+00DD ISOlat1 */
111: {TEXT("Yuml"), 376}, /* latin capital letter Y with diaeresis, U+0178 ISOlat2 */
112: {TEXT("Zeta"), 918}, /* greek capital letter zeta, U+0396 */
113: {TEXT("aacute"), 225}, /* latin small letter a with acute, U+00E1 ISOlat1 */
114: {TEXT("acirc"), 226}, /* latin small letter a with circumflex, U+00E2 ISOlat1 */
115: {TEXT("acute"), 180}, /* acute accent = spacing acute, U+00B4 ISOdia */
116: {TEXT("aelig"), 230}, /* latin small letter ae = */
117: /* latin small ligature ae, U+00E6 ISOlat1 */
118: {TEXT("agrave"), 224}, /* latin small letter a with grave = */
119: /* latin small letter a grave, U+00E0 ISOlat1 */
120: {TEXT("alefsym"), 8501},/* alef symbol = first transfinite cardinal, U+2135 NEW */
121: {TEXT("alpha"), 945}, /* greek small letter alpha, U+03B1 ISOgrk3 */
122: {TEXT("amp"), 38}, /* ampersand, U+0026 ISOnum */
123: {TEXT("and"), 8743}, /* logical and = wedge, U+2227 ISOtech */
124: {TEXT("ang"), 8736}, /* angle, U+2220 ISOamso */
125: {TEXT("aring"), 229}, /* latin small letter a with ring above = */
126: /* latin small letter a ring, U+00E5 ISOlat1 */
127: {TEXT("asymp"), 8776}, /* almost equal to = asymptotic to, U+2248 ISOamsr */
128: {TEXT("atilde"), 227}, /* latin small letter a with tilde, U+00E3 ISOlat1 */
129: {TEXT("auml"), 228}, /* latin small letter a with diaeresis, U+00E4 ISOlat1 */
130: {TEXT("bdquo"), 8222}, /* double low-9 quotation mark, U+201E NEW */
131: {TEXT("beta"), 946}, /* greek small letter beta, U+03B2 ISOgrk3 */
132: {TEXT("brvbar"), 166}, /* broken bar = broken vertical bar, U+00A6 ISOnum */
133: {TEXT("bull"), 8226}, /* bullet = black small circle, U+2022 ISOpub */
134: {TEXT("cap"), 8745}, /* intersection = cap, U+2229 ISOtech */
135: {TEXT("ccedil"), 231}, /* latin small letter c with cedilla, U+00E7 ISOlat1 */
136: {TEXT("cedil"), 184}, /* cedilla = spacing cedilla, U+00B8 ISOdia */
137: {TEXT("cent"), 162}, /* cent sign, U+00A2 ISOnum */
138: {TEXT("chi"), 967}, /* greek small letter chi, U+03C7 ISOgrk3 */
139: {TEXT("circ"), 710}, /* modifier letter circumflex accent, U+02C6 ISOpub */
140: {TEXT("clubs"), 9827}, /* black club suit = shamrock, U+2663 ISOpub */
141: {TEXT("cong"), 8773}, /* approximately equal to, U+2245 ISOtech */
142: {TEXT("copy"), 169}, /* copyright sign, U+00A9 ISOnum */
143: {TEXT("crarr"), 8629}, /* downwards arrow with corner leftwards = */
144: /* carriage return, U+21B5 NEW */
145: {TEXT("cup"), 8746}, /* union = cup, U+222A ISOtech */
146: {TEXT("curren"), 164}, /* currency sign, U+00A4 ISOnum */
147: {TEXT("dArr"), 8659}, /* downwards double arrow, U+21D3 ISOamsa */
148: {TEXT("dagger"), 8224}, /* dagger, U+2020 ISOpub */
149: {TEXT("darr"), 8595}, /* downwards arrow, U+2193 ISOnum */
150: {TEXT("deg"), 176}, /* degree sign, U+00B0 ISOnum */
151: {TEXT("delta"), 948}, /* greek small letter delta, U+03B4 ISOgrk3 */
152: {TEXT("diams"), 9830}, /* black diamond suit, U+2666 ISOpub */
153: {TEXT("divide"), 247}, /* division sign, U+00F7 ISOnum */
154: {TEXT("eacute"), 233}, /* latin small letter e with acute, U+00E9 ISOlat1 */
155: {TEXT("ecirc"), 234}, /* latin small letter e with circumflex, U+00EA ISOlat1 */
156: {TEXT("egrave"), 232}, /* latin small letter e with grave, U+00E8 ISOlat1 */
157: {TEXT("empty"), 8709}, /* empty set = null set = diameter, U+2205 ISOamso */
158: {TEXT("emsp"), 8195}, /* em space, U+2003 ISOpub */
159: {TEXT("ensp"), 8194}, /* en space, U+2002 ISOpub */
160: {TEXT("epsilon"), 949}, /* greek small letter epsilon, U+03B5 ISOgrk3 */
161: {TEXT("equiv"), 8801}, /* identical to, U+2261 ISOtech */
162: {TEXT("eta"), 951}, /* greek small letter eta, U+03B7 ISOgrk3 */
163: {TEXT("eth"), 240}, /* latin small letter eth, U+00F0 ISOlat1 */
164: {TEXT("euml"), 235}, /* latin small letter e with diaeresis, U+00EB ISOlat1 */
165: {TEXT("euro"), 8364}, /* euro sign, U+20AC NEW */
166: {TEXT("exist"), 8707}, /* there exists, U+2203 ISOtech */
167: {TEXT("fnof"), 402}, /* latin small f with hook = function = */
168: /* florin, U+0192 ISOtech */
169: {TEXT("forall"), 8704}, /* for all, U+2200 ISOtech */
170: {TEXT("frac12"), 189}, /* vulgar fraction one half = */
171: /*fraction one half, U+00BD ISOnum */
172: {TEXT("frac14"), 188}, /* vulgar fraction one quarter = */
173: /* fraction one quarter, U+00BC ISOnum */
174: {TEXT("frac34"), 190}, /* vulgar fraction three quarters = */
175: /* fraction three quarters, U+00BE ISOnum */
176: {TEXT("frasl"), 8260}, /* fraction slash, U+2044 NEW */
177: {TEXT("gamma"), 947}, /* greek small letter gamma, U+03B3 ISOgrk3 */
178: {TEXT("ge"), 8805}, /* greater-than or equal to, U+2265 ISOtech */
179: {TEXT("gt"), 62}, /* greater-than sign, U+003E ISOnum */
180: {TEXT("hArr"), 8660}, /* left right double arrow, U+21D4 ISOamsa */
181: {TEXT("harr"), 8596}, /* left right arrow, U+2194 ISOamsa */
182: {TEXT("hearts"), 9829}, /* black heart suit = valentine, U+2665 ISOpub */
183: {TEXT("hellip"), 8230}, /* horizontal ellipsis = three dot leader, U+2026 ISOpub */
184: {TEXT("hyphen"), 173}, /* hyphen = discretionary hyphen, U+00AD ISOnum */
185: {TEXT("iacute"), 237}, /* latin small letter i with acute, U+00ED ISOlat1 */
186: {TEXT("icirc"), 238}, /* latin small letter i with circumflex, U+00EE ISOlat1 */
187: {TEXT("iexcl"), 161}, /* inverted exclamation mark, U+00A1 ISOnum */
188: {TEXT("igrave"), 236}, /* latin small letter i with grave, U+00EC ISOlat1 */
189: {TEXT("image"), 8465}, /* blackletter capital I = imaginary part, U+2111 ISOamso */
190: {TEXT("infin"), 8734}, /* infinity, U+221E ISOtech */
191: {TEXT("int"), 8747}, /* integral, U+222B ISOtech */
192: {TEXT("iota"), 953}, /* greek small letter iota, U+03B9 ISOgrk3 */
193: {TEXT("iquest"), 191}, /* inverted question mark = */
194: /* turned question mark, U+00BF ISOnum */
195: {TEXT("isin"), 8712}, /* element of, U+2208 ISOtech */
196: {TEXT("iuml"), 239}, /* latin small letter i with diaeresis, U+00EF ISOlat1 */
197: {TEXT("kappa"), 954}, /* greek small letter kappa, U+03BA ISOgrk3 */
198: {TEXT("lArr"), 8656}, /* leftwards double arrow, U+21D0 ISOtech */
199: {TEXT("lambda"), 955}, /* greek small letter lambda, U+03BB ISOgrk3 */
200: {TEXT("lang"), 9001}, /* left-pointing angle bracket = bra, U+2329 ISOtech */
201: {TEXT("laquo"), 171}, /* left-pointing double angle quotation mark = */
202: /* left pointing guillemet, U+00AB ISOnum */
203: {TEXT("larr"), 8592}, /* leftwards arrow, U+2190 ISOnum */
204: {TEXT("lceil"), 8968}, /* left ceiling = apl upstile, U+2308 ISOamsc */
205: {TEXT("ldquo"), 8220}, /* left double quotation mark, U+201C ISOnum */
206: {TEXT("le"), 8804}, /* less-than or equal to, U+2264 ISOtech */
207: {TEXT("lfloor"), 8970}, /* left floor = apl downstile, U+230A ISOamsc */
208: {TEXT("lowast"), 8727}, /* asterisk operator, U+2217 ISOtech */
209: {TEXT("loz"), 9674}, /* lozenge, U+25CA ISOpub */
210: {TEXT("lrm"), 8206}, /* left-to-right mark, U+200E NEW RFC 2070 */
211: {TEXT("lsaquo"), 8249}, /* single left-pointing angle quotation mark, */
212: /* U+2039 ISO proposed */
213: {TEXT("lsquo"), 8216}, /* left single quotation mark, U+2018 ISOnum */
214: {TEXT("lt"), 60}, /* less-than sign, U+003C ISOnum */
215: {TEXT("macr"), 175}, /* macron = spacing macron = overline = APL overbar, */
216: /* U+00AF ISOdia */
217: {TEXT("mdash"), 8212}, /* em dash, U+2014 ISOpub */
218: {TEXT("micro"), 181}, /* micro sign, U+00B5 ISOnum */
219: {TEXT("middot"), 183}, /* middle dot = Georgian comma = */
220: /* Greek middle dot, U+00B7 ISOnum */
221: {TEXT("minus"), 8722}, /* minus sign, U+2212 ISOtech */
222: {TEXT("mu"), 956}, /* greek small letter mu, U+03BC ISOgrk3 */
223: {TEXT("nabla"), 8711}, /* nabla = backward difference, U+2207 ISOtech */
224: {TEXT("nbsp"), 160}, /* no-break space = non-breaking space, U+00A0 ISOnum */
225: {TEXT("ndash"), 8211}, /* en dash, U+2013 ISOpub */
226: {TEXT("ne"), 8800}, /* not equal to, U+2260 ISOtech */
227: {TEXT("ni"), 8715}, /* contains as member, U+220B ISOtech */
228: {TEXT("not"), 172}, /* not sign, U+00AC ISOnum */
229: {TEXT("notin"), 8713}, /* not an element of, U+2209 ISOtech */
230: {TEXT("nsub"), 8836}, /* not a subset of, U+2284 ISOamsn */
231: {TEXT("ntilde"), 241}, /* latin small letter n with tilde, U+00F1 ISOlat1 */
232: {TEXT("nu"), 957}, /* greek small letter nu, U+03BD ISOgrk3 */
233: {TEXT("oacute"), 243}, /* latin small letter o with acute, U+00F3 ISOlat1 */
234: {TEXT("ocirc"), 244}, /* latin small letter o with circumflex, U+00F4 ISOlat1 */
235: {TEXT("oelig"), 339}, /* latin small ligature oe, U+0153 ISOlat2 */
236: {TEXT("ograve"), 242}, /* latin small letter o with grave, U+00F2 ISOlat1 */
237: {TEXT("oline"), 8254}, /* overline = spacing overscore, U+203E NEW */
238: {TEXT("omega"), 969}, /* greek small letter omega, U+03C9 ISOgrk3 */
239: {TEXT("omicron"), 959}, /* greek small letter omicron, U+03BF NEW */
240: {TEXT("oplus"), 8853}, /* circled plus = direct sum, U+2295 ISOamsb */
241: {TEXT("or"), 8744}, /* logical or = vee, U+2228 ISOtech */
242: {TEXT("ordf"), 170}, /* feminine ordinal indicator, U+00AA ISOnum */
243: {TEXT("ordm"), 186}, /* masculine ordinal indicator, U+00BA ISOnum */
244: {TEXT("oslash"), 248}, /* latin small letter o with stroke, = */
245: /* latin small letter o slash, U+00F8 ISOlat1 */
246: {TEXT("otilde"), 245}, /* latin small letter o with tilde, U+00F5 ISOlat1 */
247: {TEXT("otimes"), 8855}, /* circled times = vector product, U+2297 ISOamsb */
248: {TEXT("ouml"), 246}, /* latin small letter o with diaeresis, U+00F6 ISOlat1 */
249: {TEXT("para"), 182}, /* pilcrow sign = paragraph sign, U+00B6 ISOnum */
250: {TEXT("part"), 8706}, /* partial differential, U+2202 ISOtech */
251: {TEXT("permil"), 8240}, /* per mille sign, U+2030 ISOtech */
252: {TEXT("perp"), 8869}, /* up tack = orthogonal to = perpendicular, U+22A5 ISOtech */
253: {TEXT("phi"), 966}, /* greek small letter phi, U+03C6 ISOgrk3 */
254: {TEXT("pi"), 960}, /* greek small letter pi, U+03C0 ISOgrk3 */
255: {TEXT("piv"), 982}, /* greek pi symbol, U+03D6 ISOgrk3 */
256: {TEXT("plusmn"), 177}, /* plus-minus sign = plus-or-minus sign, U+00B1 ISOnum */
257: {TEXT("pound"), 163}, /* pound sign, U+00A3 ISOnum */
258: {TEXT("prime"), 8242}, /* prime = minutes = feet, U+2032 ISOtech */
259: {TEXT("prod"), 8719}, /* n-ary product = product sign, U+220F ISOamsb */
260: {TEXT("prop"), 8733}, /* proportional to, U+221D ISOtech */
261: {TEXT("psi"), 968}, /* greek small letter psi, U+03C8 ISOgrk3 */
262: {TEXT("quot"), 34}, /* quotation mark = APL quote, U+0022 ISOnum */
263: {TEXT("rArr"), 8658}, /* rightwards double arrow, U+21D2 ISOtech */
264: {TEXT("radic"), 8730}, /* square root = radical sign, U+221A ISOtech */
265: {TEXT("rang"), 9002}, /* right-pointing angle bracket = ket, U+232A ISOtech */
266: {TEXT("raquo"), 187}, /* right-pointing double angle quotation mark = */
267: /* right pointing guillemet, U+00BB ISOnum */
268: {TEXT("rarr"), 8594}, /* rightwards arrow, U+2192 ISOnum */
269: {TEXT("rceil"), 8969}, /* right ceiling, U+2309 ISOamsc */
270: {TEXT("rdquo"), 8221}, /* right double quotation mark, U+201D ISOnum */
271: {TEXT("real"), 8476}, /* blackletter capital R = real part symbol, U+211C ISOamso */
272: {TEXT("reg"), 174}, /* registered sign = registered trade mark sign, */
273: /* U+00AE ISOnum */
274: {TEXT("rfloor"), 8971}, /* right floor, U+230B ISOamsc */
275: {TEXT("rho"), 961}, /* greek small letter rho, U+03C1 ISOgrk3 */
276: {TEXT("rlm"), 8207}, /* right-to-left mark, U+200F NEW RFC 2070 */
277: {TEXT("rsaquo"), 8250}, /* single right-pointing angle quotation mark, */
278: /* U+203A ISO proposed */
279: {TEXT("rsquo"), 8217}, /* right single quotation mark, U+2019 ISOnum */
280: {TEXT("sbquo"), 8218}, /* single low-9 quotation mark, U+201A NEW */
281: {TEXT("scaron"), 353}, /* latin small letter s with caron, U+0161 ISOlat2 */
282: {TEXT("sdot"), 8901}, /* dot operator, U+22C5 ISOamsb */
283: {TEXT("sect"), 167}, /* section sign, U+00A7 ISOnum */
284: {TEXT("shy"), 173}, /* soft hyphen = discretionary hyphen, U+00AD ISOnum */
285: {TEXT("sigma"), 963}, /* greek small letter sigma, U+03C3 ISOgrk3 */
286: {TEXT("sigmaf"), 962}, /* greek small letter final sigma, U+03C2 ISOgrk3 */
287: {TEXT("sim"), 8764}, /* tilde operator = varies with = similar to, U+223C ISOtech */
288: {TEXT("spades"), 9824}, /* black spade suit, U+2660 ISOpub */
289: {TEXT("sub"), 8834}, /* subset of, U+2282 ISOtech */
290: {TEXT("sube"), 8838}, /* subset of or equal to, U+2286 ISOtech */
291: {TEXT("sum"), 8721}, /* n-ary sumation, U+2211 ISOamsb */
292: {TEXT("sup"), 8835}, /* superset of, U+2283 ISOtech */
293: {TEXT("sup1"), 185}, /* superscript one = superscript digit one, U+00B9 ISOnum */
294: {TEXT("sup2"), 178}, /* superscript two = superscript digit two = squared, */
295: /* U+00B2 ISOnum */
296: {TEXT("sup3"), 179}, /* superscript three = superscript digit three = cubed, */
297: /* U+00B3 ISOnum */
298: {TEXT("supe"), 8839}, /* superset of or equal to, U+2287 ISOtech */
299: {TEXT("szlig"), 223}, /* latin small letter sharp s = ess-zed, U+00DF ISOlat1 */
300: {TEXT("tau"), 964}, /* greek small letter tau, U+03C4 ISOgrk3 */
301: {TEXT("there4"), 8756}, /* therefore, U+2234 ISOtech */
302: {TEXT("theta"), 952}, /* greek small letter theta, U+03B8 ISOgrk3 */
303: {TEXT("thetasym"), 977},/* greek small letter theta symbol, U+03D1 NEW */
304: {TEXT("thinsp"), 8201}, /* thin space, U+2009 ISOpub */
305: {TEXT("thorn"), 254}, /* latin small letter thorn with, U+00FE ISOlat1 */
306: {TEXT("tilde"), 732}, /* small tilde, U+02DC ISOdia */
307: {TEXT("times"), 215}, /* multiplication sign, U+00D7 ISOnum */
308: {TEXT("trade"), 8482}, /* trade mark sign, U+2122 ISOnum */
309: {TEXT("uArr"), 8657}, /* upwards double arrow, U+21D1 ISOamsa */
310: {TEXT("uacute"), 250}, /* latin small letter u with acute, U+00FA ISOlat1 */
311: {TEXT("uarr"), 8593}, /* upwards arrow, U+2191 ISOnum*/
312: {TEXT("ucirc"), 251}, /* latin small letter u with circumflex, U+00FB ISOlat1 */
313: {TEXT("ugrave"), 249}, /* latin small letter u with grave, U+00F9 ISOlat1 */
314: {TEXT("uml"), 168}, /* diaeresis = spacing diaeresis, U+00A8 ISOdia */
315: {TEXT("upsih"), 978}, /* greek upsilon with hook symbol, U+03D2 NEW */
316: {TEXT("upsilon"), 965}, /* greek small letter upsilon, U+03C5 ISOgrk3 */
317: {TEXT("uuml"), 252}, /* latin small letter u with diaeresis, U+00FC ISOlat1 */
318: {TEXT("weierp"), 8472}, /* script capital P = power set = Weierstrass p, */
319: /* U+2118 ISOamso */
320: {TEXT("xi"), 958}, /* greek small letter xi, U+03BE ISOgrk3 */
321: {TEXT("yacute"), 253}, /* latin small letter y with acute, U+00FD ISOlat1 */
322: {TEXT("yen"), 165}, /* yen sign = yuan sign, U+00A5 ISOnum */
323: {TEXT("yuml"), 255}, /* latin small letter y with diaeresis, U+00FF ISOlat1 */
324: {TEXT("zeta"), 950}, /* greek small letter zeta, U+03B6 ISOgrk3 */
325: {TEXT("zwj"), 8205}, /* zero width joiner, U+200D NEW RFC 2070 */
326: {TEXT("zwnj"), 8204}, /* zero width non-joiner, U+200C NEW RFC 2070 */
327: {TEXT("zzzz"), 0} /* this last entry is required */
328: };
329:
1.2 cvs 330: #define DummyAttribute 500
331: static AttributeMapping XhtmlAttributeMappingTable[] =
1.1 cvs 332: {
1.2 cvs 333: /* The first entry MUST be unknown_attr */
334: {TEXT("unknown_attr"), TEXT(""), 'A', HTML_ATTR_Invalid_attribute},
1.1 cvs 335:
1.2 cvs 336: {TEXT("abbr"), TEXT(""), 'A', HTML_ATTR_abbr},
337: {TEXT("accept"), TEXT(""), 'A', HTML_ATTR_accept},
338: {TEXT("accept-charset"), TEXT("form"), 'A', HTML_ATTR_accept_charset},
339: {TEXT("accesskey"), TEXT(""), 'A', HTML_ATTR_accesskey},
340: {TEXT("action"), TEXT(""), 'A', HTML_ATTR_Script_URL},
1.8 cvs 341: #ifndef XHTML_BASIC
1.2 cvs 342: {TEXT("align"), TEXT("applet"), 'A', HTML_ATTR_Alignment},
343: {TEXT("align"), TEXT("caption"), 'A', HTML_ATTR_Position},
344: {TEXT("align"), TEXT("col"), 'A', HTML_ATTR_Cell_align},
345: {TEXT("align"), TEXT("colgroup"), 'A', HTML_ATTR_Cell_align},
346: {TEXT("align"), TEXT("div"), 'A', HTML_ATTR_TextAlign},
347: {TEXT("align"), TEXT("h1"), 'A', HTML_ATTR_TextAlign},
348: {TEXT("align"), TEXT("h2"), 'A', HTML_ATTR_TextAlign},
349: {TEXT("align"), TEXT("h3"), 'A', HTML_ATTR_TextAlign},
350: {TEXT("align"), TEXT("h4"), 'A', HTML_ATTR_TextAlign},
351: {TEXT("align"), TEXT("h5"), 'A', HTML_ATTR_TextAlign},
352: {TEXT("align"), TEXT("h6"), 'A', HTML_ATTR_TextAlign},
353: {TEXT("align"), TEXT("hr"), 'A', HTML_ATTR_Align},
354: {TEXT("align"), TEXT("iframe"), 'A', HTML_ATTR_Alignment},
355: {TEXT("align"), TEXT("image"), 'A', HTML_ATTR_Alignment},
356: {TEXT("align"), TEXT("img"), 'A', HTML_ATTR_Alignment},
357: {TEXT("align"), TEXT("input"), 'A', HTML_ATTR_Alignment},
358: {TEXT("align"), TEXT("legend"), 'A', HTML_ATTR_LAlign},
359: {TEXT("align"), TEXT("object"), 'A', HTML_ATTR_Alignment},
360: {TEXT("align"), TEXT("p"), 'A', HTML_ATTR_TextAlign},
361: {TEXT("align"), TEXT("table"), 'A', HTML_ATTR_Align},
362: {TEXT("align"), TEXT("tbody"), 'A', HTML_ATTR_Cell_align},
363: {TEXT("align"), TEXT("td"), 'A', HTML_ATTR_Cell_align},
364: {TEXT("align"), TEXT("tfoot"), 'A', HTML_ATTR_Cell_align},
365: {TEXT("align"), TEXT("th"), 'A', HTML_ATTR_Cell_align},
366: {TEXT("align"), TEXT("thead"), 'A', HTML_ATTR_Cell_align},
367: {TEXT("align"), TEXT("tr"), 'A', HTML_ATTR_Cell_align},
368: {TEXT("alink"), TEXT("body"), 'A', HTML_ATTR_ActiveLinkColor},
1.8 cvs 369: #endif /* XHTML_BASIC */
1.2 cvs 370: {TEXT("alt"), TEXT(""), 'A', HTML_ATTR_ALT},
371: {TEXT("archive"), TEXT(""), 'A', HTML_ATTR_archive},
372: {TEXT("axis"), TEXT(""), 'A', HTML_ATTR_axis},
373:
1.8 cvs 374: #ifndef XHTML_BASIC
1.2 cvs 375: {TEXT("background"), TEXT(""), 'A', HTML_ATTR_background_},
376: {TEXT("bgcolor"), TEXT(""), 'A', HTML_ATTR_BackgroundColor},
377: {TEXT("border"), TEXT("image"), 'A', HTML_ATTR_Img_border},
378: {TEXT("border"), TEXT("img"), 'A', HTML_ATTR_Img_border},
379: {TEXT("border"), TEXT("object"), 'A', HTML_ATTR_Img_border},
380: {TEXT("border"), TEXT("table"), 'A', HTML_ATTR_Border},
381:
382: {TEXT("cellspacing"), TEXT(""), 'A', HTML_ATTR_cellspacing},
383: {TEXT("cellpadding"), TEXT(""), 'A', HTML_ATTR_cellpadding},
1.8 cvs 384: #endif /* XHTML_BASIC */
1.2 cvs 385: {TEXT("char"), TEXT(""), 'A', HTML_ATTR_char},
386: {TEXT("charoff"), TEXT(""), 'A', HTML_ATTR_charoff},
387: {TEXT("charset"), TEXT(""), 'A', HTML_ATTR_charset},
388: {TEXT("checked"), TEXT(""), 'A', HTML_ATTR_Checked},
389: {TEXT("cite"), TEXT(""), 'A', HTML_ATTR_cite},
390: {TEXT("class"), TEXT(""), 'A', HTML_ATTR_Class},
391: {TEXT("classid"), TEXT(""), 'A', HTML_ATTR_classid},
392: {TEXT("clear"), TEXT("br"), 'A', HTML_ATTR_Clear},
393: {TEXT("code"), TEXT(""), 'A', HTML_ATTR_code},
394: {TEXT("codebase"), TEXT(""), 'A', HTML_ATTR_codebase},
395: {TEXT("codetype"), TEXT(""), 'A', HTML_ATTR_codetype},
396: {TEXT("color"), TEXT("basefont"), 'A', HTML_ATTR_BaseFontColor},
397: {TEXT("color"), TEXT(""), 'A', HTML_ATTR_color},
398: {TEXT("cols"), TEXT("frameset"), 'A', HTML_ATTR_ColWidth},
399: {TEXT("cols"), TEXT("textarea"), 'A', HTML_ATTR_Columns},
400: {TEXT("colspan"), TEXT(""), 'A', HTML_ATTR_colspan_},
1.8 cvs 401: #ifndef XHTML_BASIC
1.2 cvs 402: {TEXT("compact"), TEXT(""), 'A', HTML_ATTR_COMPACT},
1.8 cvs 403: #endif /* XHTML_BASIC */
1.2 cvs 404: {TEXT("content"), TEXT(""), 'A', HTML_ATTR_meta_content},
1.8 cvs 405: #ifndef XHTML_BASIC
1.2 cvs 406: {TEXT("coords"), TEXT(""), 'A', HTML_ATTR_coords},
1.8 cvs 407: #endif /* XHTML_BASIC */
1.2 cvs 408:
409: {TEXT("data"), TEXT(""), 'A', HTML_ATTR_data},
410: {TEXT("datapagesize"), TEXT("table"), 'A', HTML_ATTR_datapagesize},
411: {TEXT("datetime"), TEXT(""), 'A', HTML_ATTR_datetime},
412: {TEXT("declare"), TEXT("object"), 'A', HTML_ATTR_declare},
413: {TEXT("defer"), TEXT("script"), 'A', HTML_ATTR_defer},
414: {TEXT("dir"), TEXT(""), 'A', HTML_ATTR_dir},
415: {TEXT("disabled"), TEXT(""), 'A', HTML_ATTR_disabled},
416:
1.8 cvs 417: #ifndef XHTML_BASIC
1.2 cvs 418: {TEXT("enctype"), TEXT(""), 'A', HTML_ATTR_ENCTYPE},
419: {TEXT("event"), TEXT("script"), 'A', HTML_ATTR_event},
420:
421: {TEXT("face"), TEXT("basefont"), 'A', HTML_ATTR_BaseFontFace},
422: {TEXT("face"), TEXT("font"), 'A', HTML_ATTR_face},
1.8 cvs 423: #endif /* XHTML_BASIC */
1.2 cvs 424: {TEXT("for"), TEXT("label"), 'A', HTML_ATTR_Associated_control},
425: {TEXT("for"), TEXT("script"), 'A', HTML_ATTR_for_},
1.8 cvs 426: #ifndef XHTML_BASIC
1.2 cvs 427: {TEXT("frame"), TEXT("table"), 'A', HTML_ATTR_frame},
428: {TEXT("frameborder"), TEXT(""), 'A', HTML_ATTR_frameborder},
429:
430: {TEXT("headers"), TEXT(""), 'A', HTML_ATTR_headers},
1.8 cvs 431: #endif /* XHTML_BASIC */
1.2 cvs 432: {TEXT("height"), TEXT(""), 'A', HTML_ATTR_Height_},
433: {TEXT("href"), TEXT(""), 'A', HTML_ATTR_HREF_},
434: {TEXT("hreflang"), TEXT(""), 'A', HTML_ATTR_hreflang},
1.8 cvs 435: #ifndef XHTML_BASIC
1.2 cvs 436: {TEXT("hspace"), TEXT(""), 'A', HTML_ATTR_hspace},
1.8 cvs 437: #endif /* XHTML_BASIC */
1.2 cvs 438: {TEXT("http-equiv"), TEXT(""), 'A', HTML_ATTR_http_equiv},
439:
440: {TEXT("id"), TEXT(""), 'A', HTML_ATTR_ID},
1.8 cvs 441: #ifndef XHTML_BASIC
1.2 cvs 442: {TEXT("ismap"), TEXT(""), 'A', HTML_ATTR_ISMAP},
1.8 cvs 443: #endif /* XHTML_BASIC */
1.2 cvs 444:
445: {TEXT("label"), TEXT(""), 'A', HTML_ATTR_label},
446: {TEXT("lang"), TEXT(""), 'A', HTML_ATTR_Langue},
447: {TEXT("language"), TEXT("script"), 'A', HTML_ATTR_script_language},
448: {TEXT("link"), TEXT("body"), 'A', HTML_ATTR_LinkColor},
449: {TEXT("longdesc"), TEXT(""), 'A', HTML_ATTR_longdesc},
450:
1.8 cvs 451: #ifndef XHTML_BASIC
1.2 cvs 452: {TEXT("marginheight"), TEXT(""), 'A', HTML_ATTR_marginheight},
453: {TEXT("marginwidth"), TEXT(""), 'A', HTML_ATTR_marginwidth},
1.8 cvs 454: #endif /* XHTML_BASIC */
1.2 cvs 455: {TEXT("maxlength"), TEXT(""), 'A', HTML_ATTR_MaxLength},
456: {TEXT("media"), TEXT(""), 'A', HTML_ATTR_media},
457: {TEXT("method"), TEXT(""), 'A', HTML_ATTR_METHOD},
458: {TEXT("mode"), TEXT(""), 'A', HTML_ATTR_mode},
459: {TEXT("multiple"), TEXT(""), 'A', HTML_ATTR_Multiple},
460:
461: {TEXT("N"), TEXT(""), 'C', 0},
462: {TEXT("name"), TEXT("applet"), 'A', HTML_ATTR_applet_name},
463: {TEXT("name"), TEXT("frame"), 'A', HTML_ATTR_FrameName},
464: {TEXT("name"), TEXT("iframe"), 'A', HTML_ATTR_FrameName},
465: {TEXT("name"), TEXT("meta"), 'A', HTML_ATTR_meta_name},
466: {TEXT("name"), TEXT("param"), 'A', HTML_ATTR_Param_name},
467: {TEXT("name"), TEXT(""), 'A', HTML_ATTR_NAME},
468: {TEXT("nohref"), TEXT(""), 'A', HTML_ATTR_nohref},
469: {TEXT("noresize"), TEXT(""), 'A', HTML_ATTR_no_resize},
470: {TEXT("noshade"), TEXT(""), 'A', HTML_ATTR_NoShade},
471: {TEXT("nowrap"), TEXT(""), 'A', HTML_ATTR_No_wrap},
472:
1.8 cvs 473: #ifndef XHTML_BASIC
1.2 cvs 474: {TEXT("object"), TEXT("applet"), 'A', HTML_ATTR_object},
475: {TEXT("onblur"), TEXT(""), 'A', HTML_ATTR_onblur},
476: {TEXT("onchange"), TEXT(""), 'A', HTML_ATTR_onchange},
477: {TEXT("onclick"), TEXT(""), 'A', HTML_ATTR_onclick},
478: {TEXT("ondblclick"), TEXT(""), 'A', HTML_ATTR_ondblclick},
479: {TEXT("onfocus"), TEXT(""), 'A', HTML_ATTR_onfocus},
480: {TEXT("onkeydown"), TEXT(""), 'A', HTML_ATTR_onkeydown},
481: {TEXT("onkeypress"), TEXT(""), 'A', HTML_ATTR_onkeypress},
482: {TEXT("onkeyup"), TEXT(""), 'A', HTML_ATTR_onkeyup},
483: {TEXT("onload"), TEXT(""), 'A', HTML_ATTR_onload},
484: {TEXT("onmousedown"), TEXT(""), 'A', HTML_ATTR_onmousedown},
485: {TEXT("onmousemove"), TEXT(""), 'A', HTML_ATTR_onmousemove},
486: {TEXT("onmouseout"), TEXT(""), 'A', HTML_ATTR_onmouseout},
487: {TEXT("onmouseover"), TEXT(""), 'A', HTML_ATTR_onmouseover},
488: {TEXT("onmouseup"), TEXT(""), 'A', HTML_ATTR_onmouseup},
489: {TEXT("onreset"), TEXT("form"), 'A', HTML_ATTR_onreset},
490: {TEXT("onselect"), TEXT(""), 'A', HTML_ATTR_onselect},
491: {TEXT("onsubmit"), TEXT("form"), 'A', HTML_ATTR_onsubmit},
492: {TEXT("onunload"), TEXT(""), 'A', HTML_ATTR_onunload},
1.8 cvs 493: #endif /* XHTML_BASIC */
1.2 cvs 494:
495: {TEXT("profile"), TEXT("head"), 'A', HTML_ATTR_profile},
1.8 cvs 496: #ifndef XHTML_BASIC
1.2 cvs 497: {TEXT("prompt"), TEXT(""), 'A', HTML_ATTR_Prompt},
1.8 cvs 498: #endif /* XHTML_BASIC */
1.2 cvs 499:
500: {TEXT("readonly"), TEXT(""), 'A', HTML_ATTR_readonly},
501: {TEXT("rel"), TEXT(""), 'A', HTML_ATTR_REL},
502: {TEXT("rev"), TEXT(""), 'A', HTML_ATTR_REV},
1.8 cvs 503: #ifndef XHTML_BASIC
1.2 cvs 504: {TEXT("rows"), TEXT("frameset"), 'A', HTML_ATTR_RowHeight},
505: {TEXT("rows"), TEXT("textarea"), 'A', HTML_ATTR_Rows},
1.8 cvs 506: #endif /* XHTML_BASIC */
1.2 cvs 507: {TEXT("rowspan"), TEXT(""), 'A', HTML_ATTR_rowspan_},
508: {TEXT("rules"), TEXT("table"), 'A', HTML_ATTR_rules_},
509:
510: {TEXT("scheme"), TEXT("meta"), 'A', HTML_ATTR_scheme},
511: {TEXT("scope"), TEXT(""), 'A', HTML_ATTR_scope},
1.8 cvs 512: #ifndef XHTML_BASIC
1.2 cvs 513: {TEXT("scrolling"), TEXT(""), 'A', HTML_ATTR_scrolling},
514: {TEXT("selected"), TEXT(""), 'A', HTML_ATTR_Selected},
515: {TEXT("shape"), TEXT(""), 'A', HTML_ATTR_shape},
516: {TEXT("size"), TEXT("basefont"), 'A', HTML_ATTR_BaseFontSize},
517: {TEXT("size"), TEXT("font"), 'A', HTML_ATTR_Font_size},
518: {TEXT("size"), TEXT("hr"), 'A', HTML_ATTR_Size_},
519: {TEXT("size"), TEXT("input"), 'A', HTML_ATTR_Area_Size},
520: {TEXT("size"), TEXT("select"), 'A', HTML_ATTR_MenuSize},
521: {TEXT("span"), TEXT("col"), 'A', HTML_ATTR_span_},
522: {TEXT("span"), TEXT("colgroup"), 'A', HTML_ATTR_span_},
523: {TEXT("src"), TEXT("frame"), 'A', HTML_ATTR_FrameSrc},
524: {TEXT("src"), TEXT("iframe"), 'A', HTML_ATTR_FrameSrc},
525: {TEXT("src"), TEXT("script"), 'A', HTML_ATTR_script_src},
1.8 cvs 526: #endif /* XHTML_BASIC */
1.2 cvs 527: {TEXT("src"), TEXT(""), 'A', HTML_ATTR_SRC},
528: {TEXT("standby"), TEXT(""), 'A', HTML_ATTR_standby},
529: {TEXT("start"), TEXT(""), 'A', HTML_ATTR_Start},
530: {TEXT("style"), TEXT(""), 'A', HTML_ATTR_Style_},
531: {TEXT("summary"), TEXT("table"), 'A', HTML_ATTR_summary},
532:
533: {TEXT("tabindex"), TEXT(""), 'A', HTML_ATTR_tabindex},
534: {TEXT("target"), TEXT(""), 'A', HTML_ATTR_target_},
535: {TEXT("text"), TEXT(""), 'A', HTML_ATTR_TextColor},
536: {TEXT("title"), TEXT(""), 'A', HTML_ATTR_Title},
1.8 cvs 537: #ifndef XHTML_BASIC
1.2 cvs 538: {TEXT("type"), TEXT("button"), 'A', HTML_ATTR_Button_type},
1.8 cvs 539: #endif /* XHTML_BASIC */
1.2 cvs 540: {TEXT("type"), TEXT("li"), 'A', HTML_ATTR_ItemStyle},
541: {TEXT("type"), TEXT("link"), 'A', HTML_ATTR_Link_type},
542: {TEXT("type"), TEXT("a"), 'A', HTML_ATTR_Link_type},
543: {TEXT("type"), TEXT("object"), 'A', HTML_ATTR_Object_type},
544: {TEXT("type"), TEXT("ol"), 'A', HTML_ATTR_NumberStyle},
545: {TEXT("type"), TEXT("param"), 'A', HTML_ATTR_Param_type},
1.8 cvs 546: #ifndef XHTML_BASIC
1.2 cvs 547: {TEXT("type"), TEXT("script"), 'A', HTML_ATTR_content_type},
548: {TEXT("type"), TEXT("style"), 'A', HTML_ATTR_Notation},
1.8 cvs 549: #endif /* XHTML_BASIC */
1.2 cvs 550: {TEXT("type"), TEXT("ul"), 'A', HTML_ATTR_BulletStyle},
551: {TEXT("type"), TEXT(""), SPACE, DummyAttribute},
552:
553: {TEXT("usemap"), TEXT(""), 'A', HTML_ATTR_USEMAP},
554:
555: {TEXT("valign"), TEXT("tbody"), 'A', HTML_ATTR_Row_valign},
556: {TEXT("valign"), TEXT("td"), 'A', HTML_ATTR_Cell_valign},
557: {TEXT("valign"), TEXT("tfoot"), 'A', HTML_ATTR_Row_valign},
558: {TEXT("valign"), TEXT("th"), 'A', HTML_ATTR_Cell_valign},
559: {TEXT("valign"), TEXT("thead"), 'A', HTML_ATTR_Row_valign},
560: {TEXT("valign"), TEXT("tr"), 'A', HTML_ATTR_Row_valign},
561: {TEXT("value"), TEXT("li"), 'A', HTML_ATTR_ItemValue},
562: {TEXT("value"), TEXT("param"), 'A', HTML_ATTR_Param_value},
563: {TEXT("value"), TEXT(""), 'A', HTML_ATTR_Value_},
564: {TEXT("valuetype"), TEXT("param"), 'A', HTML_ATTR_valuetype},
565: {TEXT("version"), TEXT(""), 'A', 0},
1.8 cvs 566: #ifndef XHTML_BASIC
1.2 cvs 567: {TEXT("vlink"), TEXT("body"), 'A', HTML_ATTR_VisitedLinkColor},
568: {TEXT("vspace"), TEXT(""), 'A', HTML_ATTR_vspace},
569:
570: {TEXT("width"), TEXT("applet"), 'A', HTML_ATTR_Width__},
571: {TEXT("width"), TEXT("col"), 'A', HTML_ATTR_Width__},
572: {TEXT("width"), TEXT("colgroup"), 'A', HTML_ATTR_Width__},
573: {TEXT("width"), TEXT("hr"), 'A', HTML_ATTR_Width__},
574: {TEXT("width"), TEXT("iframe"), 'A', HTML_ATTR_Width__},
575: {TEXT("width"), TEXT("image"), 'A', HTML_ATTR_Width__},
1.8 cvs 576: #endif /* XHTML_BASIC */
1.2 cvs 577: {TEXT("width"), TEXT("img"), 'A', HTML_ATTR_Width__},
578: {TEXT("width"), TEXT("object"), 'A', HTML_ATTR_Width__},
1.8 cvs 579: #ifndef XHTML_BASIC
1.2 cvs 580: {TEXT("width"), TEXT("pre"), 'A', HTML_ATTR_Width__},
1.8 cvs 581: #ifndef XHTML_BASIC
1.2 cvs 582: {TEXT("width"), TEXT("table"), 'A', HTML_ATTR_Width__},
1.8 cvs 583: #endif /* XHTML_BASIC */
1.2 cvs 584: {TEXT("width"), TEXT("td"), 'A', HTML_ATTR_Width__},
585: {TEXT("width"), TEXT("th"), 'A', HTML_ATTR_Width__},
1.8 cvs 586: #endif /* XHTML_BASIC */
1.1 cvs 587:
1.2 cvs 588: {TEXT("zzghost"), TEXT(""), 'A', HTML_ATTR_Ghost_restruct},
589: {TEXT(""), TEXT(""), EOS, 0} /* Last entry. Mandatory */
1.1 cvs 590: };
591:
592:
1.2 cvs 593: /* Mapping table of HTML attribute values */
594: static AttrValueMapping XhtmlAttrValueMappingTable[] =
1.1 cvs 595: {
596: {HTML_ATTR_dir, TEXT("ltr"), HTML_ATTR_dir_VAL_ltr},
597: {HTML_ATTR_dir, TEXT("rtl"), HTML_ATTR_dir_VAL_rtl},
598:
599: {HTML_ATTR_TextAlign, TEXT("left"), HTML_ATTR_TextAlign_VAL_left_},
600: {HTML_ATTR_TextAlign, TEXT("center"), HTML_ATTR_TextAlign_VAL_center_},
601: {HTML_ATTR_TextAlign, TEXT("right"), HTML_ATTR_TextAlign_VAL_right_},
602: {HTML_ATTR_TextAlign, TEXT("justify"), HTML_ATTR_TextAlign_VAL_justify_},
603:
604: {HTML_ATTR_Align, TEXT("left"), HTML_ATTR_Align_VAL_left_},
605: {HTML_ATTR_Align, TEXT("center"), HTML_ATTR_Align_VAL_center_},
606: {HTML_ATTR_Align, TEXT("right"), HTML_ATTR_Align_VAL_right_},
607:
608: {HTML_ATTR_LAlign, TEXT("top"), HTML_ATTR_LAlign_VAL_Top_},
609: {HTML_ATTR_LAlign, TEXT("bottom"), HTML_ATTR_LAlign_VAL_Bottom_},
610: {HTML_ATTR_LAlign, TEXT("left"), HTML_ATTR_LAlign_VAL_Left_},
611: {HTML_ATTR_LAlign, TEXT("right"), HTML_ATTR_LAlign_VAL_Right_},
612:
613: {HTML_ATTR_Clear, TEXT("left"), HTML_ATTR_Clear_VAL_Left_},
614: {HTML_ATTR_Clear, TEXT("right"), HTML_ATTR_Clear_VAL_Right_},
615: {HTML_ATTR_Clear, TEXT("all"), HTML_ATTR_Clear_VAL_All_},
616: {HTML_ATTR_Clear, TEXT("none"), HTML_ATTR_Clear_VAL_None_},
617:
618: {HTML_ATTR_NumberStyle, TEXT("1"), HTML_ATTR_NumberStyle_VAL_Arabic_},
619: {HTML_ATTR_NumberStyle, TEXT("a"), HTML_ATTR_NumberStyle_VAL_LowerAlpha},
620: {HTML_ATTR_NumberStyle, TEXT("A"), HTML_ATTR_NumberStyle_VAL_UpperAlpha},
621: {HTML_ATTR_NumberStyle, TEXT("i"), HTML_ATTR_NumberStyle_VAL_LowerRoman},
622: {HTML_ATTR_NumberStyle, TEXT("I"), HTML_ATTR_NumberStyle_VAL_UpperRoman},
623:
624: {HTML_ATTR_BulletStyle, TEXT("disc"), HTML_ATTR_BulletStyle_VAL_disc},
625: {HTML_ATTR_BulletStyle, TEXT("square"), HTML_ATTR_BulletStyle_VAL_square},
626: {HTML_ATTR_BulletStyle, TEXT("circle"), HTML_ATTR_BulletStyle_VAL_circle},
627:
628: {HTML_ATTR_ItemStyle, TEXT("1"), HTML_ATTR_ItemStyle_VAL_Arabic_},
629: {HTML_ATTR_ItemStyle, TEXT("a"), HTML_ATTR_ItemStyle_VAL_LowerAlpha},
630: {HTML_ATTR_ItemStyle, TEXT("A"), HTML_ATTR_ItemStyle_VAL_UpperAlpha},
631: {HTML_ATTR_ItemStyle, TEXT("i"), HTML_ATTR_ItemStyle_VAL_LowerRoman},
632: {HTML_ATTR_ItemStyle, TEXT("I"), HTML_ATTR_ItemStyle_VAL_UpperRoman},
633: {HTML_ATTR_ItemStyle, TEXT("disc"), HTML_ATTR_ItemStyle_VAL_disc},
634: {HTML_ATTR_ItemStyle, TEXT("square"), HTML_ATTR_ItemStyle_VAL_square},
635: {HTML_ATTR_ItemStyle, TEXT("circle"), HTML_ATTR_ItemStyle_VAL_circle},
636:
637: {HTML_ATTR_Button_type, TEXT("button"), HTML_ATTR_Button_type_VAL_button},
638: {HTML_ATTR_Button_type, TEXT("submit"), HTML_ATTR_Button_type_VAL_submit},
639: {HTML_ATTR_Button_type, TEXT("reset"), HTML_ATTR_Button_type_VAL_reset},
640:
641: {HTML_ATTR_mode, TEXT("display"), HTML_ATTR_mode_VAL_display},
642: {HTML_ATTR_mode, TEXT("inline"), HTML_ATTR_mode_VAL_inline_math},
643:
644: {HTML_ATTR_frame, TEXT("void"), HTML_ATTR_frame_VAL_void},
645: {HTML_ATTR_frame, TEXT("above"), HTML_ATTR_frame_VAL_above},
646: {HTML_ATTR_frame, TEXT("below"), HTML_ATTR_frame_VAL_below},
647: {HTML_ATTR_frame, TEXT("hsides"), HTML_ATTR_frame_VAL_hsides},
648: {HTML_ATTR_frame, TEXT("lhs"), HTML_ATTR_frame_VAL_lhs},
649: {HTML_ATTR_frame, TEXT("rhs"), HTML_ATTR_frame_VAL_rhs},
650: {HTML_ATTR_frame, TEXT("vsides"), HTML_ATTR_frame_VAL_vsides},
651: {HTML_ATTR_frame, TEXT("box"), HTML_ATTR_frame_VAL_box},
652: {HTML_ATTR_frame, TEXT("border"), HTML_ATTR_frame_VAL_border},
653:
654: {HTML_ATTR_frameborder, TEXT("0"), HTML_ATTR_frameborder_VAL_Border0},
655: {HTML_ATTR_frameborder, TEXT("1"), HTML_ATTR_frameborder_VAL_Border1},
656:
657: {HTML_ATTR_scrolling, TEXT("yes"), HTML_ATTR_scrolling_VAL_Yes_},
658: {HTML_ATTR_scrolling, TEXT("no"), HTML_ATTR_scrolling_VAL_No_},
659: {HTML_ATTR_scrolling, TEXT("auto"), HTML_ATTR_scrolling_VAL_auto_},
660:
661: {HTML_ATTR_rules_, TEXT("none"), HTML_ATTR_rules__VAL_none_},
662: {HTML_ATTR_rules_, TEXT("groups"), HTML_ATTR_rules__VAL_groups},
663: {HTML_ATTR_rules_, TEXT("rows"), HTML_ATTR_rules__VAL_rows},
664: {HTML_ATTR_rules_, TEXT("cols"), HTML_ATTR_rules__VAL_cols},
665: {HTML_ATTR_rules_, TEXT("all"), HTML_ATTR_rules__VAL_all},
666:
667: {HTML_ATTR_Cell_align, TEXT("left"), HTML_ATTR_Cell_align_VAL_Cell_left},
668: {HTML_ATTR_Cell_align, TEXT("center"), HTML_ATTR_Cell_align_VAL_Cell_center},
669: {HTML_ATTR_Cell_align, TEXT("right"), HTML_ATTR_Cell_align_VAL_Cell_right},
670: {HTML_ATTR_Cell_align, TEXT("justify"), HTML_ATTR_Cell_align_VAL_Cell_justify},
671: {HTML_ATTR_Cell_align, TEXT("char"), HTML_ATTR_Cell_align_VAL_Cell_char},
672:
673: {HTML_ATTR_Alignment, TEXT("top"), HTML_ATTR_Alignment_VAL_Top_},
674: {HTML_ATTR_Alignment, TEXT("middle"), HTML_ATTR_Alignment_VAL_Middle_},
675: {HTML_ATTR_Alignment, TEXT("bottom"), HTML_ATTR_Alignment_VAL_Bottom_},
676: {HTML_ATTR_Alignment, TEXT("left"), HTML_ATTR_Alignment_VAL_Left_},
677: {HTML_ATTR_Alignment, TEXT("right"), HTML_ATTR_Alignment_VAL_Right_},
678:
679: {HTML_ATTR_METHOD, TEXT("get"), HTML_ATTR_METHOD_VAL_Get_},
680: {HTML_ATTR_METHOD, TEXT("post"), HTML_ATTR_METHOD_VAL_Post_},
681:
682: {HTML_ATTR_Position, TEXT("top"), HTML_ATTR_Position_VAL_Position_top},
683: {HTML_ATTR_Position, TEXT("bottom"), HTML_ATTR_Position_VAL_Position_bottom},
684: {HTML_ATTR_Position, TEXT("left"), HTML_ATTR_Position_VAL_Position_left},
685: {HTML_ATTR_Position, TEXT("right"), HTML_ATTR_Position_VAL_Position_right},
686:
687: {HTML_ATTR_Row_valign, TEXT("top"), HTML_ATTR_Row_valign_VAL_Row_top},
688: {HTML_ATTR_Row_valign, TEXT("middle"), HTML_ATTR_Row_valign_VAL_Row_middle},
689: {HTML_ATTR_Row_valign, TEXT("bottom"), HTML_ATTR_Row_valign_VAL_Row_bottom},
690: {HTML_ATTR_Row_valign, TEXT("baseline"), HTML_ATTR_Row_valign_VAL_Row_baseline},
691:
692: {HTML_ATTR_Cell_valign, TEXT("top"), HTML_ATTR_Cell_valign_VAL_Cell_top},
693: {HTML_ATTR_Cell_valign, TEXT("middle"), HTML_ATTR_Cell_valign_VAL_Cell_middle},
694: {HTML_ATTR_Cell_valign, TEXT("bottom"), HTML_ATTR_Cell_valign_VAL_Cell_bottom},
695: {HTML_ATTR_Cell_valign, TEXT("baseline"), HTML_ATTR_Cell_valign_VAL_Cell_baseline},
696:
697: {HTML_ATTR_shape, TEXT("rect"), HTML_ATTR_shape_VAL_rectangle},
698: {HTML_ATTR_shape, TEXT("circle"), HTML_ATTR_shape_VAL_circle},
699: {HTML_ATTR_shape, TEXT("poly"), HTML_ATTR_shape_VAL_polygon},
700:
701: {HTML_ATTR_valuetype, TEXT("data"), HTML_ATTR_valuetype_VAL_data_},
702: {HTML_ATTR_valuetype, TEXT("ref"), HTML_ATTR_valuetype_VAL_ref},
703: {HTML_ATTR_valuetype, TEXT("object"), HTML_ATTR_valuetype_VAL_object_},
704:
705: /* HTML attribute TYPE generates a Thot element */
706: {DummyAttribute, TEXT("button"), HTML_EL_Button_Input},
707: {DummyAttribute, TEXT("checkbox"), HTML_EL_Checkbox_Input},
708: {DummyAttribute, TEXT("file"), HTML_EL_File_Input},
709: {DummyAttribute, TEXT("hidden"), HTML_EL_Hidden_Input},
710: {DummyAttribute, TEXT("image"), HTML_EL_PICTURE_UNIT},
711: {DummyAttribute, TEXT("password"), HTML_EL_Password_Input},
712: {DummyAttribute, TEXT("radio"), HTML_EL_Radio_Input},
713: {DummyAttribute, TEXT("reset"), HTML_EL_Reset_Input},
714: {DummyAttribute, TEXT("submit"), HTML_EL_Submit_Input},
715: {DummyAttribute, TEXT("text"), HTML_EL_Text_Input},
716:
717: /* The following declarations allow the parser to accept boolean attributes */
718: /* written "checked=CHECKED"), for instance */
719: {HTML_ATTR_ISMAP, TEXT("ismap"), HTML_ATTR_ISMAP_VAL_Yes_},
720: {HTML_ATTR_nohref, TEXT("nohref"), HTML_ATTR_nohref_VAL_Yes_},
721: {HTML_ATTR_COMPACT, TEXT("compact"), HTML_ATTR_COMPACT_VAL_Yes_},
722: {HTML_ATTR_Multiple, TEXT("multiple"), HTML_ATTR_Multiple_VAL_Yes_},
723: {HTML_ATTR_Selected, TEXT("selected"), HTML_ATTR_Selected_VAL_Yes_},
724: {HTML_ATTR_Checked, TEXT("checked"), HTML_ATTR_Checked_VAL_Yes_},
725: {HTML_ATTR_No_wrap, TEXT("nowrap"), HTML_ATTR_No_wrap_VAL_no_wrap},
726: {HTML_ATTR_NoShade, TEXT("noshade"), HTML_ATTR_NoShade_VAL_NoShade_},
727: {HTML_ATTR_declare, TEXT("declare"), HTML_ATTR_declare_VAL_Yes_},
728: {HTML_ATTR_defer, TEXT("defer"), HTML_ATTR_defer_VAL_Yes_},
729: {HTML_ATTR_disabled, TEXT("disabled"), HTML_ATTR_disabled_VAL_Yes_},
730: {HTML_ATTR_readonly, TEXT("readonly"), HTML_ATTR_readonly_VAL_Yes_},
731: {HTML_ATTR_no_resize, TEXT("noresize"), HTML_ATTR_no_resize_VAL_Yes_},
732: {0, TEXT(""), 0} /* Last entry. Mandatory */
733: };
734:
1.6 cvs 735: extern CHARSET CharEncoding;
736: extern ThotBool charset_undefined;
737:
738:
739: /*----------------------------------------------------------------------
740: XhtmlParseCharset:
741: Parses the element HTTP-EQUIV and looks for the charset value.
742: ----------------------------------------------------------------------*/
743: #ifdef __STDC__
744: static void XhtmlParseCharset (Element el,
745: Document doc)
746: #else /* !__STDC__ */
747: static void XhtmlParseCharset (el, doc)
748: Element el;
749: Document doc;
750: #endif /* !__STDC__ */
751: {
752:
753: int length;
754: CHAR_T *text, *text2, *ptrText, *str;
755: CHAR_T charsetname[MAX_LENGTH];
756: int pos, index = 0;
757: AttributeType attrType;
758: Attribute attr;
759: Element root;
760: SSchema docSSchema;
761:
762:
763: if (!charset_undefined)
764: return;
765:
766: docSSchema = TtaGetDocumentSSchema (doc);
767:
768: attrType.AttrSSchema = docSSchema;
769: attrType.AttrTypeNum = HTML_ATTR_http_equiv;
770: attr = TtaGetAttribute (el, attrType);
771: if (attr != NULL)
772: {
773: /* There is a HTTP-EQUIV attribute */
774: length = TtaGetTextAttributeLength (attr);
775: if (length > 0)
776: {
777: text = TtaAllocString (length + 1);
778: TtaGiveTextAttributeValue (attr, text, &length);
779: if (!ustrcasecmp (text, TEXT("content-type")))
780: {
781: attrType.AttrTypeNum = HTML_ATTR_meta_content;
782: attr = TtaGetAttribute (el, attrType);
783: if (attr != NULL)
784: {
785: length = TtaGetTextAttributeLength (attr);
786: if (length > 0)
787: {
788: text2 = TtaAllocString (length + 1);
789: TtaGiveTextAttributeValue (attr, text2, &length);
790: ptrText = text2;
791: while (*ptrText)
792: {
793: *ptrText = utolower (*ptrText);
794: ptrText++;
795: }
796:
797: str = ustrstr (text2, TEXT("charset="));
798:
799: if (str)
800: {
801: pos = str - text2 + 8;
802:
803: while (text2[pos] != WC_SPACE &&
804: text2[pos] != WC_TAB && text2[pos] != WC_EOS)
805: charsetname[index++] = text2[pos++];
806:
807: charsetname[index] = WC_EOS;
808: CharEncoding = TtaGetCharset (charsetname);
809:
810: if (CharEncoding == UNDEFINED_CHARSET)
811: CharEncoding = UTF_8;
812: else
813: {
814: /* copy the charset to the
815: document's metadata info */
816: root = TtaGetMainRoot (doc);
817: attrType.AttrTypeNum = HTML_ATTR_Charset;
818: attr = TtaGetAttribute (root, attrType);
819: if (!attr)
820: /* the root element does not have a
821: Charset attribute. Create one */
822: {
823: attr = TtaNewAttribute (attrType);
824: TtaAttachAttribute (root, attr, doc);
825: }
826: TtaSetAttributeText (attr, charsetname,
827: root, doc);
828: }
829: charset_undefined = FALSE;
830: }
831: TtaFreeMemory (text2);
832: }
833: }
834: }
835: TtaFreeMemory (text);
836: }
837: }
838: }
1.8 cvs 839: #endif /* EXPAT_PARSER */
1.6 cvs 840:
841: /*----------------------------------------------------------------------
842: XhtmlElementComplete
843: Complete XHTML elements.
844: Check its attributes and its contents.
845: ----------------------------------------------------------------------*/
846: #ifdef __STDC__
847: void XhtmlElementComplete (Element el,
848: Document doc,
849: int *error)
850: #else
851: void XhtmlElementComplete (el,
852: doc,
853: error)
854: Element el;
855: Document doc;
856: int *error;
857: #endif
858: {
1.8 cvs 859: #ifdef EXPAT_PARSER
1.6 cvs 860: ElementType elType, newElType, childType;
861: Element constElem, child, desc, leaf, prev, next, last,
862: elFrames, lastFrame, lastChild;
863: Attribute attr;
864: AttributeType attrType;
865: Language lang;
866: STRING text;
867: CHAR_T lastChar[2];
868: STRING name1;
869: int length;
870: SSchema docSSchema;
871:
872: *error = 0;
873: docSSchema = TtaGetDocumentSSchema (doc);
874:
875: elType = TtaGetElementType (el);
876: /* is this a block-level element in a character-level element? */
877: if (!IsCharacterLevelElement (el) && elType.ElTypeNum != HTML_EL_Comment_)
878: BlockInCharLevelElem (el);
879:
880: newElType.ElSSchema = elType.ElSSchema;
881: switch (elType.ElTypeNum)
882: {
883: case HTML_EL_Object: /* it's an object */
884: /* create Object_Content */
885: child = TtaGetFirstChild (el);
886: if (child != NULL)
887: elType = TtaGetElementType (child);
888:
889: /* is it the PICTURE element ? */
890: if (child == NULL || elType.ElTypeNum != HTML_EL_PICTURE_UNIT)
891: {
892: desc = child;
893: /* create the PICTURE element */
894: elType.ElTypeNum = HTML_EL_PICTURE_UNIT;
895: child = TtaNewTree (doc, elType, "");
896: if (desc == NULL)
897: TtaInsertFirstChild (&child, el, doc);
898: else
899: TtaInsertSibling (child, desc, TRUE, doc);
900: }
901:
902: /* copy attribute data into SRC attribute of Object_Image */
903: attrType.AttrSSchema = docSSchema;
904: attrType.AttrTypeNum = HTML_ATTR_data;
905: attr = TtaGetAttribute (el, attrType);
906: if (attr != NULL)
907: {
908: length = TtaGetTextAttributeLength (attr);
909: if (length > 0)
910: {
911: name1 = TtaAllocString (length + 1);
912: TtaGiveTextAttributeValue (attr, name1, &length);
913: attrType.AttrTypeNum = HTML_ATTR_SRC;
914: attr = TtaGetAttribute (child, attrType);
915: if (attr == NULL)
916: {
917: attr = TtaNewAttribute (attrType);
918: TtaAttachAttribute (child, attr, doc);
919: }
920: TtaSetAttributeText (attr, name1, child, doc);
921: TtaFreeMemory (name1);
922: }
923: }
924:
925: /* is the Object_Content element already created ? */
926: desc = child;
927: TtaNextSibling(&desc);
928: if (desc != NULL)
929: elType = TtaGetElementType (desc);
930:
931: /* is it the Object_Content element ? */
932: if (desc == NULL || elType.ElTypeNum != HTML_EL_Object_Content)
933: {
934: /* create Object_Content */
935: elType.ElTypeNum = HTML_EL_Object_Content;
936: desc = TtaNewTree (doc, elType, "");
937: TtaInsertSibling (desc, child, FALSE, doc);
938: /* move previous existing children into Object_Content */
939: child = TtaGetLastChild(el);
940: while (child != desc)
941: {
942: TtaRemoveTree (child, doc);
943: TtaInsertFirstChild (&child, desc, doc);
944: child = TtaGetLastChild(el);
945: }
946: }
947: break;
948:
949: case HTML_EL_Unnumbered_List:
950: case HTML_EL_Numbered_List:
951: case HTML_EL_Menu:
952: case HTML_EL_Directory:
953: /* It's a List element. It should only have List_Item children.
954: If it has List element chidren, move these List elements
955: within their previous List_Item sibling. This is to fix
956: a bug in document generated by Mozilla. */
957: prev = NULL;
958: next = NULL;
959: child = TtaGetFirstChild (el);
960: while (child != NULL)
961: {
962: next = child;
963: TtaNextSibling (&next);
964: elType = TtaGetElementType (child);
965: if (elType.ElTypeNum == HTML_EL_Unnumbered_List ||
966: elType.ElTypeNum == HTML_EL_Numbered_List ||
967: elType.ElTypeNum == HTML_EL_Menu ||
968: elType.ElTypeNum == HTML_EL_Directory)
969: /* this list element is a child of another list element */
970: if (prev)
971: {
972: elType = TtaGetElementType (prev);
973: if (elType.ElTypeNum == HTML_EL_List_Item)
974: {
975: /* get the last child of the previous List_Item */
976: desc = TtaGetFirstChild (prev);
977: last = NULL;
978: while (desc)
979: {
980: last = desc;
981: TtaNextSibling (&desc);
982: }
983: /* move the list element after the last child of the
984: previous List_Item */
985: TtaRemoveTree (child, doc);
986: if (last)
987: TtaInsertSibling (child, last, FALSE, doc);
988: else
989: TtaInsertFirstChild (&child, prev, doc);
990: child = prev;
991: }
992: }
993: prev = child;
994: child = next;
995: }
996: break;
997:
998: case HTML_EL_FRAMESET:
999: /* The FRAMESET element is now complete. Gather all its FRAMESET
1000: and FRAME children and wrap them up in a Frames element */
1001: elFrames = NULL; lastFrame = NULL;
1002: lastChild = NULL;
1003: child = TtaGetFirstChild (el);
1004: while (child != NULL)
1005: {
1006: next = child;
1007: TtaNextSibling (&next);
1008: elType = TtaGetElementType (child);
1009: if (elType.ElTypeNum == HTML_EL_FRAMESET ||
1010: elType.ElTypeNum == HTML_EL_FRAME ||
1011: elType.ElTypeNum == HTML_EL_Comment_)
1012: {
1013: /* create the Frames element if it does not exist */
1014: if (elFrames == NULL)
1015: {
1016: newElType.ElSSchema = docSSchema;
1017: newElType.ElTypeNum = HTML_EL_Frames;
1018: elFrames = TtaNewElement (doc, newElType);
1019: XmlSetElemLineNumber (elFrames);
1020: TtaInsertSibling (elFrames, child, TRUE, doc);
1021: }
1022: /* move the element as the last child of the Frames element */
1023: TtaRemoveTree (child, doc);
1024: if (lastFrame == NULL)
1025: TtaInsertFirstChild (&child, elFrames, doc);
1026: else
1027: TtaInsertSibling (child, lastFrame, FALSE, doc);
1028: lastFrame = child;
1029: }
1030: child = next;
1031: }
1032: break;
1033:
1034: case HTML_EL_Input: /* it's an INPUT without any TYPE attribute */
1035: /* Create a child of type Text_Input */
1036: elType.ElTypeNum = HTML_EL_Text_Input;
1037: child = TtaNewTree (doc, elType, "");
1038: XmlSetElemLineNumber (child);
1039: TtaInsertFirstChild (&child, el, doc);
1040: /* now, process it like a Text_Input element */
1041:
1042: case HTML_EL_Text_Input:
1043: case HTML_EL_Password_Input:
1044: case HTML_EL_File_Input:
1045: /* get element Inserted_Text */
1046: child = TtaGetFirstChild (el);
1047: if (child != NULL)
1048: {
1049: attrType.AttrSSchema = docSSchema;
1050: attrType.AttrTypeNum = HTML_ATTR_Value_;
1051: attr = TtaGetAttribute (el, attrType);
1052: if (attr != NULL)
1053: {
1054: /* copy the value of attribute "value" into the first text
1055: leaf of element */
1056: length = TtaGetTextAttributeLength (attr);
1057: if (length > 0)
1058: {
1059: /* get the text leaf */
1060: leaf = TtaGetFirstChild (child);
1061: if (leaf != NULL)
1062: {
1063: childType = TtaGetElementType (leaf);
1064: if (childType.ElTypeNum == HTML_EL_TEXT_UNIT)
1065: {
1066: /* copy attribute value into the text leaf */
1067: text = TtaAllocString (length + 1);
1068: TtaGiveTextAttributeValue (attr, text, &length);
1069: TtaSetTextContent (leaf, text,
1070: TtaGetDefaultLanguage (), doc);
1071: TtaFreeMemory (text);
1072: }
1073: }
1074: }
1075: }
1076: }
1077: break;
1078:
1079: case HTML_EL_META:
1080: XhtmlParseCharset (el, doc);
1081: break;
1082:
1083: case HTML_EL_STYLE_: /* it's a STYLE element */
1.8 cvs 1084: case HTML_EL_SCRIPT: /* it's a SCRIPT element */
1.6 cvs 1085: case HTML_EL_Preformatted: /* it's a PRE */
1086: /* if the last line of the Preformatted is empty, remove it */
1087: leaf = XmlLastLeafInElement (el);
1088: if (leaf != NULL)
1089: {
1090: elType = TtaGetElementType (leaf);
1091: if (elType.ElTypeNum == HTML_EL_TEXT_UNIT)
1092: /* the last leaf is a TEXT element */
1093: {
1094: length = TtaGetTextLength (leaf);
1095: if (length > 0)
1096: {
1097: TtaGiveSubString (leaf, lastChar, length, 1);
1098: if (lastChar[0] == EOL)
1099: /* last character is new line, delete it */
1100: {
1101: if (length == 1)
1102: /* empty TEXT element */
1103: TtaDeleteTree (leaf, doc);
1104: else
1105: /* remove the last character */
1106: TtaDeleteTextContent (leaf, length, 1, doc);
1107: }
1108: }
1109: }
1110: }
1111: if (IsParsingCSS ())
1112: {
1113: text = GetStyleContents (el);
1114: if (text)
1115: {
1116: ReadCSSRules (doc, NULL, text, FALSE);
1117: TtaFreeMemory (text);
1118: }
1119: SetParsingCSS (FALSE);
1120: }
1121: /* and continue as if it were a Preformatted or a Script */
1122: break;
1123:
1124: case HTML_EL_Text_Area: /* it's a Text_Area */
1125: SetParsingTextArea (FALSE);
1126: child = TtaGetFirstChild (el);
1127: if (child == NULL)
1128: /* it's an empty Text_Area */
1129: /* insert a Inserted_Text element in the element */
1130: {
1131: newElType.ElTypeNum = HTML_EL_Inserted_Text;
1132: child = TtaNewTree (doc, newElType, "");
1133: TtaInsertFirstChild (&child, el, doc);
1134: }
1135: else
1136: {
1137: /* save the text into Default_Value attribute */
1138: attrType.AttrSSchema = docSSchema;
1139: attrType.AttrTypeNum = HTML_ATTR_Default_Value;
1140: if (TtaGetAttribute (el, attrType) == NULL)
1141: /* attribute Default_Value is missing */
1142: {
1143: attr = TtaNewAttribute (attrType);
1144: TtaAttachAttribute (el, attr, doc);
1145: desc = TtaGetFirstChild (child);
1146: length = TtaGetTextLength (desc) + 1;
1147: text = TtaAllocString (length);
1148: TtaGiveTextContent (desc, text, &length, &lang);
1149: TtaSetAttributeText (attr, text, el, doc);
1150: TtaFreeMemory (text);
1151: }
1152: }
1153: /* insert a Frame element */
1154: newElType.ElTypeNum = HTML_EL_Frame;
1155: constElem = TtaNewTree (doc, newElType, "");
1156: TtaInsertSibling (constElem, child, FALSE, doc);
1157: break;
1158:
1159: case HTML_EL_Radio_Input:
1160: case HTML_EL_Checkbox_Input:
1161: /* put an attribute Checked if it is missing */
1162: attrType.AttrSSchema = docSSchema;
1163: attrType.AttrTypeNum = HTML_ATTR_Checked;
1164: if (TtaGetAttribute (el, attrType) == NULL)
1165: /* attribute Checked is missing */
1166: {
1167: attr = TtaNewAttribute (attrType);
1168: TtaAttachAttribute (el, attr, doc);
1169: TtaSetAttributeValue (attr, HTML_ATTR_Checked_VAL_No_, el, doc);
1170: }
1171: break;
1172:
1173: case HTML_EL_Option_Menu:
1174: /* Check that at least one option has a SELECTED attribute */
1175: OnlyOneOptionSelected (el, doc, TRUE);
1176: break;
1177:
1178: case HTML_EL_PICTURE_UNIT:
1179: break;
1180:
1181: case HTML_EL_LINK:
1182: CheckCSSLink (el, doc, docSSchema);
1183: break;
1184:
1185: case HTML_EL_Data_cell:
1186: case HTML_EL_Heading_cell:
1187: /* insert a pseudo paragraph into empty cells */
1188: child = TtaGetFirstChild (el);
1189: if (child == NULL)
1190: {
1191: elType.ElTypeNum = HTML_EL_Pseudo_paragraph;
1192: child = TtaNewTree (doc, elType, "");
1193: if (child != NULL)
1194: TtaInsertFirstChild (&child, el, doc);
1195: }
1196:
1197: /* detect whether we're parsing a whole table or just a cell */
1198: if (IsWithinTable ())
1199: NewCell (el, doc, FALSE);
1200: break;
1201:
1202: case HTML_EL_Table:
1203: CheckTable (el, doc);
1204: SubWithinTable ();
1205: break;
1206:
1207: case HTML_EL_TITLE:
1208: /* show the TITLE in the main window */
1209: UpdateTitle (el, doc);
1210: break;
1211:
1212: default:
1213: break;
1214: }
1.8 cvs 1215: #endif /* EXPAT_PARSER */
1.6 cvs 1216: }
1.1 cvs 1217:
1218: /*----------------------------------------------------------------------
1.2 cvs 1219: XhtmlGetDTDName
1220: Return in DTDname the name of the DTD to be used for parsing the
1221: content of element named elementName.
1222: This element type appear with an 'X' in the ElemMappingTable.
1.1 cvs 1223: ----------------------------------------------------------------------*/
1224: #ifdef __STDC__
1.2 cvs 1225: void XhtmlGetDTDName (STRING DTDname,
1226: STRING elementName)
1.1 cvs 1227: #else
1.2 cvs 1228: void XhtmlGetDTDName (DTDname,
1229: elementName)
1230: STRING DTDname;
1231: STRING elementName;
1232:
1.1 cvs 1233: #endif
1234: {
1.8 cvs 1235: #ifdef EXPAT_PARSER
1.2 cvs 1236: if (ustrcmp (elementName, TEXT("math")) == 0)
1237: ustrcpy (DTDname, TEXT("MathML"));
1.1 cvs 1238: else
1.2 cvs 1239: if (ustrcmp (elementName, TEXT("label")) == 0 ||
1240: ustrcmp (elementName, TEXT("text")) == 0)
1241: ustrcpy (DTDname, TEXT("HTML"));
1242: else
1243: ustrcpy (DTDname, TEXT(""));
1.8 cvs 1244: #endif /* EXPAT_PARSER */
1.1 cvs 1245: }
1246:
1247: /*----------------------------------------------------------------------
1.2 cvs 1248: XhtmlMapAttribute
1249: Search in the Attribute Mapping Table the entry for the attribute
1250: of name Attr and returns the corresponding Thot attribute type.
1.1 cvs 1251: ----------------------------------------------------------------------*/
1252: #ifdef __STDC__
1.4 cvs 1253: AttributeMapping* XhtmlMapAttribute (CHAR_T* attrName,
1254: AttributeType* attrType,
1255: CHAR_T* elementName,
1256: Document doc)
1.1 cvs 1257: #else
1.4 cvs 1258: AttributeMapping* XhtmlMapAttribute (attrName,
1259: attrType,
1260: elementName,
1261: doc)
1.2 cvs 1262: CHAR_T* attrName;
1263: AttributeType* attrType;
1264: CHAR_T* elementName;
1265: Document doc;
1.1 cvs 1266: #endif
1267: {
1.8 cvs 1268: #ifdef EXPAT_PARSER
1.1 cvs 1269: int i;
1270:
1.2 cvs 1271: attrType->AttrTypeNum = 0;
1272: attrType->AttrSSchema = NULL;
1.1 cvs 1273: i = 0;
1274:
1.2 cvs 1275: do
1276: if (ustrcasecmp (XhtmlAttributeMappingTable[i].XMLattribute, attrName))
1277: i++;
1278: else
1279: if (XhtmlAttributeMappingTable[i].XMLelement[0] == EOS)
1.1 cvs 1280: {
1.2 cvs 1281: attrType->AttrTypeNum = XhtmlAttributeMappingTable[i].ThotAttribute;
1.6 cvs 1282: attrType->AttrSSchema = GetXHTMLSSchema (doc);
1.1 cvs 1283: }
1.2 cvs 1284: else
1285: if (!ustrcasecmp (XhtmlAttributeMappingTable[i].XMLelement, elementName))
1.1 cvs 1286: {
1.2 cvs 1287: attrType->AttrTypeNum = XhtmlAttributeMappingTable[i].ThotAttribute;
1.6 cvs 1288: attrType->AttrSSchema = GetXHTMLSSchema (doc);
1.1 cvs 1289: }
1290: else
1.2 cvs 1291: i++;
1292: while (attrType->AttrTypeNum <= 0 &&
1293: XhtmlAttributeMappingTable[i].AttrOrContent != EOS);
1.1 cvs 1294:
1.2 cvs 1295: if (XhtmlAttributeMappingTable[i].AttrOrContent == EOS)
1296: return (NULL);
1.1 cvs 1297: else
1.2 cvs 1298: return (&XhtmlAttributeMappingTable[i]);
1.8 cvs 1299: #endif /* EXPAT_PARSER */
1.1 cvs 1300: }
1301:
1302: /*----------------------------------------------------------------------
1.2 cvs 1303: XhtmlMapAttributeValue
1304: Search in the Attribute Value Mapping Table the entry for the attribute
1305: ThotAtt and its value AttrVal. Returns the corresponding Thot value.
1.1 cvs 1306: ----------------------------------------------------------------------*/
1307: #ifdef __STDC__
1.2 cvs 1308: void XhtmlMapAttributeValue (CHAR_T* AttrVal,
1309: AttributeType attrType,
1310: int* value)
1.1 cvs 1311: #else
1.2 cvs 1312: void XhtmlMapAttributeValue (AttrVal,
1313: attrType,
1314: value)
1315: CHAR_T* AttrVal;
1316: AttributeType attrType;
1317: int* value;
1.1 cvs 1318: #endif
1319: {
1.8 cvs 1320: #ifdef EXPAT_PARSER
1.2 cvs 1321: int i;
1.1 cvs 1322:
1.2 cvs 1323: *value = 0;
1.1 cvs 1324: i = 0;
1325:
1.2 cvs 1326: while (XhtmlAttrValueMappingTable[i].ThotAttr != attrType.AttrTypeNum &&
1327: XhtmlAttrValueMappingTable[i].ThotAttr != 0)
1328: i++;
1329:
1330: if (XhtmlAttrValueMappingTable[i].ThotAttr == attrType.AttrTypeNum)
1331: {
1332: do
1333: if (!ustrcasecmp (XhtmlAttrValueMappingTable[i].XMLattrValue, AttrVal))
1334: *value = XhtmlAttrValueMappingTable[i].ThotAttrValue;
1.1 cvs 1335: else
1.2 cvs 1336: i++;
1337: while (*value <= 0 &&
1338: XhtmlAttrValueMappingTable[i].ThotAttr != 0);
1.1 cvs 1339: }
1.8 cvs 1340: #endif /* EXPAT_PARSER */
1.1 cvs 1341: }
1342:
1343: /*---------------------------------------------------------------------------
1.2 cvs 1344: XhtmlMapEntity
1.1 cvs 1345: Search that entity in the entity table and return the corresponding value.
1346: ---------------------------------------------------------------------------*/
1347: #ifdef __STDC__
1.2 cvs 1348: void XhtmlMapEntity (STRING entityName,
1.3 cvs 1349: int *entityValue,
1.1 cvs 1350: int valueLength,
1351: STRING alphabet)
1352: #else
1.2 cvs 1353: void XhtmlMapEntity (entityName,
1.1 cvs 1354: entityValue,
1355: valueLength,
1356: alphabet)
1.3 cvs 1357: STRING entityName;
1358: int *entityValue;
1359: int valueLength;
1360: STRING alphabet;
1.1 cvs 1361:
1362: #endif
1363:
1364: {
1.8 cvs 1365: #ifdef EXPAT_PARSER
1.1 cvs 1366: int i;
1367:
1.3 cvs 1368: for (i = 0; XhtmlEntityTable[i].charCode >= 0 &&
1369: ustrcmp (XhtmlEntityTable[i].charName, entityName);
1370: i++);
1371:
1372: if (!ustrcmp (XhtmlEntityTable[i].charName, entityName))
1373: {
1374: /* entity found */
1375: *entityValue = XhtmlEntityTable[i].charCode;
1376: *alphabet = 'L';
1377: }
1378: else
1.1 cvs 1379: {
1.3 cvs 1380: *alphabet = EOS;
1.1 cvs 1381: }
1.8 cvs 1382: #endif /* EXPAT_PARSER */
1.1 cvs 1383: }
1384:
1385: /*-------------------- Entities (end) ---------------------*/
Webmaster