Annotation of Amaya/amaya/XHTMLbuilder.c, revision 1.7
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: */
1.7 ! cvs 16: #ifdef EXPAT_PARSER
1.1 cvs 17:
18: #define THOT_EXPORT extern
19: #include "amaya.h"
20: #include "css.h"
1.2 cvs 21: #include "parser.h"
22: #include "HTML.h"
23:
1.1 cvs 24: #include "HTMLactions_f.h"
25: #include "HTMLedit_f.h"
26: #include "HTMLimage_f.h"
27: #include "HTMLtable_f.h"
28: #include "HTMLimage_f.h"
29: #include "UIcss_f.h"
1.2 cvs 30: #include "XHTMLbuilder_f.h"
1.6 cvs 31: #include "fetchXMLname_f.h"
1.1 cvs 32: #include "styleparser_f.h"
1.2 cvs 33: #include "css_f.h"
1.1 cvs 34:
35: /* maximum length of a Thot structure schema name */
36: #define MAX_SS_NAME_LENGTH 32
37:
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},
341: {TEXT("align"), TEXT("applet"), 'A', HTML_ATTR_Alignment},
342: {TEXT("align"), TEXT("caption"), 'A', HTML_ATTR_Position},
343: {TEXT("align"), TEXT("col"), 'A', HTML_ATTR_Cell_align},
344: {TEXT("align"), TEXT("colgroup"), 'A', HTML_ATTR_Cell_align},
345: {TEXT("align"), TEXT("div"), 'A', HTML_ATTR_TextAlign},
346: {TEXT("align"), TEXT("h1"), 'A', HTML_ATTR_TextAlign},
347: {TEXT("align"), TEXT("h2"), 'A', HTML_ATTR_TextAlign},
348: {TEXT("align"), TEXT("h3"), 'A', HTML_ATTR_TextAlign},
349: {TEXT("align"), TEXT("h4"), 'A', HTML_ATTR_TextAlign},
350: {TEXT("align"), TEXT("h5"), 'A', HTML_ATTR_TextAlign},
351: {TEXT("align"), TEXT("h6"), 'A', HTML_ATTR_TextAlign},
352: {TEXT("align"), TEXT("hr"), 'A', HTML_ATTR_Align},
353: {TEXT("align"), TEXT("iframe"), 'A', HTML_ATTR_Alignment},
354: {TEXT("align"), TEXT("image"), 'A', HTML_ATTR_Alignment},
355: {TEXT("align"), TEXT("img"), 'A', HTML_ATTR_Alignment},
356: {TEXT("align"), TEXT("input"), 'A', HTML_ATTR_Alignment},
357: {TEXT("align"), TEXT("legend"), 'A', HTML_ATTR_LAlign},
358: {TEXT("align"), TEXT("object"), 'A', HTML_ATTR_Alignment},
359: {TEXT("align"), TEXT("p"), 'A', HTML_ATTR_TextAlign},
360: {TEXT("align"), TEXT("table"), 'A', HTML_ATTR_Align},
361: {TEXT("align"), TEXT("tbody"), 'A', HTML_ATTR_Cell_align},
362: {TEXT("align"), TEXT("td"), 'A', HTML_ATTR_Cell_align},
363: {TEXT("align"), TEXT("tfoot"), 'A', HTML_ATTR_Cell_align},
364: {TEXT("align"), TEXT("th"), 'A', HTML_ATTR_Cell_align},
365: {TEXT("align"), TEXT("thead"), 'A', HTML_ATTR_Cell_align},
366: {TEXT("align"), TEXT("tr"), 'A', HTML_ATTR_Cell_align},
367: {TEXT("alink"), TEXT("body"), 'A', HTML_ATTR_ActiveLinkColor},
368: {TEXT("alt"), TEXT(""), 'A', HTML_ATTR_ALT},
369: {TEXT("archive"), TEXT(""), 'A', HTML_ATTR_archive},
370: {TEXT("axis"), TEXT(""), 'A', HTML_ATTR_axis},
371:
372: {TEXT("background"), TEXT(""), 'A', HTML_ATTR_background_},
373: {TEXT("bgcolor"), TEXT(""), 'A', HTML_ATTR_BackgroundColor},
374: {TEXT("border"), TEXT("image"), 'A', HTML_ATTR_Img_border},
375: {TEXT("border"), TEXT("img"), 'A', HTML_ATTR_Img_border},
376: {TEXT("border"), TEXT("object"), 'A', HTML_ATTR_Img_border},
377: {TEXT("border"), TEXT("table"), 'A', HTML_ATTR_Border},
378:
379: {TEXT("cellspacing"), TEXT(""), 'A', HTML_ATTR_cellspacing},
380: {TEXT("cellpadding"), TEXT(""), 'A', HTML_ATTR_cellpadding},
381: {TEXT("char"), TEXT(""), 'A', HTML_ATTR_char},
382: {TEXT("charoff"), TEXT(""), 'A', HTML_ATTR_charoff},
383: {TEXT("charset"), TEXT(""), 'A', HTML_ATTR_charset},
384: {TEXT("checked"), TEXT(""), 'A', HTML_ATTR_Checked},
385: {TEXT("cite"), TEXT(""), 'A', HTML_ATTR_cite},
386: {TEXT("class"), TEXT(""), 'A', HTML_ATTR_Class},
387: {TEXT("classid"), TEXT(""), 'A', HTML_ATTR_classid},
388: {TEXT("clear"), TEXT("br"), 'A', HTML_ATTR_Clear},
389: {TEXT("code"), TEXT(""), 'A', HTML_ATTR_code},
390: {TEXT("codebase"), TEXT(""), 'A', HTML_ATTR_codebase},
391: {TEXT("codetype"), TEXT(""), 'A', HTML_ATTR_codetype},
392: {TEXT("color"), TEXT("basefont"), 'A', HTML_ATTR_BaseFontColor},
393: {TEXT("color"), TEXT(""), 'A', HTML_ATTR_color},
394: {TEXT("cols"), TEXT("frameset"), 'A', HTML_ATTR_ColWidth},
395: {TEXT("cols"), TEXT("textarea"), 'A', HTML_ATTR_Columns},
396: {TEXT("colspan"), TEXT(""), 'A', HTML_ATTR_colspan_},
397: {TEXT("compact"), TEXT(""), 'A', HTML_ATTR_COMPACT},
398: {TEXT("content"), TEXT(""), 'A', HTML_ATTR_meta_content},
399: {TEXT("coords"), TEXT(""), 'A', HTML_ATTR_coords},
400:
401: {TEXT("data"), TEXT(""), 'A', HTML_ATTR_data},
402: {TEXT("datapagesize"), TEXT("table"), 'A', HTML_ATTR_datapagesize},
403: {TEXT("datetime"), TEXT(""), 'A', HTML_ATTR_datetime},
404: {TEXT("declare"), TEXT("object"), 'A', HTML_ATTR_declare},
405: {TEXT("defer"), TEXT("script"), 'A', HTML_ATTR_defer},
406: {TEXT("dir"), TEXT(""), 'A', HTML_ATTR_dir},
407: {TEXT("disabled"), TEXT(""), 'A', HTML_ATTR_disabled},
408:
409: {TEXT("enctype"), TEXT(""), 'A', HTML_ATTR_ENCTYPE},
410: {TEXT("event"), TEXT("script"), 'A', HTML_ATTR_event},
411:
412: {TEXT("face"), TEXT("basefont"), 'A', HTML_ATTR_BaseFontFace},
413: {TEXT("face"), TEXT("font"), 'A', HTML_ATTR_face},
414: {TEXT("for"), TEXT("label"), 'A', HTML_ATTR_Associated_control},
415: {TEXT("for"), TEXT("script"), 'A', HTML_ATTR_for_},
416: {TEXT("frame"), TEXT("table"), 'A', HTML_ATTR_frame},
417: {TEXT("frameborder"), TEXT(""), 'A', HTML_ATTR_frameborder},
418:
419: {TEXT("headers"), TEXT(""), 'A', HTML_ATTR_headers},
420: {TEXT("height"), TEXT(""), 'A', HTML_ATTR_Height_},
421: {TEXT("href"), TEXT(""), 'A', HTML_ATTR_HREF_},
422: {TEXT("hreflang"), TEXT(""), 'A', HTML_ATTR_hreflang},
423: {TEXT("hspace"), TEXT(""), 'A', HTML_ATTR_hspace},
424: {TEXT("http-equiv"), TEXT(""), 'A', HTML_ATTR_http_equiv},
425:
426: {TEXT("id"), TEXT(""), 'A', HTML_ATTR_ID},
427: {TEXT("ismap"), TEXT(""), 'A', HTML_ATTR_ISMAP},
428:
429: {TEXT("label"), TEXT(""), 'A', HTML_ATTR_label},
430: {TEXT("lang"), TEXT(""), 'A', HTML_ATTR_Langue},
431: {TEXT("language"), TEXT("script"), 'A', HTML_ATTR_script_language},
432: {TEXT("link"), TEXT("body"), 'A', HTML_ATTR_LinkColor},
433: {TEXT("longdesc"), TEXT(""), 'A', HTML_ATTR_longdesc},
434:
435: {TEXT("marginheight"), TEXT(""), 'A', HTML_ATTR_marginheight},
436: {TEXT("marginwidth"), TEXT(""), 'A', HTML_ATTR_marginwidth},
437: {TEXT("maxlength"), TEXT(""), 'A', HTML_ATTR_MaxLength},
438: {TEXT("media"), TEXT(""), 'A', HTML_ATTR_media},
439: {TEXT("method"), TEXT(""), 'A', HTML_ATTR_METHOD},
440: {TEXT("mode"), TEXT(""), 'A', HTML_ATTR_mode},
441: {TEXT("multiple"), TEXT(""), 'A', HTML_ATTR_Multiple},
442:
443: {TEXT("N"), TEXT(""), 'C', 0},
444: {TEXT("name"), TEXT("applet"), 'A', HTML_ATTR_applet_name},
445: {TEXT("name"), TEXT("frame"), 'A', HTML_ATTR_FrameName},
446: {TEXT("name"), TEXT("iframe"), 'A', HTML_ATTR_FrameName},
447: {TEXT("name"), TEXT("meta"), 'A', HTML_ATTR_meta_name},
448: {TEXT("name"), TEXT("param"), 'A', HTML_ATTR_Param_name},
449: {TEXT("name"), TEXT(""), 'A', HTML_ATTR_NAME},
450: {TEXT("nohref"), TEXT(""), 'A', HTML_ATTR_nohref},
451: {TEXT("noresize"), TEXT(""), 'A', HTML_ATTR_no_resize},
452: {TEXT("noshade"), TEXT(""), 'A', HTML_ATTR_NoShade},
453: {TEXT("nowrap"), TEXT(""), 'A', HTML_ATTR_No_wrap},
454:
455: {TEXT("object"), TEXT("applet"), 'A', HTML_ATTR_object},
456: {TEXT("onblur"), TEXT(""), 'A', HTML_ATTR_onblur},
457: {TEXT("onchange"), TEXT(""), 'A', HTML_ATTR_onchange},
458: {TEXT("onclick"), TEXT(""), 'A', HTML_ATTR_onclick},
459: {TEXT("ondblclick"), TEXT(""), 'A', HTML_ATTR_ondblclick},
460: {TEXT("onfocus"), TEXT(""), 'A', HTML_ATTR_onfocus},
461: {TEXT("onkeydown"), TEXT(""), 'A', HTML_ATTR_onkeydown},
462: {TEXT("onkeypress"), TEXT(""), 'A', HTML_ATTR_onkeypress},
463: {TEXT("onkeyup"), TEXT(""), 'A', HTML_ATTR_onkeyup},
464: {TEXT("onload"), TEXT(""), 'A', HTML_ATTR_onload},
465: {TEXT("onmousedown"), TEXT(""), 'A', HTML_ATTR_onmousedown},
466: {TEXT("onmousemove"), TEXT(""), 'A', HTML_ATTR_onmousemove},
467: {TEXT("onmouseout"), TEXT(""), 'A', HTML_ATTR_onmouseout},
468: {TEXT("onmouseover"), TEXT(""), 'A', HTML_ATTR_onmouseover},
469: {TEXT("onmouseup"), TEXT(""), 'A', HTML_ATTR_onmouseup},
470: {TEXT("onreset"), TEXT("form"), 'A', HTML_ATTR_onreset},
471: {TEXT("onselect"), TEXT(""), 'A', HTML_ATTR_onselect},
472: {TEXT("onsubmit"), TEXT("form"), 'A', HTML_ATTR_onsubmit},
473: {TEXT("onunload"), TEXT(""), 'A', HTML_ATTR_onunload},
474:
475: {TEXT("profile"), TEXT("head"), 'A', HTML_ATTR_profile},
476: {TEXT("prompt"), TEXT(""), 'A', HTML_ATTR_Prompt},
477:
478: {TEXT("readonly"), TEXT(""), 'A', HTML_ATTR_readonly},
479: {TEXT("rel"), TEXT(""), 'A', HTML_ATTR_REL},
480: {TEXT("rev"), TEXT(""), 'A', HTML_ATTR_REV},
481: {TEXT("rows"), TEXT("frameset"), 'A', HTML_ATTR_RowHeight},
482: {TEXT("rows"), TEXT("textarea"), 'A', HTML_ATTR_Rows},
483: {TEXT("rowspan"), TEXT(""), 'A', HTML_ATTR_rowspan_},
484: {TEXT("rules"), TEXT("table"), 'A', HTML_ATTR_rules_},
485:
486: {TEXT("scheme"), TEXT("meta"), 'A', HTML_ATTR_scheme},
487: {TEXT("scope"), TEXT(""), 'A', HTML_ATTR_scope},
488: {TEXT("scrolling"), TEXT(""), 'A', HTML_ATTR_scrolling},
489: {TEXT("selected"), TEXT(""), 'A', HTML_ATTR_Selected},
490: {TEXT("shape"), TEXT(""), 'A', HTML_ATTR_shape},
491: {TEXT("size"), TEXT("basefont"), 'A', HTML_ATTR_BaseFontSize},
492: {TEXT("size"), TEXT("font"), 'A', HTML_ATTR_Font_size},
493: {TEXT("size"), TEXT("hr"), 'A', HTML_ATTR_Size_},
494: {TEXT("size"), TEXT("input"), 'A', HTML_ATTR_Area_Size},
495: {TEXT("size"), TEXT("select"), 'A', HTML_ATTR_MenuSize},
496: {TEXT("span"), TEXT("col"), 'A', HTML_ATTR_span_},
497: {TEXT("span"), TEXT("colgroup"), 'A', HTML_ATTR_span_},
498: {TEXT("src"), TEXT("frame"), 'A', HTML_ATTR_FrameSrc},
499: {TEXT("src"), TEXT("iframe"), 'A', HTML_ATTR_FrameSrc},
500: {TEXT("src"), TEXT("script"), 'A', HTML_ATTR_script_src},
501: {TEXT("src"), TEXT(""), 'A', HTML_ATTR_SRC},
502: {TEXT("standby"), TEXT(""), 'A', HTML_ATTR_standby},
503: {TEXT("start"), TEXT(""), 'A', HTML_ATTR_Start},
504: {TEXT("style"), TEXT(""), 'A', HTML_ATTR_Style_},
505: {TEXT("summary"), TEXT("table"), 'A', HTML_ATTR_summary},
506:
507: {TEXT("tabindex"), TEXT(""), 'A', HTML_ATTR_tabindex},
508: {TEXT("target"), TEXT(""), 'A', HTML_ATTR_target_},
509: {TEXT("text"), TEXT(""), 'A', HTML_ATTR_TextColor},
510: {TEXT("title"), TEXT(""), 'A', HTML_ATTR_Title},
511: {TEXT("type"), TEXT("button"), 'A', HTML_ATTR_Button_type},
512: {TEXT("type"), TEXT("li"), 'A', HTML_ATTR_ItemStyle},
513: {TEXT("type"), TEXT("link"), 'A', HTML_ATTR_Link_type},
514: {TEXT("type"), TEXT("a"), 'A', HTML_ATTR_Link_type},
515: {TEXT("type"), TEXT("object"), 'A', HTML_ATTR_Object_type},
516: {TEXT("type"), TEXT("ol"), 'A', HTML_ATTR_NumberStyle},
517: {TEXT("type"), TEXT("param"), 'A', HTML_ATTR_Param_type},
518: {TEXT("type"), TEXT("script"), 'A', HTML_ATTR_content_type},
519: {TEXT("type"), TEXT("style"), 'A', HTML_ATTR_Notation},
520: {TEXT("type"), TEXT("ul"), 'A', HTML_ATTR_BulletStyle},
521: {TEXT("type"), TEXT(""), SPACE, DummyAttribute},
522:
523: {TEXT("usemap"), TEXT(""), 'A', HTML_ATTR_USEMAP},
524:
525: {TEXT("valign"), TEXT("tbody"), 'A', HTML_ATTR_Row_valign},
526: {TEXT("valign"), TEXT("td"), 'A', HTML_ATTR_Cell_valign},
527: {TEXT("valign"), TEXT("tfoot"), 'A', HTML_ATTR_Row_valign},
528: {TEXT("valign"), TEXT("th"), 'A', HTML_ATTR_Cell_valign},
529: {TEXT("valign"), TEXT("thead"), 'A', HTML_ATTR_Row_valign},
530: {TEXT("valign"), TEXT("tr"), 'A', HTML_ATTR_Row_valign},
531: {TEXT("value"), TEXT("li"), 'A', HTML_ATTR_ItemValue},
532: {TEXT("value"), TEXT("param"), 'A', HTML_ATTR_Param_value},
533: {TEXT("value"), TEXT(""), 'A', HTML_ATTR_Value_},
534: {TEXT("valuetype"), TEXT("param"), 'A', HTML_ATTR_valuetype},
535: {TEXT("version"), TEXT(""), 'A', 0},
536: {TEXT("vlink"), TEXT("body"), 'A', HTML_ATTR_VisitedLinkColor},
537: {TEXT("vspace"), TEXT(""), 'A', HTML_ATTR_vspace},
538:
539: {TEXT("width"), TEXT("applet"), 'A', HTML_ATTR_Width__},
540: {TEXT("width"), TEXT("col"), 'A', HTML_ATTR_Width__},
541: {TEXT("width"), TEXT("colgroup"), 'A', HTML_ATTR_Width__},
542: {TEXT("width"), TEXT("hr"), 'A', HTML_ATTR_Width__},
543: {TEXT("width"), TEXT("iframe"), 'A', HTML_ATTR_Width__},
544: {TEXT("width"), TEXT("image"), 'A', HTML_ATTR_Width__},
545: {TEXT("width"), TEXT("img"), 'A', HTML_ATTR_Width__},
546: {TEXT("width"), TEXT("object"), 'A', HTML_ATTR_Width__},
547: {TEXT("width"), TEXT("pre"), 'A', HTML_ATTR_Width__},
548: {TEXT("width"), TEXT("table"), 'A', HTML_ATTR_Width__},
549: {TEXT("width"), TEXT("td"), 'A', HTML_ATTR_Width__},
550: {TEXT("width"), TEXT("th"), 'A', HTML_ATTR_Width__},
1.1 cvs 551:
1.2 cvs 552: {TEXT("zzghost"), TEXT(""), 'A', HTML_ATTR_Ghost_restruct},
553: {TEXT(""), TEXT(""), EOS, 0} /* Last entry. Mandatory */
1.1 cvs 554: };
555:
556:
1.2 cvs 557: /* Mapping table of HTML attribute values */
558: static AttrValueMapping XhtmlAttrValueMappingTable[] =
1.1 cvs 559: {
560: {HTML_ATTR_dir, TEXT("ltr"), HTML_ATTR_dir_VAL_ltr},
561: {HTML_ATTR_dir, TEXT("rtl"), HTML_ATTR_dir_VAL_rtl},
562:
563: {HTML_ATTR_TextAlign, TEXT("left"), HTML_ATTR_TextAlign_VAL_left_},
564: {HTML_ATTR_TextAlign, TEXT("center"), HTML_ATTR_TextAlign_VAL_center_},
565: {HTML_ATTR_TextAlign, TEXT("right"), HTML_ATTR_TextAlign_VAL_right_},
566: {HTML_ATTR_TextAlign, TEXT("justify"), HTML_ATTR_TextAlign_VAL_justify_},
567:
568: {HTML_ATTR_Align, TEXT("left"), HTML_ATTR_Align_VAL_left_},
569: {HTML_ATTR_Align, TEXT("center"), HTML_ATTR_Align_VAL_center_},
570: {HTML_ATTR_Align, TEXT("right"), HTML_ATTR_Align_VAL_right_},
571:
572: {HTML_ATTR_LAlign, TEXT("top"), HTML_ATTR_LAlign_VAL_Top_},
573: {HTML_ATTR_LAlign, TEXT("bottom"), HTML_ATTR_LAlign_VAL_Bottom_},
574: {HTML_ATTR_LAlign, TEXT("left"), HTML_ATTR_LAlign_VAL_Left_},
575: {HTML_ATTR_LAlign, TEXT("right"), HTML_ATTR_LAlign_VAL_Right_},
576:
577: {HTML_ATTR_Clear, TEXT("left"), HTML_ATTR_Clear_VAL_Left_},
578: {HTML_ATTR_Clear, TEXT("right"), HTML_ATTR_Clear_VAL_Right_},
579: {HTML_ATTR_Clear, TEXT("all"), HTML_ATTR_Clear_VAL_All_},
580: {HTML_ATTR_Clear, TEXT("none"), HTML_ATTR_Clear_VAL_None_},
581:
582: {HTML_ATTR_NumberStyle, TEXT("1"), HTML_ATTR_NumberStyle_VAL_Arabic_},
583: {HTML_ATTR_NumberStyle, TEXT("a"), HTML_ATTR_NumberStyle_VAL_LowerAlpha},
584: {HTML_ATTR_NumberStyle, TEXT("A"), HTML_ATTR_NumberStyle_VAL_UpperAlpha},
585: {HTML_ATTR_NumberStyle, TEXT("i"), HTML_ATTR_NumberStyle_VAL_LowerRoman},
586: {HTML_ATTR_NumberStyle, TEXT("I"), HTML_ATTR_NumberStyle_VAL_UpperRoman},
587:
588: {HTML_ATTR_BulletStyle, TEXT("disc"), HTML_ATTR_BulletStyle_VAL_disc},
589: {HTML_ATTR_BulletStyle, TEXT("square"), HTML_ATTR_BulletStyle_VAL_square},
590: {HTML_ATTR_BulletStyle, TEXT("circle"), HTML_ATTR_BulletStyle_VAL_circle},
591:
592: {HTML_ATTR_ItemStyle, TEXT("1"), HTML_ATTR_ItemStyle_VAL_Arabic_},
593: {HTML_ATTR_ItemStyle, TEXT("a"), HTML_ATTR_ItemStyle_VAL_LowerAlpha},
594: {HTML_ATTR_ItemStyle, TEXT("A"), HTML_ATTR_ItemStyle_VAL_UpperAlpha},
595: {HTML_ATTR_ItemStyle, TEXT("i"), HTML_ATTR_ItemStyle_VAL_LowerRoman},
596: {HTML_ATTR_ItemStyle, TEXT("I"), HTML_ATTR_ItemStyle_VAL_UpperRoman},
597: {HTML_ATTR_ItemStyle, TEXT("disc"), HTML_ATTR_ItemStyle_VAL_disc},
598: {HTML_ATTR_ItemStyle, TEXT("square"), HTML_ATTR_ItemStyle_VAL_square},
599: {HTML_ATTR_ItemStyle, TEXT("circle"), HTML_ATTR_ItemStyle_VAL_circle},
600:
601: {HTML_ATTR_Button_type, TEXT("button"), HTML_ATTR_Button_type_VAL_button},
602: {HTML_ATTR_Button_type, TEXT("submit"), HTML_ATTR_Button_type_VAL_submit},
603: {HTML_ATTR_Button_type, TEXT("reset"), HTML_ATTR_Button_type_VAL_reset},
604:
605: {HTML_ATTR_mode, TEXT("display"), HTML_ATTR_mode_VAL_display},
606: {HTML_ATTR_mode, TEXT("inline"), HTML_ATTR_mode_VAL_inline_math},
607:
608: {HTML_ATTR_frame, TEXT("void"), HTML_ATTR_frame_VAL_void},
609: {HTML_ATTR_frame, TEXT("above"), HTML_ATTR_frame_VAL_above},
610: {HTML_ATTR_frame, TEXT("below"), HTML_ATTR_frame_VAL_below},
611: {HTML_ATTR_frame, TEXT("hsides"), HTML_ATTR_frame_VAL_hsides},
612: {HTML_ATTR_frame, TEXT("lhs"), HTML_ATTR_frame_VAL_lhs},
613: {HTML_ATTR_frame, TEXT("rhs"), HTML_ATTR_frame_VAL_rhs},
614: {HTML_ATTR_frame, TEXT("vsides"), HTML_ATTR_frame_VAL_vsides},
615: {HTML_ATTR_frame, TEXT("box"), HTML_ATTR_frame_VAL_box},
616: {HTML_ATTR_frame, TEXT("border"), HTML_ATTR_frame_VAL_border},
617:
618: {HTML_ATTR_frameborder, TEXT("0"), HTML_ATTR_frameborder_VAL_Border0},
619: {HTML_ATTR_frameborder, TEXT("1"), HTML_ATTR_frameborder_VAL_Border1},
620:
621: {HTML_ATTR_scrolling, TEXT("yes"), HTML_ATTR_scrolling_VAL_Yes_},
622: {HTML_ATTR_scrolling, TEXT("no"), HTML_ATTR_scrolling_VAL_No_},
623: {HTML_ATTR_scrolling, TEXT("auto"), HTML_ATTR_scrolling_VAL_auto_},
624:
625: {HTML_ATTR_rules_, TEXT("none"), HTML_ATTR_rules__VAL_none_},
626: {HTML_ATTR_rules_, TEXT("groups"), HTML_ATTR_rules__VAL_groups},
627: {HTML_ATTR_rules_, TEXT("rows"), HTML_ATTR_rules__VAL_rows},
628: {HTML_ATTR_rules_, TEXT("cols"), HTML_ATTR_rules__VAL_cols},
629: {HTML_ATTR_rules_, TEXT("all"), HTML_ATTR_rules__VAL_all},
630:
631: {HTML_ATTR_Cell_align, TEXT("left"), HTML_ATTR_Cell_align_VAL_Cell_left},
632: {HTML_ATTR_Cell_align, TEXT("center"), HTML_ATTR_Cell_align_VAL_Cell_center},
633: {HTML_ATTR_Cell_align, TEXT("right"), HTML_ATTR_Cell_align_VAL_Cell_right},
634: {HTML_ATTR_Cell_align, TEXT("justify"), HTML_ATTR_Cell_align_VAL_Cell_justify},
635: {HTML_ATTR_Cell_align, TEXT("char"), HTML_ATTR_Cell_align_VAL_Cell_char},
636:
637: {HTML_ATTR_Alignment, TEXT("top"), HTML_ATTR_Alignment_VAL_Top_},
638: {HTML_ATTR_Alignment, TEXT("middle"), HTML_ATTR_Alignment_VAL_Middle_},
639: {HTML_ATTR_Alignment, TEXT("bottom"), HTML_ATTR_Alignment_VAL_Bottom_},
640: {HTML_ATTR_Alignment, TEXT("left"), HTML_ATTR_Alignment_VAL_Left_},
641: {HTML_ATTR_Alignment, TEXT("right"), HTML_ATTR_Alignment_VAL_Right_},
642:
643: {HTML_ATTR_METHOD, TEXT("get"), HTML_ATTR_METHOD_VAL_Get_},
644: {HTML_ATTR_METHOD, TEXT("post"), HTML_ATTR_METHOD_VAL_Post_},
645:
646: {HTML_ATTR_Position, TEXT("top"), HTML_ATTR_Position_VAL_Position_top},
647: {HTML_ATTR_Position, TEXT("bottom"), HTML_ATTR_Position_VAL_Position_bottom},
648: {HTML_ATTR_Position, TEXT("left"), HTML_ATTR_Position_VAL_Position_left},
649: {HTML_ATTR_Position, TEXT("right"), HTML_ATTR_Position_VAL_Position_right},
650:
651: {HTML_ATTR_Row_valign, TEXT("top"), HTML_ATTR_Row_valign_VAL_Row_top},
652: {HTML_ATTR_Row_valign, TEXT("middle"), HTML_ATTR_Row_valign_VAL_Row_middle},
653: {HTML_ATTR_Row_valign, TEXT("bottom"), HTML_ATTR_Row_valign_VAL_Row_bottom},
654: {HTML_ATTR_Row_valign, TEXT("baseline"), HTML_ATTR_Row_valign_VAL_Row_baseline},
655:
656: {HTML_ATTR_Cell_valign, TEXT("top"), HTML_ATTR_Cell_valign_VAL_Cell_top},
657: {HTML_ATTR_Cell_valign, TEXT("middle"), HTML_ATTR_Cell_valign_VAL_Cell_middle},
658: {HTML_ATTR_Cell_valign, TEXT("bottom"), HTML_ATTR_Cell_valign_VAL_Cell_bottom},
659: {HTML_ATTR_Cell_valign, TEXT("baseline"), HTML_ATTR_Cell_valign_VAL_Cell_baseline},
660:
661: {HTML_ATTR_shape, TEXT("rect"), HTML_ATTR_shape_VAL_rectangle},
662: {HTML_ATTR_shape, TEXT("circle"), HTML_ATTR_shape_VAL_circle},
663: {HTML_ATTR_shape, TEXT("poly"), HTML_ATTR_shape_VAL_polygon},
664:
665: {HTML_ATTR_valuetype, TEXT("data"), HTML_ATTR_valuetype_VAL_data_},
666: {HTML_ATTR_valuetype, TEXT("ref"), HTML_ATTR_valuetype_VAL_ref},
667: {HTML_ATTR_valuetype, TEXT("object"), HTML_ATTR_valuetype_VAL_object_},
668:
669: /* HTML attribute TYPE generates a Thot element */
670: {DummyAttribute, TEXT("button"), HTML_EL_Button_Input},
671: {DummyAttribute, TEXT("checkbox"), HTML_EL_Checkbox_Input},
672: {DummyAttribute, TEXT("file"), HTML_EL_File_Input},
673: {DummyAttribute, TEXT("hidden"), HTML_EL_Hidden_Input},
674: {DummyAttribute, TEXT("image"), HTML_EL_PICTURE_UNIT},
675: {DummyAttribute, TEXT("password"), HTML_EL_Password_Input},
676: {DummyAttribute, TEXT("radio"), HTML_EL_Radio_Input},
677: {DummyAttribute, TEXT("reset"), HTML_EL_Reset_Input},
678: {DummyAttribute, TEXT("submit"), HTML_EL_Submit_Input},
679: {DummyAttribute, TEXT("text"), HTML_EL_Text_Input},
680:
681: /* The following declarations allow the parser to accept boolean attributes */
682: /* written "checked=CHECKED"), for instance */
683: {HTML_ATTR_ISMAP, TEXT("ismap"), HTML_ATTR_ISMAP_VAL_Yes_},
684: {HTML_ATTR_nohref, TEXT("nohref"), HTML_ATTR_nohref_VAL_Yes_},
685: {HTML_ATTR_COMPACT, TEXT("compact"), HTML_ATTR_COMPACT_VAL_Yes_},
686: {HTML_ATTR_Multiple, TEXT("multiple"), HTML_ATTR_Multiple_VAL_Yes_},
687: {HTML_ATTR_Selected, TEXT("selected"), HTML_ATTR_Selected_VAL_Yes_},
688: {HTML_ATTR_Checked, TEXT("checked"), HTML_ATTR_Checked_VAL_Yes_},
689: {HTML_ATTR_No_wrap, TEXT("nowrap"), HTML_ATTR_No_wrap_VAL_no_wrap},
690: {HTML_ATTR_NoShade, TEXT("noshade"), HTML_ATTR_NoShade_VAL_NoShade_},
691: {HTML_ATTR_declare, TEXT("declare"), HTML_ATTR_declare_VAL_Yes_},
692: {HTML_ATTR_defer, TEXT("defer"), HTML_ATTR_defer_VAL_Yes_},
693: {HTML_ATTR_disabled, TEXT("disabled"), HTML_ATTR_disabled_VAL_Yes_},
694: {HTML_ATTR_readonly, TEXT("readonly"), HTML_ATTR_readonly_VAL_Yes_},
695: {HTML_ATTR_no_resize, TEXT("noresize"), HTML_ATTR_no_resize_VAL_Yes_},
696: {0, TEXT(""), 0} /* Last entry. Mandatory */
697: };
698:
1.6 cvs 699: extern CHARSET CharEncoding;
700: extern ThotBool charset_undefined;
701:
702:
703: /*----------------------------------------------------------------------
704: XhtmlParseCharset:
705: Parses the element HTTP-EQUIV and looks for the charset value.
706: ----------------------------------------------------------------------*/
707: #ifdef __STDC__
708: static void XhtmlParseCharset (Element el,
709: Document doc)
710: #else /* !__STDC__ */
711: static void XhtmlParseCharset (el, doc)
712: Element el;
713: Document doc;
714: #endif /* !__STDC__ */
715: {
716:
717: int length;
718: CHAR_T *text, *text2, *ptrText, *str;
719: CHAR_T charsetname[MAX_LENGTH];
720: int pos, index = 0;
721: AttributeType attrType;
722: Attribute attr;
723: Element root;
724: SSchema docSSchema;
725:
726:
727: if (!charset_undefined)
728: return;
729:
730: docSSchema = TtaGetDocumentSSchema (doc);
731:
732: attrType.AttrSSchema = docSSchema;
733: attrType.AttrTypeNum = HTML_ATTR_http_equiv;
734: attr = TtaGetAttribute (el, attrType);
735: if (attr != NULL)
736: {
737: /* There is a HTTP-EQUIV attribute */
738: length = TtaGetTextAttributeLength (attr);
739: if (length > 0)
740: {
741: text = TtaAllocString (length + 1);
742: TtaGiveTextAttributeValue (attr, text, &length);
743: if (!ustrcasecmp (text, TEXT("content-type")))
744: {
745: attrType.AttrTypeNum = HTML_ATTR_meta_content;
746: attr = TtaGetAttribute (el, attrType);
747: if (attr != NULL)
748: {
749: length = TtaGetTextAttributeLength (attr);
750: if (length > 0)
751: {
752: text2 = TtaAllocString (length + 1);
753: TtaGiveTextAttributeValue (attr, text2, &length);
754: ptrText = text2;
755: while (*ptrText)
756: {
757: *ptrText = utolower (*ptrText);
758: ptrText++;
759: }
760:
761: str = ustrstr (text2, TEXT("charset="));
762:
763: if (str)
764: {
765: pos = str - text2 + 8;
766:
767: while (text2[pos] != WC_SPACE &&
768: text2[pos] != WC_TAB && text2[pos] != WC_EOS)
769: charsetname[index++] = text2[pos++];
770:
771: charsetname[index] = WC_EOS;
772: CharEncoding = TtaGetCharset (charsetname);
773:
774: if (CharEncoding == UNDEFINED_CHARSET)
775: CharEncoding = UTF_8;
776: else
777: {
778: /* copy the charset to the
779: document's metadata info */
780: root = TtaGetMainRoot (doc);
781: attrType.AttrTypeNum = HTML_ATTR_Charset;
782: attr = TtaGetAttribute (root, attrType);
783: if (!attr)
784: /* the root element does not have a
785: Charset attribute. Create one */
786: {
787: attr = TtaNewAttribute (attrType);
788: TtaAttachAttribute (root, attr, doc);
789: }
790: TtaSetAttributeText (attr, charsetname,
791: root, doc);
792: }
793: charset_undefined = FALSE;
794: }
795: TtaFreeMemory (text2);
796: }
797: }
798: }
799: TtaFreeMemory (text);
800: }
801: }
802: }
803:
804: /*----------------------------------------------------------------------
805: XhtmlElementComplete
806: Complete XHTML elements.
807: Check its attributes and its contents.
808: ----------------------------------------------------------------------*/
809: #ifdef __STDC__
810: void XhtmlElementComplete (Element el,
811: Document doc,
812: int *error)
813: #else
814: void XhtmlElementComplete (el,
815: doc,
816: error)
817: Element el;
818: Document doc;
819: int *error;
820: #endif
821: {
822: ElementType elType, newElType, childType;
823: Element constElem, child, desc, leaf, prev, next, last,
824: elFrames, lastFrame, lastChild;
825: Attribute attr;
826: AttributeType attrType;
827: Language lang;
828: STRING text;
829: CHAR_T lastChar[2];
830: STRING name1;
831: int length;
832: SSchema docSSchema;
833:
834: *error = 0;
835: docSSchema = TtaGetDocumentSSchema (doc);
836:
837: elType = TtaGetElementType (el);
838: /* is this a block-level element in a character-level element? */
839: if (!IsCharacterLevelElement (el) && elType.ElTypeNum != HTML_EL_Comment_)
840: BlockInCharLevelElem (el);
841:
842: newElType.ElSSchema = elType.ElSSchema;
843: switch (elType.ElTypeNum)
844: {
845: case HTML_EL_Object: /* it's an object */
846: /* create Object_Content */
847: child = TtaGetFirstChild (el);
848: if (child != NULL)
849: elType = TtaGetElementType (child);
850:
851: /* is it the PICTURE element ? */
852: if (child == NULL || elType.ElTypeNum != HTML_EL_PICTURE_UNIT)
853: {
854: desc = child;
855: /* create the PICTURE element */
856: elType.ElTypeNum = HTML_EL_PICTURE_UNIT;
857: child = TtaNewTree (doc, elType, "");
858: if (desc == NULL)
859: TtaInsertFirstChild (&child, el, doc);
860: else
861: TtaInsertSibling (child, desc, TRUE, doc);
862: }
863:
864: /* copy attribute data into SRC attribute of Object_Image */
865: attrType.AttrSSchema = docSSchema;
866: attrType.AttrTypeNum = HTML_ATTR_data;
867: attr = TtaGetAttribute (el, attrType);
868: if (attr != NULL)
869: {
870: length = TtaGetTextAttributeLength (attr);
871: if (length > 0)
872: {
873: name1 = TtaAllocString (length + 1);
874: TtaGiveTextAttributeValue (attr, name1, &length);
875: attrType.AttrTypeNum = HTML_ATTR_SRC;
876: attr = TtaGetAttribute (child, attrType);
877: if (attr == NULL)
878: {
879: attr = TtaNewAttribute (attrType);
880: TtaAttachAttribute (child, attr, doc);
881: }
882: TtaSetAttributeText (attr, name1, child, doc);
883: TtaFreeMemory (name1);
884: }
885: }
886:
887: /* is the Object_Content element already created ? */
888: desc = child;
889: TtaNextSibling(&desc);
890: if (desc != NULL)
891: elType = TtaGetElementType (desc);
892:
893: /* is it the Object_Content element ? */
894: if (desc == NULL || elType.ElTypeNum != HTML_EL_Object_Content)
895: {
896: /* create Object_Content */
897: elType.ElTypeNum = HTML_EL_Object_Content;
898: desc = TtaNewTree (doc, elType, "");
899: TtaInsertSibling (desc, child, FALSE, doc);
900: /* move previous existing children into Object_Content */
901: child = TtaGetLastChild(el);
902: while (child != desc)
903: {
904: TtaRemoveTree (child, doc);
905: TtaInsertFirstChild (&child, desc, doc);
906: child = TtaGetLastChild(el);
907: }
908: }
909: break;
910:
911: case HTML_EL_Unnumbered_List:
912: case HTML_EL_Numbered_List:
913: case HTML_EL_Menu:
914: case HTML_EL_Directory:
915: /* It's a List element. It should only have List_Item children.
916: If it has List element chidren, move these List elements
917: within their previous List_Item sibling. This is to fix
918: a bug in document generated by Mozilla. */
919: prev = NULL;
920: next = NULL;
921: child = TtaGetFirstChild (el);
922: while (child != NULL)
923: {
924: next = child;
925: TtaNextSibling (&next);
926: elType = TtaGetElementType (child);
927: if (elType.ElTypeNum == HTML_EL_Unnumbered_List ||
928: elType.ElTypeNum == HTML_EL_Numbered_List ||
929: elType.ElTypeNum == HTML_EL_Menu ||
930: elType.ElTypeNum == HTML_EL_Directory)
931: /* this list element is a child of another list element */
932: if (prev)
933: {
934: elType = TtaGetElementType (prev);
935: if (elType.ElTypeNum == HTML_EL_List_Item)
936: {
937: /* get the last child of the previous List_Item */
938: desc = TtaGetFirstChild (prev);
939: last = NULL;
940: while (desc)
941: {
942: last = desc;
943: TtaNextSibling (&desc);
944: }
945: /* move the list element after the last child of the
946: previous List_Item */
947: TtaRemoveTree (child, doc);
948: if (last)
949: TtaInsertSibling (child, last, FALSE, doc);
950: else
951: TtaInsertFirstChild (&child, prev, doc);
952: child = prev;
953: }
954: }
955: prev = child;
956: child = next;
957: }
958: break;
959:
960: case HTML_EL_FRAMESET:
961: /* The FRAMESET element is now complete. Gather all its FRAMESET
962: and FRAME children and wrap them up in a Frames element */
963: elFrames = NULL; lastFrame = NULL;
964: lastChild = NULL;
965: child = TtaGetFirstChild (el);
966: while (child != NULL)
967: {
968: next = child;
969: TtaNextSibling (&next);
970: elType = TtaGetElementType (child);
971: if (elType.ElTypeNum == HTML_EL_FRAMESET ||
972: elType.ElTypeNum == HTML_EL_FRAME ||
973: elType.ElTypeNum == HTML_EL_Comment_)
974: {
975: /* create the Frames element if it does not exist */
976: if (elFrames == NULL)
977: {
978: newElType.ElSSchema = docSSchema;
979: newElType.ElTypeNum = HTML_EL_Frames;
980: elFrames = TtaNewElement (doc, newElType);
981: XmlSetElemLineNumber (elFrames);
982: TtaInsertSibling (elFrames, child, TRUE, doc);
983: }
984: /* move the element as the last child of the Frames element */
985: TtaRemoveTree (child, doc);
986: if (lastFrame == NULL)
987: TtaInsertFirstChild (&child, elFrames, doc);
988: else
989: TtaInsertSibling (child, lastFrame, FALSE, doc);
990: lastFrame = child;
991: }
992: child = next;
993: }
994: break;
995:
996: case HTML_EL_Input: /* it's an INPUT without any TYPE attribute */
997: /* Create a child of type Text_Input */
998: elType.ElTypeNum = HTML_EL_Text_Input;
999: child = TtaNewTree (doc, elType, "");
1000: XmlSetElemLineNumber (child);
1001: TtaInsertFirstChild (&child, el, doc);
1002: /* now, process it like a Text_Input element */
1003:
1004: case HTML_EL_Text_Input:
1005: case HTML_EL_Password_Input:
1006: case HTML_EL_File_Input:
1007: /* get element Inserted_Text */
1008: child = TtaGetFirstChild (el);
1009: if (child != NULL)
1010: {
1011: attrType.AttrSSchema = docSSchema;
1012: attrType.AttrTypeNum = HTML_ATTR_Value_;
1013: attr = TtaGetAttribute (el, attrType);
1014: if (attr != NULL)
1015: {
1016: /* copy the value of attribute "value" into the first text
1017: leaf of element */
1018: length = TtaGetTextAttributeLength (attr);
1019: if (length > 0)
1020: {
1021: /* get the text leaf */
1022: leaf = TtaGetFirstChild (child);
1023: if (leaf != NULL)
1024: {
1025: childType = TtaGetElementType (leaf);
1026: if (childType.ElTypeNum == HTML_EL_TEXT_UNIT)
1027: {
1028: /* copy attribute value into the text leaf */
1029: text = TtaAllocString (length + 1);
1030: TtaGiveTextAttributeValue (attr, text, &length);
1031: TtaSetTextContent (leaf, text,
1032: TtaGetDefaultLanguage (), doc);
1033: TtaFreeMemory (text);
1034: }
1035: }
1036: }
1037: }
1038: }
1039: break;
1040:
1041: case HTML_EL_META:
1042: XhtmlParseCharset (el, doc);
1043: break;
1044:
1045: case HTML_EL_STYLE_: /* it's a STYLE element */
1046: case HTML_EL_Preformatted: /* it's a PRE */
1047: case HTML_EL_SCRIPT: /* it's a SCRIPT element */
1048: /* if the last line of the Preformatted is empty, remove it */
1049: leaf = XmlLastLeafInElement (el);
1050: if (leaf != NULL)
1051: {
1052: elType = TtaGetElementType (leaf);
1053: if (elType.ElTypeNum == HTML_EL_TEXT_UNIT)
1054: /* the last leaf is a TEXT element */
1055: {
1056: length = TtaGetTextLength (leaf);
1057: if (length > 0)
1058: {
1059: TtaGiveSubString (leaf, lastChar, length, 1);
1060: if (lastChar[0] == EOL)
1061: /* last character is new line, delete it */
1062: {
1063: if (length == 1)
1064: /* empty TEXT element */
1065: TtaDeleteTree (leaf, doc);
1066: else
1067: /* remove the last character */
1068: TtaDeleteTextContent (leaf, length, 1, doc);
1069: }
1070: }
1071: }
1072: }
1073: if (IsParsingCSS ())
1074: {
1075: text = GetStyleContents (el);
1076: if (text)
1077: {
1078: ReadCSSRules (doc, NULL, text, FALSE);
1079: TtaFreeMemory (text);
1080: }
1081: SetParsingCSS (FALSE);
1082: }
1083: /* and continue as if it were a Preformatted or a Script */
1084: break;
1085:
1086: case HTML_EL_Text_Area: /* it's a Text_Area */
1087: SetParsingTextArea (FALSE);
1088: child = TtaGetFirstChild (el);
1089: if (child == NULL)
1090: /* it's an empty Text_Area */
1091: /* insert a Inserted_Text element in the element */
1092: {
1093: newElType.ElTypeNum = HTML_EL_Inserted_Text;
1094: child = TtaNewTree (doc, newElType, "");
1095: TtaInsertFirstChild (&child, el, doc);
1096: }
1097: else
1098: {
1099: /* save the text into Default_Value attribute */
1100: attrType.AttrSSchema = docSSchema;
1101: attrType.AttrTypeNum = HTML_ATTR_Default_Value;
1102: if (TtaGetAttribute (el, attrType) == NULL)
1103: /* attribute Default_Value is missing */
1104: {
1105: attr = TtaNewAttribute (attrType);
1106: TtaAttachAttribute (el, attr, doc);
1107: desc = TtaGetFirstChild (child);
1108: length = TtaGetTextLength (desc) + 1;
1109: text = TtaAllocString (length);
1110: TtaGiveTextContent (desc, text, &length, &lang);
1111: TtaSetAttributeText (attr, text, el, doc);
1112: TtaFreeMemory (text);
1113: }
1114: }
1115: /* insert a Frame element */
1116: newElType.ElTypeNum = HTML_EL_Frame;
1117: constElem = TtaNewTree (doc, newElType, "");
1118: TtaInsertSibling (constElem, child, FALSE, doc);
1119: break;
1120:
1121: case HTML_EL_Radio_Input:
1122: case HTML_EL_Checkbox_Input:
1123: /* put an attribute Checked if it is missing */
1124: attrType.AttrSSchema = docSSchema;
1125: attrType.AttrTypeNum = HTML_ATTR_Checked;
1126: if (TtaGetAttribute (el, attrType) == NULL)
1127: /* attribute Checked is missing */
1128: {
1129: attr = TtaNewAttribute (attrType);
1130: TtaAttachAttribute (el, attr, doc);
1131: TtaSetAttributeValue (attr, HTML_ATTR_Checked_VAL_No_, el, doc);
1132: }
1133: break;
1134:
1135: case HTML_EL_Option_Menu:
1136: /* Check that at least one option has a SELECTED attribute */
1137: OnlyOneOptionSelected (el, doc, TRUE);
1138: break;
1139:
1140: case HTML_EL_PICTURE_UNIT:
1141: break;
1142:
1143: case HTML_EL_LINK:
1144: CheckCSSLink (el, doc, docSSchema);
1145: break;
1146:
1147: case HTML_EL_Data_cell:
1148: case HTML_EL_Heading_cell:
1149: /* insert a pseudo paragraph into empty cells */
1150: child = TtaGetFirstChild (el);
1151: if (child == NULL)
1152: {
1153: elType.ElTypeNum = HTML_EL_Pseudo_paragraph;
1154: child = TtaNewTree (doc, elType, "");
1155: if (child != NULL)
1156: TtaInsertFirstChild (&child, el, doc);
1157: }
1158:
1159: /* detect whether we're parsing a whole table or just a cell */
1160: if (IsWithinTable ())
1161: NewCell (el, doc, FALSE);
1162: break;
1163:
1164: case HTML_EL_Table:
1165: CheckTable (el, doc);
1166: SubWithinTable ();
1167: break;
1168:
1169: case HTML_EL_TITLE:
1170: /* show the TITLE in the main window */
1171: UpdateTitle (el, doc);
1172: break;
1173:
1174: default:
1175: break;
1176: }
1177: }
1.1 cvs 1178:
1179: /*----------------------------------------------------------------------
1.2 cvs 1180: XhtmlGetDTDName
1181: Return in DTDname the name of the DTD to be used for parsing the
1182: content of element named elementName.
1183: This element type appear with an 'X' in the ElemMappingTable.
1.1 cvs 1184: ----------------------------------------------------------------------*/
1185: #ifdef __STDC__
1.2 cvs 1186: void XhtmlGetDTDName (STRING DTDname,
1187: STRING elementName)
1.1 cvs 1188: #else
1.2 cvs 1189: void XhtmlGetDTDName (DTDname,
1190: elementName)
1191: STRING DTDname;
1192: STRING elementName;
1193:
1.1 cvs 1194: #endif
1195: {
1.2 cvs 1196: if (ustrcmp (elementName, TEXT("math")) == 0)
1197: ustrcpy (DTDname, TEXT("MathML"));
1.1 cvs 1198: else
1.2 cvs 1199: if (ustrcmp (elementName, TEXT("label")) == 0 ||
1200: ustrcmp (elementName, TEXT("text")) == 0)
1201: ustrcpy (DTDname, TEXT("HTML"));
1202: else
1203: ustrcpy (DTDname, TEXT(""));
1.1 cvs 1204: }
1205:
1206: /*----------------------------------------------------------------------
1.2 cvs 1207: XhtmlMapAttribute
1208: Search in the Attribute Mapping Table the entry for the attribute
1209: of name Attr and returns the corresponding Thot attribute type.
1.1 cvs 1210: ----------------------------------------------------------------------*/
1211: #ifdef __STDC__
1.4 cvs 1212: AttributeMapping* XhtmlMapAttribute (CHAR_T* attrName,
1213: AttributeType* attrType,
1214: CHAR_T* elementName,
1215: Document doc)
1.1 cvs 1216: #else
1.4 cvs 1217: AttributeMapping* XhtmlMapAttribute (attrName,
1218: attrType,
1219: elementName,
1220: doc)
1.2 cvs 1221: CHAR_T* attrName;
1222: AttributeType* attrType;
1223: CHAR_T* elementName;
1224: Document doc;
1.1 cvs 1225: #endif
1226: {
1227: int i;
1228:
1.2 cvs 1229: attrType->AttrTypeNum = 0;
1230: attrType->AttrSSchema = NULL;
1.1 cvs 1231: i = 0;
1232:
1.2 cvs 1233: do
1234: if (ustrcasecmp (XhtmlAttributeMappingTable[i].XMLattribute, attrName))
1235: i++;
1236: else
1237: if (XhtmlAttributeMappingTable[i].XMLelement[0] == EOS)
1.1 cvs 1238: {
1.2 cvs 1239: attrType->AttrTypeNum = XhtmlAttributeMappingTable[i].ThotAttribute;
1.6 cvs 1240: attrType->AttrSSchema = GetXHTMLSSchema (doc);
1.1 cvs 1241: }
1.2 cvs 1242: else
1243: if (!ustrcasecmp (XhtmlAttributeMappingTable[i].XMLelement, elementName))
1.1 cvs 1244: {
1.2 cvs 1245: attrType->AttrTypeNum = XhtmlAttributeMappingTable[i].ThotAttribute;
1.6 cvs 1246: attrType->AttrSSchema = GetXHTMLSSchema (doc);
1.1 cvs 1247: }
1248: else
1.2 cvs 1249: i++;
1250: while (attrType->AttrTypeNum <= 0 &&
1251: XhtmlAttributeMappingTable[i].AttrOrContent != EOS);
1.1 cvs 1252:
1.2 cvs 1253: if (XhtmlAttributeMappingTable[i].AttrOrContent == EOS)
1254: return (NULL);
1.1 cvs 1255: else
1.2 cvs 1256: return (&XhtmlAttributeMappingTable[i]);
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.2 cvs 1265: void XhtmlMapAttributeValue (CHAR_T* AttrVal,
1266: AttributeType attrType,
1267: int* value)
1.1 cvs 1268: #else
1.2 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.2 cvs 1277: int i;
1.1 cvs 1278:
1.2 cvs 1279: *value = 0;
1.1 cvs 1280: i = 0;
1281:
1.2 cvs 1282: while (XhtmlAttrValueMappingTable[i].ThotAttr != attrType.AttrTypeNum &&
1283: XhtmlAttrValueMappingTable[i].ThotAttr != 0)
1284: i++;
1285:
1286: if (XhtmlAttrValueMappingTable[i].ThotAttr == attrType.AttrTypeNum)
1287: {
1288: do
1289: if (!ustrcasecmp (XhtmlAttrValueMappingTable[i].XMLattrValue, AttrVal))
1290: *value = XhtmlAttrValueMappingTable[i].ThotAttrValue;
1.1 cvs 1291: else
1.2 cvs 1292: i++;
1293: while (*value <= 0 &&
1294: XhtmlAttrValueMappingTable[i].ThotAttr != 0);
1.1 cvs 1295: }
1296: }
1297:
1298: /*---------------------------------------------------------------------------
1.2 cvs 1299: XhtmlMapEntity
1.1 cvs 1300: Search that entity in the entity table and return the corresponding value.
1301: ---------------------------------------------------------------------------*/
1302: #ifdef __STDC__
1.2 cvs 1303: void XhtmlMapEntity (STRING entityName,
1.3 cvs 1304: int *entityValue,
1.1 cvs 1305: int valueLength,
1306: STRING alphabet)
1307: #else
1.2 cvs 1308: void XhtmlMapEntity (entityName,
1.1 cvs 1309: entityValue,
1310: valueLength,
1311: alphabet)
1.3 cvs 1312: STRING entityName;
1313: int *entityValue;
1314: int valueLength;
1315: STRING alphabet;
1.1 cvs 1316:
1317: #endif
1318:
1319: {
1320: int i;
1321:
1.3 cvs 1322: for (i = 0; XhtmlEntityTable[i].charCode >= 0 &&
1323: ustrcmp (XhtmlEntityTable[i].charName, entityName);
1324: i++);
1325:
1326: if (!ustrcmp (XhtmlEntityTable[i].charName, entityName))
1327: {
1328: /* entity found */
1329: *entityValue = XhtmlEntityTable[i].charCode;
1330: *alphabet = 'L';
1331: }
1332: else
1.1 cvs 1333: {
1.3 cvs 1334: *alphabet = EOS;
1.1 cvs 1335: }
1336: }
1337:
1338: /*-------------------- Entities (end) ---------------------*/
1.7 ! cvs 1339: #endif /* EXPAT_PARSER */
Webmaster