[Pkg-javascript-commits] [node-expat] 43/371: emit startCdataElement/endCdataElement
Jonas Smedegaard
dr at jones.dk
Sun Feb 28 09:59:43 UTC 2016
This is an automated email from the git hooks/post-receive script.
js pushed a commit to branch master
in repository node-expat.
commit 74592f49459554c1571e68901a6e5de7df8bba99
Author: hoodoos <hoodoos at github.com>
Date: Thu Dec 2 18:39:59 2010 +0100
emit startCdataElement/endCdataElement
https://github.com/astro/node-expat/issues#issue/7
https://gist.github.com/725268
---
node-expat.cc | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/node-expat.cc b/node-expat.cc
index fbd6b0a..d39dcbe 100644
--- a/node-expat.cc
+++ b/node-expat.cc
@@ -10,6 +10,7 @@ using namespace v8;
using namespace node;
static Persistent<String> sym_startElement, sym_endElement,
+ sym_startCdataElement, sym_endCdataElement,
sym_text, sym_processingInstruction,
sym_comment, sym_xmlDecl;
@@ -31,6 +32,8 @@ public:
sym_startElement = NODE_PSYMBOL("startElement");
sym_endElement = NODE_PSYMBOL("endElement");
+ sym_startCdataElement = NODE_PSYMBOL("startCdataElement");
+ sym_endCdataElement = NODE_PSYMBOL("endCdataElement");
sym_text = NODE_PSYMBOL("text");
sym_processingInstruction = NODE_PSYMBOL("processingInstruction");
sym_comment = NODE_PSYMBOL("comment");
@@ -66,6 +69,7 @@ protected:
XML_SetUserData(parser, this);
XML_SetElementHandler(parser, StartElement, EndElement);
XML_SetCharacterDataHandler(parser, Text);
+ XML_SetCdataSectionHandler(parser, StartCdataElement, EndCdataElement);
XML_SetProcessingInstructionHandler(parser, ProcessingInstruction);
XML_SetCommentHandler(parser, Comment);
XML_SetXmlDeclHandler(parser, XmlDecl);
@@ -227,6 +231,24 @@ private:
Handle<Value> argv[1] = { String::New(name) };
parser->Emit(sym_endElement, 1, argv);
}
+
+ static void StartCdataElement(void *userData)
+ {
+ Parser *parser = reinterpret_cast<Parser *>(userData);
+
+ /* Trigger event */
+ Handle<Value> argv[0] = {};
+ parser->Emit(sym_startCdataElement, 0, argv);
+ }
+
+ static void EndCdataElement(void *userData)
+ {
+ Parser *parser = reinterpret_cast<Parser *>(userData);
+
+ /* Trigger event */
+ Handle<Value> argv[0] = {};
+ parser->Emit(sym_endCdataElement, 0, argv);
+ }
static void Text(void *userData,
const XML_Char *s, int len)
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-expat.git
More information about the Pkg-javascript-commits
mailing list