Wed, 01 Jun 2011 22:16:24 +0100
Support for StartDoctypeDecl handler
src/lxplib.c | file | annotate | diff | comparison | revisions | |
src/lxplib.h | file | annotate | diff | comparison | revisions |
--- a/src/lxplib.c Wed Jun 01 22:14:25 2011 +0100 +++ b/src/lxplib.c Wed Jun 01 22:16:24 2011 +0100 @@ -311,6 +311,19 @@ docall(xpu, 5, 0); } +static void f_StartDoctypeDecl (void *ud, const XML_Char *doctypeName, + const XML_Char *sysid, + const XML_Char *pubid, + int has_internal_subset) { + lxp_userdata *xpu = (lxp_userdata *)ud; + if (getHandle(xpu, StartDoctypeDeclKey) == 0) return; /* no handle */ + lua_pushstring(xpu->L, doctypeName); + lua_pushstring(xpu->L, sysid); + lua_pushstring(xpu->L, pubid); + lua_pushboolean(xpu->L, has_internal_subset); + docall(xpu, 4, 0); +} + /* }====================================================== */ @@ -331,7 +344,7 @@ "Default", "DefaultExpand", "StartElement", "EndElement", "ExternalEntityRef", "StartNamespaceDecl", "EndNamespaceDecl", "NotationDecl", "NotStandalone", "ProcessingInstruction", - "UnparsedEntityDecl", NULL}; + "UnparsedEntityDecl", "StartDoctypeDecl", NULL}; if (hasfield(L, "_nonstrict")) return; lua_pushnil(L); while (lua_next(L, 1)) { @@ -384,6 +397,8 @@ XML_SetProcessingInstructionHandler(p, f_ProcessingInstruction); if (hasfield(L, UnparsedEntityDeclKey)) XML_SetUnparsedEntityDeclHandler(p, f_UnparsedEntityDecl); + if (hasfield(L, StartDoctypeDeclKey)) + XML_SetStartDoctypeDeclHandler(p, f_StartDoctypeDecl); return 1; }
--- a/src/lxplib.h Wed Jun 01 22:14:25 2011 +0100 +++ b/src/lxplib.h Wed Jun 01 22:16:24 2011 +0100 @@ -19,5 +19,6 @@ #define NotStandaloneKey "NotStandalone" #define ProcessingInstructionKey "ProcessingInstruction" #define UnparsedEntityDeclKey "UnparsedEntityDecl" +#define StartDoctypeDeclKey "StartDoctypeDecl" int luaopen_lxp (lua_State *L);