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