src/lxplib.c

changeset 1
304b5a6f85e4
parent 0
24d141cb2d1e
child 2
95f4883da11f
equal deleted inserted replaced
0:24d141cb2d1e 1:304b5a6f85e4
309 lua_pushstring(L, publicId); 309 lua_pushstring(L, publicId);
310 lua_pushstring(L, notationName); 310 lua_pushstring(L, notationName);
311 docall(xpu, 5, 0); 311 docall(xpu, 5, 0);
312 } 312 }
313 313
314 static void f_StartDoctypeDecl (void *ud, const XML_Char *doctypeName,
315 const XML_Char *sysid,
316 const XML_Char *pubid,
317 int has_internal_subset) {
318 lxp_userdata *xpu = (lxp_userdata *)ud;
319 if (getHandle(xpu, StartDoctypeDeclKey) == 0) return; /* no handle */
320 lua_pushstring(xpu->L, doctypeName);
321 lua_pushstring(xpu->L, sysid);
322 lua_pushstring(xpu->L, pubid);
323 lua_pushboolean(xpu->L, has_internal_subset);
324 docall(xpu, 4, 0);
325 }
326
314 /* }====================================================== */ 327 /* }====================================================== */
315 328
316 329
317 330
318 static int hasfield (lua_State *L, const char *fname) { 331 static int hasfield (lua_State *L, const char *fname) {
329 static const char *const validkeys[] = { 342 static const char *const validkeys[] = {
330 "StartCdataSection", "EndCdataSection", "CharacterData", "Comment", 343 "StartCdataSection", "EndCdataSection", "CharacterData", "Comment",
331 "Default", "DefaultExpand", "StartElement", "EndElement", 344 "Default", "DefaultExpand", "StartElement", "EndElement",
332 "ExternalEntityRef", "StartNamespaceDecl", "EndNamespaceDecl", 345 "ExternalEntityRef", "StartNamespaceDecl", "EndNamespaceDecl",
333 "NotationDecl", "NotStandalone", "ProcessingInstruction", 346 "NotationDecl", "NotStandalone", "ProcessingInstruction",
334 "UnparsedEntityDecl", NULL}; 347 "UnparsedEntityDecl", "StartDoctypeDecl", NULL};
335 if (hasfield(L, "_nonstrict")) return; 348 if (hasfield(L, "_nonstrict")) return;
336 lua_pushnil(L); 349 lua_pushnil(L);
337 while (lua_next(L, 1)) { 350 while (lua_next(L, 1)) {
338 lua_pop(L, 1); /* remove value */ 351 lua_pop(L, 1); /* remove value */
339 #if ! defined (LUA_VERSION_NUM) || LUA_VERSION_NUM < 501 352 #if ! defined (LUA_VERSION_NUM) || LUA_VERSION_NUM < 501
382 XML_SetNotStandaloneHandler(p, f_NotStandalone); 395 XML_SetNotStandaloneHandler(p, f_NotStandalone);
383 if (hasfield(L, ProcessingInstructionKey)) 396 if (hasfield(L, ProcessingInstructionKey))
384 XML_SetProcessingInstructionHandler(p, f_ProcessingInstruction); 397 XML_SetProcessingInstructionHandler(p, f_ProcessingInstruction);
385 if (hasfield(L, UnparsedEntityDeclKey)) 398 if (hasfield(L, UnparsedEntityDeclKey))
386 XML_SetUnparsedEntityDeclHandler(p, f_UnparsedEntityDecl); 399 XML_SetUnparsedEntityDeclHandler(p, f_UnparsedEntityDecl);
400 if (hasfield(L, StartDoctypeDeclKey))
401 XML_SetStartDoctypeDeclHandler(p, f_StartDoctypeDecl);
387 return 1; 402 return 1;
388 } 403 }
389 404
390 405
391 static lxp_userdata *checkparser (lua_State *L, int idx) { 406 static lxp_userdata *checkparser (lua_State *L, int idx) {

mercurial