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