pocxxeci 0.30.1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of pocxxeci might be problematic. Click here for more details.
- package/LICENSE +19 -0
- package/Makefile +18 -0
- package/README.md +52 -0
- package/binding.gyp +81 -0
- package/index.d.ts +273 -0
- package/index.js +45 -0
- package/lib/bindings.js +1 -0
- package/lib/document.js +122 -0
- package/lib/element.js +82 -0
- package/lib/sax_parser.js +38 -0
- package/package.json +70 -0
- package/src/html_document.cc +7 -0
- package/src/html_document.h +18 -0
- package/src/libxmljs.cc +252 -0
- package/src/libxmljs.h +53 -0
- package/src/xml_attribute.cc +173 -0
- package/src/xml_attribute.h +40 -0
- package/src/xml_comment.cc +117 -0
- package/src/xml_comment.h +30 -0
- package/src/xml_document.cc +810 -0
- package/src/xml_document.h +67 -0
- package/src/xml_element.cc +565 -0
- package/src/xml_element.h +61 -0
- package/src/xml_namespace.cc +158 -0
- package/src/xml_namespace.h +39 -0
- package/src/xml_node.cc +761 -0
- package/src/xml_node.h +73 -0
- package/src/xml_pi.cc +161 -0
- package/src/xml_pi.h +34 -0
- package/src/xml_sax_parser.cc +424 -0
- package/src/xml_sax_parser.h +73 -0
- package/src/xml_syntax_error.cc +66 -0
- package/src/xml_syntax_error.h +25 -0
- package/src/xml_text.cc +320 -0
- package/src/xml_text.h +48 -0
- package/src/xml_textwriter.cc +315 -0
- package/src/xml_textwriter.h +62 -0
- package/src/xml_xpath_context.cc +70 -0
- package/src/xml_xpath_context.h +23 -0
- package/vendor/libxml/Copyright +23 -0
- package/vendor/libxml/DOCBparser.c +305 -0
- package/vendor/libxml/HTMLparser.c +7287 -0
- package/vendor/libxml/HTMLtree.c +1200 -0
- package/vendor/libxml/Makefile +2983 -0
- package/vendor/libxml/SAX.c +180 -0
- package/vendor/libxml/SAX2.c +3036 -0
- package/vendor/libxml/buf.c +1351 -0
- package/vendor/libxml/buf.h +72 -0
- package/vendor/libxml/c14n.c +2234 -0
- package/vendor/libxml/catalog.c +3828 -0
- package/vendor/libxml/chvalid.c +336 -0
- package/vendor/libxml/config.h +294 -0
- package/vendor/libxml/config.h.gch +0 -0
- package/vendor/libxml/debugXML.c +3423 -0
- package/vendor/libxml/dict.c +1298 -0
- package/vendor/libxml/elfgcchack.h +17818 -0
- package/vendor/libxml/enc.h +32 -0
- package/vendor/libxml/encoding.c +3975 -0
- package/vendor/libxml/entities.c +1163 -0
- package/vendor/libxml/error.c +998 -0
- package/vendor/libxml/globals.c +1126 -0
- package/vendor/libxml/hash.c +1146 -0
- package/vendor/libxml/include/libxml/DOCBparser.h +96 -0
- package/vendor/libxml/include/libxml/HTMLparser.h +306 -0
- package/vendor/libxml/include/libxml/HTMLtree.h +147 -0
- package/vendor/libxml/include/libxml/Makefile +725 -0
- package/vendor/libxml/include/libxml/Makefile.am +54 -0
- package/vendor/libxml/include/libxml/Makefile.in +725 -0
- package/vendor/libxml/include/libxml/SAX.h +173 -0
- package/vendor/libxml/include/libxml/SAX2.h +178 -0
- package/vendor/libxml/include/libxml/c14n.h +128 -0
- package/vendor/libxml/include/libxml/catalog.h +182 -0
- package/vendor/libxml/include/libxml/chvalid.h +230 -0
- package/vendor/libxml/include/libxml/debugXML.h +217 -0
- package/vendor/libxml/include/libxml/dict.h +79 -0
- package/vendor/libxml/include/libxml/encoding.h +245 -0
- package/vendor/libxml/include/libxml/entities.h +151 -0
- package/vendor/libxml/include/libxml/globals.h +508 -0
- package/vendor/libxml/include/libxml/hash.h +236 -0
- package/vendor/libxml/include/libxml/list.h +137 -0
- package/vendor/libxml/include/libxml/nanoftp.h +163 -0
- package/vendor/libxml/include/libxml/nanohttp.h +81 -0
- package/vendor/libxml/include/libxml/parser.h +1243 -0
- package/vendor/libxml/include/libxml/parserInternals.h +644 -0
- package/vendor/libxml/include/libxml/pattern.h +100 -0
- package/vendor/libxml/include/libxml/relaxng.h +217 -0
- package/vendor/libxml/include/libxml/schemasInternals.h +958 -0
- package/vendor/libxml/include/libxml/schematron.h +142 -0
- package/vendor/libxml/include/libxml/threads.h +89 -0
- package/vendor/libxml/include/libxml/tree.h +1311 -0
- package/vendor/libxml/include/libxml/uri.h +94 -0
- package/vendor/libxml/include/libxml/valid.h +458 -0
- package/vendor/libxml/include/libxml/xinclude.h +129 -0
- package/vendor/libxml/include/libxml/xlink.h +189 -0
- package/vendor/libxml/include/libxml/xmlIO.h +368 -0
- package/vendor/libxml/include/libxml/xmlautomata.h +146 -0
- package/vendor/libxml/include/libxml/xmlerror.h +945 -0
- package/vendor/libxml/include/libxml/xmlexports.h +77 -0
- package/vendor/libxml/include/libxml/xmlmemory.h +224 -0
- package/vendor/libxml/include/libxml/xmlmodule.h +57 -0
- package/vendor/libxml/include/libxml/xmlreader.h +428 -0
- package/vendor/libxml/include/libxml/xmlregexp.h +222 -0
- package/vendor/libxml/include/libxml/xmlsave.h +88 -0
- package/vendor/libxml/include/libxml/xmlschemas.h +246 -0
- package/vendor/libxml/include/libxml/xmlschemastypes.h +151 -0
- package/vendor/libxml/include/libxml/xmlstring.h +140 -0
- package/vendor/libxml/include/libxml/xmlunicode.h +202 -0
- package/vendor/libxml/include/libxml/xmlversion.h +484 -0
- package/vendor/libxml/include/libxml/xmlwin32version.h +239 -0
- package/vendor/libxml/include/libxml/xmlwriter.h +488 -0
- package/vendor/libxml/include/libxml/xpath.h +564 -0
- package/vendor/libxml/include/libxml/xpathInternals.h +632 -0
- package/vendor/libxml/include/libxml/xpointer.h +114 -0
- package/vendor/libxml/include/win32config.h +122 -0
- package/vendor/libxml/include/wsockcompat.h +54 -0
- package/vendor/libxml/legacy.c +1343 -0
- package/vendor/libxml/libxml.h +134 -0
- package/vendor/libxml/list.c +779 -0
- package/vendor/libxml/nanoftp.c +2118 -0
- package/vendor/libxml/nanohttp.c +1899 -0
- package/vendor/libxml/parser.c +15553 -0
- package/vendor/libxml/parserInternals.c +2164 -0
- package/vendor/libxml/pattern.c +2621 -0
- package/vendor/libxml/relaxng.c +11101 -0
- package/vendor/libxml/rngparser.c +1595 -0
- package/vendor/libxml/runsuite.c +1157 -0
- package/vendor/libxml/save.h +36 -0
- package/vendor/libxml/schematron.c +1787 -0
- package/vendor/libxml/threads.c +1049 -0
- package/vendor/libxml/timsort.h +601 -0
- package/vendor/libxml/tree.c +10183 -0
- package/vendor/libxml/trio.c +6895 -0
- package/vendor/libxml/trio.h +230 -0
- package/vendor/libxml/triodef.h +228 -0
- package/vendor/libxml/trionan.c +914 -0
- package/vendor/libxml/trionan.h +84 -0
- package/vendor/libxml/triop.h +150 -0
- package/vendor/libxml/triostr.c +2112 -0
- package/vendor/libxml/triostr.h +144 -0
- package/vendor/libxml/uri.c +2561 -0
- package/vendor/libxml/valid.c +7138 -0
- package/vendor/libxml/xinclude.c +2657 -0
- package/vendor/libxml/xlink.c +183 -0
- package/vendor/libxml/xmlIO.c +4135 -0
- package/vendor/libxml/xmlcatalog.c +624 -0
- package/vendor/libxml/xmllint.c +3796 -0
- package/vendor/libxml/xmlmemory.c +1163 -0
- package/vendor/libxml/xmlmodule.c +468 -0
- package/vendor/libxml/xmlreader.c +6033 -0
- package/vendor/libxml/xmlregexp.c +8271 -0
- package/vendor/libxml/xmlsave.c +2735 -0
- package/vendor/libxml/xmlschemas.c +29173 -0
- package/vendor/libxml/xmlschemastypes.c +6276 -0
- package/vendor/libxml/xmlstring.c +1050 -0
- package/vendor/libxml/xmlunicode.c +3179 -0
- package/vendor/libxml/xmlwriter.c +4738 -0
- package/vendor/libxml/xpath.c +14734 -0
- package/vendor/libxml/xpointer.c +2969 -0
- package/vendor/libxml/xzlib.c +815 -0
- package/vendor/libxml/xzlib.h +19 -0
@@ -0,0 +1,158 @@
|
|
1
|
+
// Copyright 2009, Squish Tech, LLC.
|
2
|
+
|
3
|
+
#include <node.h>
|
4
|
+
|
5
|
+
#include "xml_document.h"
|
6
|
+
#include "xml_namespace.h"
|
7
|
+
#include "xml_node.h"
|
8
|
+
|
9
|
+
using namespace v8;
|
10
|
+
|
11
|
+
namespace libxmljs {
|
12
|
+
|
13
|
+
Nan::Persistent<FunctionTemplate> XmlNamespace::constructor_template;
|
14
|
+
|
15
|
+
NAN_METHOD(XmlNamespace::New) {
|
16
|
+
Nan::HandleScope scope;
|
17
|
+
|
18
|
+
// created for an already existing namespace
|
19
|
+
if (info.Length() == 0) {
|
20
|
+
return info.GetReturnValue().Set(info.Holder());
|
21
|
+
}
|
22
|
+
|
23
|
+
// TODO(sprsquish): ensure this is an actual Node object
|
24
|
+
if (!info[0]->IsObject())
|
25
|
+
return Nan::ThrowError(
|
26
|
+
"You must provide a node to attach this namespace to");
|
27
|
+
|
28
|
+
XmlNode *node = Nan::ObjectWrap::Unwrap<XmlNode>(
|
29
|
+
Nan::To<Object>(info[0]).ToLocalChecked());
|
30
|
+
|
31
|
+
Nan::Utf8String *prefix = 0;
|
32
|
+
Nan::Utf8String *href = 0;
|
33
|
+
|
34
|
+
if (info[1]->IsString()) {
|
35
|
+
prefix = new Nan::Utf8String(info[1]);
|
36
|
+
}
|
37
|
+
|
38
|
+
href = new Nan::Utf8String(info[2]);
|
39
|
+
|
40
|
+
xmlNs *ns = xmlNewNs(node->xml_obj, (const xmlChar *)(href->operator*()),
|
41
|
+
prefix ? (const xmlChar *)(prefix->operator*()) : NULL);
|
42
|
+
|
43
|
+
delete prefix;
|
44
|
+
delete href;
|
45
|
+
|
46
|
+
XmlNamespace *namesp = new XmlNamespace(ns);
|
47
|
+
namesp->Wrap(info.Holder());
|
48
|
+
|
49
|
+
return info.GetReturnValue().Set(info.Holder());
|
50
|
+
}
|
51
|
+
|
52
|
+
Local<Object> XmlNamespace::New(xmlNs *node) {
|
53
|
+
Nan::EscapableHandleScope scope;
|
54
|
+
if (node->_private) {
|
55
|
+
return scope.Escape(static_cast<XmlNamespace *>(node->_private)->handle());
|
56
|
+
}
|
57
|
+
|
58
|
+
XmlNamespace *ns = new XmlNamespace(node);
|
59
|
+
Local<Object> obj =
|
60
|
+
Nan::NewInstance(
|
61
|
+
Nan::GetFunction(Nan::New(constructor_template)).ToLocalChecked())
|
62
|
+
.ToLocalChecked();
|
63
|
+
ns->Wrap(obj);
|
64
|
+
return scope.Escape(obj);
|
65
|
+
}
|
66
|
+
|
67
|
+
XmlNamespace::XmlNamespace(xmlNs *node) : xml_obj(node) {
|
68
|
+
xml_obj->_private = this;
|
69
|
+
|
70
|
+
/*
|
71
|
+
* If a context is present and wrapped, increment its refcount to ensure
|
72
|
+
* that it is considered accessible from javascript for as long as the
|
73
|
+
* namespace is accessible.
|
74
|
+
*/
|
75
|
+
if ((xml_obj->context) && (xml_obj->context->_private != NULL)) {
|
76
|
+
this->context = xml_obj->context;
|
77
|
+
// a namespace must be created on a given node
|
78
|
+
XmlDocument *doc = static_cast<XmlDocument *>(xml_obj->context->_private);
|
79
|
+
doc->Ref();
|
80
|
+
} else {
|
81
|
+
this->context = NULL;
|
82
|
+
}
|
83
|
+
}
|
84
|
+
|
85
|
+
XmlNamespace::~XmlNamespace() {
|
86
|
+
/*
|
87
|
+
* `xml_obj` may have been nulled by `xmlDeregisterNodeCallback` when
|
88
|
+
* the `xmlNs` was freed along with an attached node or document.
|
89
|
+
*/
|
90
|
+
if (xml_obj != NULL) {
|
91
|
+
xml_obj->_private = NULL;
|
92
|
+
}
|
93
|
+
|
94
|
+
/*
|
95
|
+
* The context pointer is only set if this wrapper has incremented the
|
96
|
+
* refcount of the context wrapper.
|
97
|
+
*/
|
98
|
+
if (this->context != NULL) {
|
99
|
+
if (this->context->_private != NULL) {
|
100
|
+
// release the hold and allow the document to be freed
|
101
|
+
XmlDocument *doc = static_cast<XmlDocument *>(this->context->_private);
|
102
|
+
doc->Unref();
|
103
|
+
}
|
104
|
+
this->context = NULL;
|
105
|
+
}
|
106
|
+
|
107
|
+
// We do not free the xmlNode here. It could still be part of a document
|
108
|
+
// It will be freed when the doc is freed
|
109
|
+
}
|
110
|
+
|
111
|
+
NAN_METHOD(XmlNamespace::Href) {
|
112
|
+
Nan::HandleScope scope;
|
113
|
+
XmlNamespace *ns = Nan::ObjectWrap::Unwrap<XmlNamespace>(info.Holder());
|
114
|
+
assert(ns);
|
115
|
+
return info.GetReturnValue().Set(ns->get_href());
|
116
|
+
}
|
117
|
+
|
118
|
+
NAN_METHOD(XmlNamespace::Prefix) {
|
119
|
+
Nan::HandleScope scope;
|
120
|
+
XmlNamespace *ns = Nan::ObjectWrap::Unwrap<XmlNamespace>(info.Holder());
|
121
|
+
assert(ns);
|
122
|
+
return info.GetReturnValue().Set(ns->get_prefix());
|
123
|
+
}
|
124
|
+
|
125
|
+
Local<Value> XmlNamespace::get_href() {
|
126
|
+
Nan::EscapableHandleScope scope;
|
127
|
+
if (xml_obj->href)
|
128
|
+
return scope.Escape(
|
129
|
+
Nan::New<String>((const char *)xml_obj->href, xmlStrlen(xml_obj->href))
|
130
|
+
.ToLocalChecked());
|
131
|
+
|
132
|
+
return scope.Escape(Nan::Null());
|
133
|
+
}
|
134
|
+
|
135
|
+
Local<Value> XmlNamespace::get_prefix() {
|
136
|
+
Nan::EscapableHandleScope scope;
|
137
|
+
if (xml_obj->prefix)
|
138
|
+
return scope.Escape(Nan::New<String>((const char *)xml_obj->prefix,
|
139
|
+
xmlStrlen(xml_obj->prefix))
|
140
|
+
.ToLocalChecked());
|
141
|
+
|
142
|
+
return scope.Escape(Nan::Null());
|
143
|
+
}
|
144
|
+
|
145
|
+
void XmlNamespace::Initialize(Local<Object> target) {
|
146
|
+
Nan::HandleScope scope;
|
147
|
+
Local<FunctionTemplate> tmpl = Nan::New<FunctionTemplate>(New);
|
148
|
+
constructor_template.Reset(tmpl);
|
149
|
+
tmpl->InstanceTemplate()->SetInternalFieldCount(1);
|
150
|
+
|
151
|
+
Nan::SetPrototypeMethod(tmpl, "href", XmlNamespace::Href);
|
152
|
+
|
153
|
+
Nan::SetPrototypeMethod(tmpl, "prefix", XmlNamespace::Prefix);
|
154
|
+
|
155
|
+
Nan::Set(target, Nan::New<String>("Namespace").ToLocalChecked(),
|
156
|
+
Nan::GetFunction(tmpl).ToLocalChecked());
|
157
|
+
}
|
158
|
+
} // namespace libxmljs
|
@@ -0,0 +1,39 @@
|
|
1
|
+
// Copyright 2009, Squish Tech, LLC.
|
2
|
+
#ifndef SRC_XML_NAMESPACE_H_
|
3
|
+
#define SRC_XML_NAMESPACE_H_
|
4
|
+
|
5
|
+
#include <node.h>
|
6
|
+
|
7
|
+
#include "nan.h"
|
8
|
+
#include <libxml/tree.h>
|
9
|
+
|
10
|
+
namespace libxmljs {
|
11
|
+
|
12
|
+
class XmlNamespace : public Nan::ObjectWrap {
|
13
|
+
public:
|
14
|
+
xmlNs *xml_obj;
|
15
|
+
|
16
|
+
xmlDoc *context; // reference-managed context
|
17
|
+
|
18
|
+
static void Initialize(v8::Local<v8::Object> target);
|
19
|
+
static Nan::Persistent<v8::FunctionTemplate> constructor_template;
|
20
|
+
|
21
|
+
explicit XmlNamespace(xmlNs *ns);
|
22
|
+
XmlNamespace(xmlNs *node, const char *prefix, const char *href);
|
23
|
+
~XmlNamespace();
|
24
|
+
|
25
|
+
static v8::Local<v8::Object> New(xmlNs *ns);
|
26
|
+
|
27
|
+
protected:
|
28
|
+
static NAN_METHOD(New);
|
29
|
+
static NAN_METHOD(Href);
|
30
|
+
static NAN_METHOD(Prefix);
|
31
|
+
|
32
|
+
v8::Local<v8::Value> get_href();
|
33
|
+
v8::Local<v8::Value> get_prefix();
|
34
|
+
|
35
|
+
friend class Node;
|
36
|
+
};
|
37
|
+
} // namespace libxmljs
|
38
|
+
|
39
|
+
#endif // SRC_XML_NAMESPACE_H_
|