albanm / node-libxslt Goto Github PK
View Code? Open in Web Editor NEWNode.js bindings for libxslt compatible with libxmljs
Node.js bindings for libxslt compatible with libxmljs
It would be nice if we could extend the XSLT resp. XPath language using Extensions functions. LibXSLT provides custom extensions. It would be great to have that API wrapped on the JavaScript side, so one can write extension functions there.
Please add validations same as "Stylesheet.prototype.apply" method inside method below.
Line 183 in c51e287
This method throws an error "TypeError: callback is not a function" if called only with 2 params as below:
// documentPath : some inaccessible invalid path
stylesheet.applyToFile(documentPath, function(error, result) {
if( !err ) {
// handle success
} else {
// handle error
}
});
But above code works well with accessible valid value "documentPath".
When using libxslt v0.5.4 as a module of another module inside my app, I get a failure (in both node 0.10 and 0.12 on Ubuntu 14.04):
usr/bin/nodejs: symbol lookup error: /vagrant/node_modules/enketo-transformer/node_modules/libxslt/build/Release/node-libxslt.node: undefined symbol: _ZN8libxmljs12WorkerParentC1Ev
This failure does not occur when I perform the exact same transformation (same source, same stylesheet) in the module itself (where libxslt is a direct dependency and not a dependency of a dependency). Thus it seems to me that this may be an issue with path definitions inside node-libxslt.
This issue did not occur in 0.4.1.
I'll let you know if I find out more.
This is a small patch
The auto string wrap commodity here can cause a XPath error if the parameter contains a xpath expression that uses ' (single quotes), ex:
//*[@id='someid']
we can preserve the nice functionality but allow the second case to pass thru...
my suggestion: use options.noWrapParams (or something like it, please suggest name) to disable it in some cases.
when absent or =false on options the normal behavior is observed, must be explicit turned on
when turned on, the user is responsible to wrap the strings him self
its ok for params to be xpath expressions (naked strings) they will be evaluated and exist within the xslt as sets of nodes (very usefull)
this option extention would allow feeding xpath parameters but still disallows passing some xpath expressions as strings (in case we want the expression, not the node sets)
to allow passing xpath (and other data containing single quotes) i would sugest wrapping the parameters with double quotes instead avoiding escapping back and forth of xpath expressions
if (!options.noWrapParams)
for(var p in params) {
// string parameters must be surrounded by quotes to be usable by the stylesheet
if (typeof params[p] === 'string') params[p] = '"' + params[p].replace(/""/g,'\\"') + '"';
}
with this litle change we can feed in xpath selectors and send xpath string expressions that use single quotes
I've also included an escape of double-quotes, is this ok or should we leave it to the user?
i can implement this if you guys agree
No problem building v0.4.1 but when trying to build the latest commit ab9fec2 to avoid the segfault issue, I'm getting a make: No rule to make target
error.
make: Leaving directory `/vagrant/node_modules/libxslt/node_modules/libxmljs/build'
> [email protected] install /vagrant/node_modules/libxslt
> node-gyp rebuild
make: Entering directory `/vagrant/node_modules/libxslt/build'
make: *** No rule to make target `Release/obj.target/libexslt/deps/libxslt/libexslt/common.o', needed by `Release/obj.target/deps/exslt.a'. Stop.
make: Leaving directory `/vagrant/node_modules/libxslt/build'
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
I see the Travis build passed (on node 0.12.5).
My npm version is v2.11.2 and I've updated npm's internal node-gyp module.
Any idea on what the issue could be?
When applying a document to a stylesheet, there are runtime errors reported in the console but it is not reflected in any error object.
runtime error: element value-of
Variable 'foobar' has not been declared.
xmlXPathCompiledEval: evaluation failed
runtime error: element value-of
XPath evaluation returned no result.
I ran into a weird issue on 2 out of 3 servers when upgrading to NodeJS 4.2.2. So far the only difference I found between these servers, is the linux kernel. (Good server: 3.13.0-14-generic, Bad servers: 3.13.0-57-generic and 3.13.0-43-generic).
Npm version (2.14.7), NodeJS version (4.2.2), NPM's internal node-gyp version (3.0.3) are all the same.
I'm out of ideas at the moment. Is there anything else you can recommend I check?
This is the error. It occurs when starting the application after a successful npm install
.
/home/enketo/enketo-express/node_modules/libxslt/node_modules/bindings/bindings.js:91
throw err
^
Error: Could not locate the bindings file. Tried:
→ /home/enketo/enketo-express/node_modules/libxslt/node_modules/libxmljs-mt/build/xmljs.node
→ /home/enketo/enketo-express/node_modules/libxslt/node_modules/libxmljs-mt/build/Debug/xmljs.node
→ /home/enketo/enketo-express/node_modules/libxslt/node_modules/libxmljs-mt/build/Release/xmljs.node
→ /home/enketo/enketo-express/node_modules/libxslt/node_modules/libxmljs-mt/out/Debug/xmljs.node
→ /home/enketo/enketo-express/node_modules/libxslt/node_modules/libxmljs-mt/Debug/xmljs.node
→ /home/enketo/enketo-express/node_modules/libxslt/node_modules/libxmljs-mt/out/Release/xmljs.node
→ /home/enketo/enketo-express/node_modules/libxslt/node_modules/libxmljs-mt/Release/xmljs.node
→ /home/enketo/enketo-express/node_modules/libxslt/node_modules/libxmljs-mt/build/default/xmljs.node
→ /home/enketo/enketo-express/node_modules/libxslt/node_modules/libxmljs-mt/compiled/4.2.2/linux/x64/xmljs.node
at bindings (/home/enketo/enketo-express/node_modules/libxslt/node_modules/bindings/bindings.js:88:9)
at Object.<anonymous> (/home/enketo/enketo-express/node_modules/libxslt/node_modules/libxmljs-mt/lib/bindings.js:1:99)
at Module._compile (module.js:435:26)
at Object.Module._extensions..js (module.js:442:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:311:12)
at Module.require (module.js:366:17)
at require (module.js:385:17)
at Object.<anonymous> (/home/enketo/enketo-express/node_modules/libxslt/node_modules/libxmljs-mt/index.js:4:16)
at Module._compile (module.js:435:26)
I am trying to use libxslt in web application ( running on browser) . I got error about requiring your library. I am faced with a kind of TypeError. Does it have browser support ? Or is it impossible using in web application ? I am also using npm 6.14.4 version, not latest one. Do I need to use newer npm version ?
A call to the apply method of the stylesheet
object returned from the parse
operation modifies the parameters passed as the 2nd argument to enclose strings in double quotes.
The object passed in should not be modified.
Subsequent calls to apply result in the string being enclosed in more double quotes.
const libxslt = require('libxslt');
const xslt = `<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:param name="Param1"/>
<xsl:template match="/">
<xsl:value-of select="$Param1"/>
</xsl:template>
</xsl:stylesheet>`;
libxslt.parse(xslt, (err, stylesheet) =>
{
let Params = {
Param1: 'hello'
};
stylesheet.apply(`<xml></xml>`, Params, (err, result) =>
{
console.log(result);
console.log(Params);
console.assert(Params.Param1 === 'hello');
});
});
gives
<?xml version="1.0"?>
hello
{ Param1: '"hello"' }
assert.js:85
throw new assert.AssertionError({
^
AssertionError: false == true
at Console.assert (console.js:95:23)
at stylesheet.apply (/path/to/file.js:20:17)
at /path/to/node_modules/libxslt/index.js:149:4
Additionally, double quotes within the parameter string are not escaped.
const libxslt = require('libxslt');
const xslt = `<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:param name="Param1"/>
<xsl:template match="/">
<xsl:value-of select="$Param1"/>
</xsl:template>
</xsl:stylesheet>`;
libxslt.parse(xslt, (err, stylesheet) =>
{
let Params = {
Param1: 'he"llo'
};
stylesheet.apply(`<xml></xml>`, Params, (err, result) =>
{
});
});
This error is not even sent to the callback but instead causes the application to crash.
XPath error : Invalid expression
"he"llo"
^
runtime error
Evaluating user parameter Param1 failed
Segmentation fault
I have been making use of various exslt functions (xmlns:str="http://exslt.org/strings"
, xmlns:dyn="http://exslt.org/dynamic"
). This works fine.
However, I don't seem to be able to get regexp functions working with xmlns:regexp="http://exslt.org/regular-expressions"
. I'm trying to figure where (in the code) I can check which exslt extensions are supported and which aren't. Could you point me in the right direction please?
npm install libxslt
fails on Yosemite with
CC(target) Release/obj.target/libexslt/deps/libxslt/libexslt/common.o
In file included from ../deps/libxslt/libexslt/common.c:2:
../deps/libxslt/libexslt/libexslt.h:19:10: fatal error: 'libxml/xmlversion.h' file not found
#include <libxml/xmlversion.h>
^
1 error generated.
make: *** [Release/obj.target/libexslt/deps/libxslt/libexslt/common.o] Error 1
I've tried with the latest version of node-gyp. I also tried installing libxmljs out of curiosity and it worked fine. Any ideas what I've missed? Thanks.
HI,
Node v8.12.0, NPM v6.4.1
make: Entering directory '/home/project/node_modules/libxmljs-mt/build'
CXX(target) Release/obj.target/xmljs/src/libxmljs.o
make: g++: Command not found
xmljs.target.mk:165: recipe for target 'Release/obj.target/xmljs/src/libxmljs.o' failed
make: *** [Release/obj.target/xmljs/src/libxmljs.o] Error 127
make: Leaving directory '/home/project/node_modules/libxmljs-mt/build'
gyp ERR! build error
gyp ERR! stack Error: make
failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/home/steve/.nvm/versions/node/v8.12.0/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack at emitTwo (events.js:126:13)
gyp ERR! stack at ChildProcess.emit (events.js:214:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
gyp ERR! System Linux 4.15.0-33-generic
Hello,
We would like to report a possible issue in the library :
We are trying to apply an XSL to a XML file.
This XML file has an attribute containing a big picture in Base 64 (about 2 megabytes).
runtime error: element text
xsltCopyText: text allocation failed
runtime error: element text
xsltCopyText: text allocation failed
runtime error: element text
xsltCopyText: text allocation failed
runtime error: element text
xsltCopyText: text allocation failed
runtime error: element text
xsltCopyText: text allocation failed
runtime error: element text
xsltCopyText: text allocation failed
runtime error: element text
xsltCopyText: text allocation failed
runtime error: element text
xsltCopyText: text allocation failed
runtime error: element text
xsltCopyText: text allocation failed
runtime error: element text
xsltCopyText: text allocation failed
runtime error: element text
xsltCopyText: text allocation failed
runtime error: element text
xsltCopyText: text allocation failed
runtime error: element text
xsltCopyText: text allocation failed
runtime error: element text
xsltCopyText: text allocation failed
runtime error: element text
xsltCopyText: text allocation failed
runtime error: element text
xsltCopyText: text allocation failed
runtime error: element text
xsltCopyText: text allocation failed
runtime error: element text
xsltCopyText: text allocation failed
runtime error: element text
xsltCopyText: text allocation failed
runtime error
Internal error in xsltCopyText(): Failed to copy the string.
First of, node-libxslt is awesome,
having a wee issue with disable-output-escaping attribute on value of and text nodes, doesn't seem to be having any affect
when I try to transform
<root>
<content>hello&amp;world</content>
</root>
Using xslt
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="root">
<xsl:value-of select="content" disable-output-escaping="yes"/>
<xsl:text disable-output-escaping="yes"><![CDATA[<foo/>]]></xsl:text>
<xsl:text disable-output-escaping="no"><![CDATA[<bar/>]]></xsl:text>
</xsl:template>
</xsl:stylesheet>
I'm expecting to node-libxslt to output
<?xml version="1.0" encoding="UTF-8"?>
hello&world
<foo/><bar/>
Instead I'm getting
<?xml version="1.0" encoding="UTF-8"?>
hello&world
<foo/><bar/>
Test code:
var libxslt = require('libxslt');
var xml = '<?xml version="1.0" encoding="utf-8"?>\n<root></root>';
var xsl = '<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">' +
'<xsl:template match="/"></xsl:template>' +
'</xsl:stylesheet>'
;
var xslObj = libxslt.parse(xsl);
xslObj.apply(xml);
$ npm --version
3.10.10
$ node --version
v6.11.2
When I am running: npm install libxslt
there is the following error:
[...]
make: Entering directory '/var/jenkins_home/jobs/Requester (dev)/workspace/app/node_modules/libxslt/build'
CC(target) Release/obj.target/libexslt/deps/libxslt/libexslt/common.o
/bin/sh: 1: Syntax error: "(" unexpected
deps/libexslt.target.mk:116: recipe for target 'Release/obj.target/libexslt/deps/libxslt/libexslt/common.o' failed
make: *** [Release/obj.target/libexslt/deps/libxslt/libexslt/common.o] Error 2
[...]
I can't find a solution. Can you point me in a direction. I am working on Linux 22075ab904d4 4.9.0-3-amd64 #1 SMP Debian 4.9.30-2+deb9u3 (2017-08-06) x86_64 GNU/Linux
Debian 9.
Hi everyone,
Is there an option to turn off the XML def Header from the JSON response ?
I parse my document and applu stylesheet on document to get this result:
Eg.
<?xml version="1.0" encoding="UTF-8"?>
{
"foreignKey": "key1",
"title": "Title1",
"description": "Som text..."
}
I do not want a XML header in my JSON transformed response. Can I turn it off with some option ??
Ran into this today after upgrading. Was wondering if you have an estimated timeline for bringing this module to v0.12?
Thanks
Using libxslt v0.4.1 on node 0.12.0.
PID 15457 received SIGSEGV for address: 0x20
/tmp/nodetest/node_modules/libxslt/node_modules/segfault-handler/build/Release/segfault-handler.node(+0x11f6)[0x7f6401a491f6]
/lib/x86_64-linux-gnu/libpthread.so.0(+0xfc90)[0x7f640281fc90]
/tmp/nodetest/node_modules/libxslt/node_modules/libxmljs/build/Release/xmljs.node(_ZN8libxmljs16xmlMemMallocWrapEm+0x31)[0x7f64016e7551]
/tmp/nodetest/node_modules/libxslt/build/Release/node-libxslt.node(xsltNewStylesheet+0x17)[0x7f640146ee07]
/tmp/nodetest/node_modules/libxslt/build/Release/node-libxslt.node(xsltParseStylesheetImportedDoc+0x25)[0x7f6401471225]
/tmp/nodetest/node_modules/libxslt/build/Release/node-libxslt.node(xsltParseStylesheetDoc+0x1b)[0x7f64014714ab]
/tmp/nodetest/node_modules/libxslt/build/Release/node-libxslt.node(_ZN16StylesheetWorker7ExecuteEv+0x1c)[0x7f640145f23c]
node[0xc5520c]
node[0xc62e48]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x80a5)[0x7f64028180a5]
/lib/x86_64-linux-gnu/libc.so.6(clone+0x6d)[0x7f6402545cfd]
Segmentation fault (core dumped)
See the title. If you try to install on MacOS in a path such as: /Users/xxx/Documents/Path With Spaces/node-project
. The build will fail.
Output:
node-pre-gyp http GET https://github.com/gagern/libxmljs/releases/download/v1.0.0-mt/node-v64-win32-x64.tar.gz
node-pre-gyp ERR! Completion callback never invoked!
node-pre-gyp ERR! System Windows_NT 10.0.17763
node-pre-gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Users\n1528034\node_modules\node-pre-gyp\bin\node-pre-gyp" "install" "--fallback-to-build" "--loglevel" "http"
node-pre-gyp ERR! cwd C:\Users\n1528034\node_modules\node1-libxmljsmt
node-pre-gyp ERR! node -v v10.19.0
node-pre-gyp ERR! node-pre-gyp -v v0.9.1
node-pre-gyp ERR! This is a bug in node-pre-gyp
.
node-pre-gyp ERR! Try to update node-pre-gyp and file an issue if it does not help:
node-pre-gyp ERR! https://github.com/mapbox/node-pre-gyp/issues
Tried to install libxslt but it sadly failed during building; See npm log for more information.
Relevant error is
SOLINK_MODULE(target) Release/obj.target/node-libxslt.node
g++: error: /home/azatoth/Project/eaktiebok/node_modules/libxmljs-mt/build/Release/xmljs.node: No such file or directory
node-libxslt.target.mk:136: recipe for target 'Release/obj.target/node-libxslt.node' failed
I installed libxmljs-mt manually to see, and I notice there is a xmljs.node file in either lib.target/ or obj.target/ in the Release dir.
npm-debug.log.txt
Hi Albanm,
We got a issue. Sometimes our xml file is very complicated, the apply sync function will run more than 30 minutes and makes 100% cpu.
Is there a way to abort the apply function with a timeout parameter or how can I implement this request?
Thanks
I'm currently using this module along with node debugger and a watch task. Every time I change code and tests re-run I get this error message:
< Message:
< Module did not self-register.
< Stack:
< Error: Module did not self-register.
< at Error (native)
< at Object.Module._extensions..node (module.js:440:18)
< at Module.load (module.js:357:32)
< at Function.Module._load (module.js:314:12)
< at Module.require (module.js:367:17)
< at require (internal/module.js:16:19)
< at bindings (/Users/chason/Sites/pagijs/node_modules/bindings/bindings.js:76:44)
< at Object.<anonymous> (/Users/chason/Sites/pagijs/node_modules/libxmljs-mt/lib/bindings.js:1:99)
< at Module._compile (module.js:413:34)
< at Object.Module._extensions..js (module.js:422:10)
Any idea how I can fix it?
node-libxslt fails to build with iojs 3.3.0 with a bunch of error messages like:
error: assigning to 'v8::Function *volatile' from incompatible type 'v8::Value
It seem sto related to nan
.
Loading the latest node-libxslt module fails.
Reproduce (used node v0.12.7 on Ubuntu 14.04):
npm install libxslt
node
> var libxslt = require('libxslt');
Error:
Error: /home/vagrant/node_modules/libxslt/build/Release/node-libxslt.node: undefined symbol: LIBXSLT_DEFAULT_PLUGINS_PATH
at Error (native)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at bindings (/home/vagrant/node_modules/libxslt/node_modules/bindings/bindings.js:76:44)
at Object.<anonymous> (/home/vagrant/node_modules/libxslt/index.js:8:34)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
(this works fine in node-libxslt v0.4.1)
node version - v13.6.0
npm version - 6.13.4
error :
cd replaceNewNum && npm install && cd ..
up to date in 0.662s
cd local_plugins/com-accenture-cas-plugins-dba && npm install && cd ../..
[email protected] install /Users/shivani.rana/cw/App/local_plugins/com-accenture-cas-plugins-dba/node_modules/libxmljs
node-pre-gyp install --fallback-to-build --loglevel http
node-pre-gyp WARN Using request for node-pre-gyp https download
node-pre-gyp http GET https://github.com/libxmljs/libxmljs/releases/download/v0.19.5/node-v79-darwin-x64.tar.gz
node-pre-gyp http 404 https://github.com/libxmljs/libxmljs/releases/download/v0.19.5/node-v79-darwin-x64.tar.gz
node-pre-gyp WARN Tried to download(404): https://github.com/libxmljs/libxmljs/releases/download/v0.19.5/node-v79-darwin-x64.tar.gz
node-pre-gyp WARN Pre-built binaries not found for [email protected] and [email protected] (node-v79 ABI, unknown) (falling back to source compile with node-gyp)
node-pre-gyp http 404 status code downloading tarball https://github.com/libxmljs/libxmljs/releases/download/v0.19.5/node-v79-darwin-x64.tar.gz
CXX(target) Release/obj.target/xmljs/src/libxmljs.o
In file included from ../src/libxmljs.cc:7:
In file included from ../src/libxmljs.h:7:
In file included from ../../nan/nan.h:202:
In file included from ../../nan/nan_converters.h:67:
../../nan/nan_converters_43_inl.h:22:1: error: no viable conversion from 'Localv8::Context' to 'v8::Isolate '
X(Boolean)
^~~~~~~~~~
../../nan/nan_converters_43_inl.h:18:23: note: expanded from macro 'X'
val->To ## TYPE(isolate->GetCurrentContext())
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/shivani.rana/Library/Caches/node-gyp/13.6.0/include/node/v8.h:2762:37: note: passing argument to parameter 'isolate' here
Local ToBoolean(Isolate isolate) const;
^
In file included from ../src/libxmljs.cc:7:
In file included from ../src/libxmljs.h:7:
In file included from ../../nan/nan.h:202:
In file included from ../../nan/nan_converters.h:67:
../../nan/nan_converters_43_inl.h:40:1: error: no viable conversion from 'Localv8::Context' to 'v8::Isolate '
X(bool, Boolean)
^~~~~~~~~~~~~~~~
../../nan/nan_converters_43_inl.h:37:29: note: expanded from macro 'X'
return val->NAME ## Value(isolate->GetCurrentContext());
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/shivani.rana/Library/Caches/node-gyp/13.6.0/include/node/v8.h:2771:30: note: passing argument to parameter 'isolate' here
bool BooleanValue(Isolate isolate) const;
^
In file included from ../src/libxmljs.cc:7:
In file included from ../src/libxmljs.h:7:
In file included from ../../nan/nan.h:203:
In file included from ../../nan/nan_new.h:189:
../../nan/nan_implementation_12_inl.h:103:42: error: no viable conversion from 'v8::Isolate *' to 'Localv8::Context'
return scope.Escape(v8::Function::New( isolate
^~~~~~~
/Users/shivani.rana/Library/Caches/node-gyp/13.6.0/include/node/v8.h:189:7: note: candidate constructor (the implicit copy constructor) not viable: no known
conversion from 'v8::Isolate *' to 'const v8::Localv8::Context &' for 1st argument
class Local {
^
/Users/shivani.rana/Library/Caches/node-gyp/13.6.0/include/node/v8.h:189:7: note: candidate constructor (the implicit move constructor) not viable: no known
conversion from 'v8::Isolate *' to 'v8::Localv8::Context &&' for 1st argument
/Users/shivani.rana/Library/Caches/node-gyp/13.6.0/include/node/v8.h:193:13: note: candidate template ignored: could not match 'Local'
against 'v8::Isolate '
V8_INLINE Local(Local that)
^
/Users/shivani.rana/Library/Caches/node-gyp/13.6.0/include/node/v8.h:4313:22: note: passing argument to parameter 'context' here
Local context, FunctionCallback callback,
^
In file included from ../src/libxmljs.cc:7:
In file included from ../src/libxmljs.h:7:
In file included from ../../nan/nan.h:203:
In file included from ../../nan/nan_new.h:189:
../../nan/nan_implementation_12_inl.h:337:37: error: too few arguments to function call, expected 2, have 1
return v8::StringObject::New(value).Asv8::StringObject();
~~~~~~~~~~~~~~~~~~~~~ ^
/Users/shivani.rana/Library/Caches/node-gyp/13.6.0/include/node/v8.h:5688:3: note: 'New' declared here
static Local New(Isolate isolate, Local value);
^
In file included from ../src/libxmljs.cc:7:
In file included from ../src/libxmljs.h:7:
In file included from ../../nan/nan.h:203:
In file included from ../../nan/nan_new.h:189:
../../nan/nan_implementation_12_inl.h:337:58: error: expected '(' for function-style cast or type construction
return v8::StringObject::New(value).Asv8::StringObject();
~~~~~~~~~~~~~~~~^
../../nan/nan_implementation_12_inl.h:337:60: error: expected expression
return v8::StringObject::New(value).Asv8::StringObject();
^
In file included from ../src/libxmljs.cc:7:
In file included from ../src/libxmljs.h:7:
../../nan/nan.h:1034:53: error: too few arguments to function call, single argument 'context' was not specified
v8::Localv8::String string = from->ToString();
~~~~~~~~~~~~~~ ^
/Users/shivani.rana/Library/Caches/node-gyp/13.6.0/include/node/v8.h:2750:3: note: 'ToString' declared here
V8_WARN_UNUSED_RESULT MaybeLocal ToString(
^
/Users/shivani.rana/Library/Caches/node-gyp/13.6.0/include/node/v8config.h:419:31: note: expanded from macro 'V8_WARN_UNUSED_RESULT'
#define V8_WARN_UNUSED_RESULT attribute((warn_unused_result))
^
In file included from ../src/libxmljs.cc:7:
In file included from ../src/libxmljs.h:7:
../../nan/nan.h:1044:37: error: cannot initialize a parameter of type 'v8::Isolate ' with an lvalue of type 'char '
length_ = string->WriteUtf8(str_, static_cast(len), 0, flags);
^~~~
/Users/shivani.rana/Library/Caches/node-gyp/13.6.0/include/node/v8.h:2947:26: note: passing argument to parameter 'isolate' here
int WriteUtf8(Isolate isolate, char buffer, int length = -1,
^
In file included from ../src/libxmljs.cc:7:
In file included from ../src/libxmljs.h:7:
../../nan/nan.h:1818:28: error: no matching member function for call to 'Set'
New(persistentHandle)->Set(New(key).ToLocalChecked(), value);
~~~~~~~~~~~~~~~~~~~~~~~^~~
/Users/shivani.rana/Library/Caches/node-gyp/13.6.0/include/node/v8.h:3547:37: note: candidate function not viable: requires 3 arguments, but 2 were provided
V8_WARN_UNUSED_RESULT Maybe Set(Local context,
^
/Users/shivani.rana/Library/Caches/node-gyp/13.6.0/include/node/v8.h:3550:37: note: candidate function not viable: requires 3 arguments, but 2 were provided
V8_WARN_UNUSED_RESULT Maybe Set(Local context, uint32_t index,
^
In file included from ../src/libxmljs.cc:7:
In file included from ../src/libxmljs.h:7:
../../nan/nan.h:1824:28: error: no matching member function for call to 'Set'
New(persistentHandle)->Set(key, value);
~~~~~~~~~~~~~~~~~~~~~~~^~~
/Users/shivani.rana/Library/Caches/node-gyp/13.6.0/include/node/v8.h:3547:37: note: candidate function not viable: requires 3 arguments, but 2 were provided
V8_WARN_UNUSED_RESULT Maybe Set(Local context,
^
/Users/shivani.rana/Library/Caches/node-gyp/13.6.0/include/node/v8.h:3550:37: note: candidate function not viable: requires 3 arguments, but 2 were provided
V8_WARN_UNUSED_RESULT Maybe Set(Local context, uint32_t index,
^
In file included from ../src/libxmljs.cc:7:
In file included from ../src/libxmljs.h:7:
../../nan/nan.h:1830:28: error: no matching member function for call to 'Set'
New(persistentHandle)->Set(index, value);
~~~~~~~~~~~~~~~~~~~~~~~^~~
/Users/shivani.rana/Library/Caches/node-gyp/13.6.0/include/node/v8.h:3547:37: note: candidate function not viable: requires 3 arguments, but 2 were provided
V8_WARN_UNUSED_RESULT Maybe Set(Local context,
^
/Users/shivani.rana/Library/Caches/node-gyp/13.6.0/include/node/v8.h:3550:37: note: candidate function not viable: requires 3 arguments, but 2 were provided
V8_WARN_UNUSED_RESULT Maybe Set(Local context, uint32_t index,
^
In file included from ../src/libxmljs.cc:7:
In file included from ../src/libxmljs.h:7:
../../nan/nan.h:1836:32: error: no matching member function for call to 'Get'
New(persistentHandle)->Get(New(key).ToLocalChecked()));
~~~~~~~~~~~~~~~~~~~~~~~^~~
/Users/shivani.rana/Library/Caches/node-gyp/13.6.0/include/node/v8.h:3594:43: note: candidate function not viable: requires 2 arguments, but 1 was provided
V8_WARN_UNUSED_RESULT MaybeLocal Get(Local context,
^
/Users/shivani.rana/Library/Caches/node-gyp/13.6.0/include/node/v8.h:3597:43: note: candidate function not viable: requires 2 arguments, but 1 was provided
V8_WARN_UNUSED_RESULT MaybeLocal Get(Local context,
^
In file included from ../src/libxmljs.cc:7:
In file included from ../src/libxmljs.h:7:
../../nan/nan.h:1842:48: error: no matching member function for call to 'Get'
return scope.Escape(New(persistentHandle)->Get(key));
~~~~~~~~~~~~~~~~~~~~~~~^~~
/Users/shivani.rana/Library/Caches/node-gyp/13.6.0/include/node/v8.h:3594:43: note: candidate function not viable: requires 2 arguments, but 1 was provided
V8_WARN_UNUSED_RESULT MaybeLocal Get(Local context,
^
/Users/shivani.rana/Library/Caches/node-gyp/13.6.0/include/node/v8.h:3597:43: note: candidate function not viable: requires 2 arguments, but 1 was provided
V8_WARN_UNUSED_RESULT MaybeLocal Get(Local context,
^
In file included from ../src/libxmljs.cc:7:
In file included from ../src/libxmljs.h:7:
../../nan/nan.h:1847:48: error: no matching member function for call to 'Get'
return scope.Escape(New(persistentHandle)->Get(index));
~~~~~~~~~~~~~~~~~~~~~~~^~~
/Users/shivani.rana/Library/Caches/node-gyp/13.6.0/include/node/v8.h:3594:43: note: candidate function not viable: requires 2 arguments, but 1 was provided
V8_WARN_UNUSED_RESULT MaybeLocal Get(Local context,
^
/Users/shivani.rana/Library/Caches/node-gyp/13.6.0/include/node/v8.h:3597:43: note: candidate function not viable: requires 2 arguments, but 1 was provided
V8_WARN_UNUSED_RESULT MaybeLocal Get(Local context,
^
In file included from ../src/libxmljs.cc:7:
In file included from ../src/libxmljs.h:7:
In file included from ../../nan/nan.h:2657:
../../nan/nan_object_wrap.h:24:25: error: no member named 'IsNearDeath' in 'Nan::Persistent<v8::Object, v8::NonCopyablePersistentTraitsv8::Object >'
assert(persistent().IsNearDeath());
~~~~~~~~~~~~ ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/assert.h:93:25: note: expanded from macro
'assert'
(__builtin_expect(!(e), 0) ? _assert_rtn(func, FILE, LINE, #e) : (void)0)
^
In file included from ../src/libxmljs.cc:7:
In file included from ../src/libxmljs.h:7:
In file included from ../../nan/nan.h:2657:
../../nan/nan_object_wrap.h:67:18: error: no member named 'MarkIndependent' in 'Nan::Persistent<v8::Object, v8::NonCopyablePersistentTraitsv8::Object >'
persistent().MarkIndependent();
~~~~~~~~~~~~ ^
../../nan/nan_object_wrap.h:124:26: error: no member named 'IsNearDeath' in 'Nan::Persistent<v8::Object, v8::NonCopyablePersistentTraitsv8::Object >'
assert(wrap->handle.IsNearDeath());
~~~~~~~~~~~~~ ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/assert.h:93:25: note: expanded from macro
'assert'
(__builtin_expect(!(e), 0) ? __assert_rtn(func, FILE, LINE, #e) : (void)0)
^
In file included from ../src/libxmljs.cc:8:
../src/xml_document.h:23:32: error: no template named 'Handle' in namespace 'v8'
static void Initialize(v8::Handlev8::Object target);
~~~~^
In file included from ../src/libxmljs.cc:9:
../src/xml_node.h:32:32: error: no template named 'Handle' in namespace 'v8'
static void Initialize(v8::Handlev8::Object target);
~~~~^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make[1]: *** [Release/obj.target/xmljs/src/libxmljs.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: make
failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack at ChildProcess.emit (events.js:321:20)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
gyp ERR! System Darwin 18.7.0
gyp ERR! command "/usr/local/Cellar/node/13.6.0/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--loglevel=http" "--module=/Users/shivani.rana/cw/App/local_plugins/com-accenture-cas-plugins-dba/node_modules/libxmljs/build/Release/xmljs.node" "--module_name=xmljs" "--module_path=/Users/shivani.rana/cw/App/local_plugins/com-accenture-cas-plugins-dba/node_modules/libxmljs/build/Release" "--napi_version=5" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v79"
gyp ERR! cwd /Users/shivani.rana/cw/App/local_plugins/com-accenture-cas-plugins-dba/node_modules/libxmljs
gyp ERR! node -v v13.6.0
gyp ERR! node-gyp -v v5.0.5
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute '/usr/local/Cellar/node/13.6.0/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --loglevel=http --module=/Users/shivani.rana/cw/App/local_plugins/com-accenture-cas-plugins-dba/node_modules/libxmljs/build/Release/xmljs.node --module_name=xmljs --module_path=/Users/shivani.rana/cw/App/local_plugins/com-accenture-cas-plugins-dba/node_modules/libxmljs/build/Release --napi_version=5 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v79' (1)
node-pre-gyp ERR! stack at ChildProcess. (/Users/shivani.rana/cw/App/local_plugins/com-accenture-cas-plugins-dba/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack at ChildProcess.emit (events.js:321:20)
node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:1028:16)
node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)
node-pre-gyp ERR! System Darwin 18.7.0
node-pre-gyp ERR! command "/usr/local/Cellar/node/13.6.0/bin/node" "/Users/shivani.rana/cw/App/local_plugins/com-accenture-cas-plugins-dba/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build" "--loglevel" "http"
node-pre-gyp ERR! cwd /Users/shivani.rana/cw/App/local_plugins/com-accenture-cas-plugins-dba/node_modules/libxmljs
node-pre-gyp ERR! node -v v13.6.0
node-pre-gyp ERR! node-pre-gyp -v v0.11.0
node-pre-gyp ERR! not ok
Failed to execute '/usr/local/Cellar/node/13.6.0/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --loglevel=http --module=/Users/shivani.rana/cw/App/local_plugins/com-accenture-cas-plugins-dba/node_modules/libxmljs/build/Release/xmljs.node --module_name=xmljs --module_path=/Users/shivani.rana/cw/App/local_plugins/com-accenture-cas-plugins-dba/node_modules/libxmljs/build/Release --napi_version=5 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v79' (1)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: node-pre-gyp install --fallback-to-build --loglevel http
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/shivani.rana/.npm/_logs/2020-01-18T20_51_54_406Z-debug.log
make: *** [packageInstall] Error 1
In libxmljs/libxmljs#330 libxmljs migrated to Nan 2, and in gagern/libxmljs@f6c2c2f libxmljs-mt followed suite. This is causing some build problems, as quite a number of Nan names have changed. I wonder whether it is safe to use Nan 1 and 2 in the same library, but probably wouldn't risk it. Instead I suggest node-libxslt be moved to Nan 2 as well. There is some 1to2.js
script hidden in the Nan directory tree, but so far I had found that thing caused more problems than it addressed.
"npm install libxslt" gives an error, when node-gyp hasn't been installed beforehand for this project.
strange is, that node-gyp seems to be there and to do a lot of stuff, but installing it explicitly into the project still fixes the issue.
add node-gyp as dependencies to package.json, maybe?
npm install node-gyp && npm install libxslt
output from "npm install libxslt" in an empty directory:
error.txt
output.txt
npm --version
3.5.2
node --version
v4.2.6
lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 16.04.1 LTS
Release: 16.04
Codename: xenial
Hello Alban!
Yesterday I was stuck with my app crashing for apparently no reason. I'm writting an API with ExpressJS.
It suddenly crashes (no err message, no stacktrace) when calling libxslt.parse
or libxslt.parseFile
After hours of digging in I found that removing var libxmls = require('libxmljs')
solved the issue completely!
(The reason I required libxmljs is that a need to parse XML somewhere else in my code. According to this example I supposed that would be possible.)
Is there some conflict by using libxmljs along with libxslt that I should be aware of?
PS: Great work BTW!
Thanks in advance, have a great day!
Hi,
I'm trying to build recent versions of node-libxslt on Windows: I tried different configurations:
I get node_libxslt.obj : error LNK2001: unresolved external symbol
errors
Any hint would be appreciated! 😄 Cheers!
$ npm install libxslt
|
> [email protected] install c:\Users\benoror\my-node-project\node_modules\libxslt\node_modules\libxmljs-mt
> node-gyp rebuild
c:\Users\benoror\my-node-project\node_modules\libxslt\node_modules\libxmljs-mt>node "C:\Users\benoror\AppData\Roaming\nvm\v0.10.36\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
buf.c
catalog.c
chvalid.c
dict.c
encoding.c
entities.c
error.c
globals.c
..\..\vendor\libxml\catalog.c(979): warning C4013: 'open' undefined; assuming extern returning int [c:\Users\benoror\my-node-project\node_modules\libxslt\node_modules\libxmljs-mt\build\vendor\libxml.vcxproj]
..\..\vendor\libxml\catalog.c(998): warning C4013: 'close' undefined; assuming extern returning int [c:\Users\benoror\my-node-project\node_modules\libxslt\node_modules\libxmljs-mt\build\vendor\libxml.vcxproj]
..\..\vendor\libxml\catalog.c(1005): warning C4013: 'read' undefined; assuming extern returning int [c:\Users\benoror\my-node-project\node_modules\libxslt\node_modules\libxmljs-mt\build\vendor\libxml.vcxproj]
..\..\vendor\libxml\dict.c(188): warning C4244: 'function' : conversion from 'time_t' to 'unsigned int', possible loss of data [c:\U sers\benoror\my-node-project\node_modules\libxslt\node_modules\libxmljs-mt\build\vendor\libxml.vcxproj]
..\..\vendor\libxml\dict.c(252): warning C4018: '>' : signed/unsigned mismatch [c:\Users\benoror\my-node-project \node_modules\libxslt\node_modules\libxmljs-mt\build\vendor\libxml.vcxproj]
..\..\vendor\libxml\dict.c(320): warning C4018: '>' : signed/unsigned mismatch [c:\Users\benoror\my-node-project \node_modules\libxslt\node_modules\libxmljs-mt\build\vendor\libxml.vcxproj]
hash.c
HTMLparser.c
HTMLtree.c
legacy.c
list.c
parser.c
parserInternals.c
pattern.c
relaxng.c
SAX2.c
SAX.c
tree.c
threads.c
uri.c
valid.c
xinclude.c
xlink.c
xmlIO.c
xmlmemory.c
xmlmodule.c
xmlreader.c
xmlregexp.c
xmlsave.c
xmlschemas.c
xmlschemastypes.c
xmlstring.c
xmlunicode.c
xmlwriter.c
xpath.c
xpointer.c
c:\users\benoror\my-node-project\node_modules\libxslt\node_modules\libxmljs-mt\vendor\libxml\timsort.h(82): warn ing C4244: 'initializing' : conversion from 'uint64_t' to 'const int', possible loss of data [c:\Users\benoror\my-node-project\node_modules\libxslt\node_modules\libxmljs-mt\build\vendor\libxml.vcxproj]
c:\users\benoror\my-node-project\node_modules\libxslt\node_modules\libxmljs-mt\vendor\libxml\timsort.h(193): war ning C4244: 'function' : conversion from 'int64_t' to 'const size_t', possible loss of data [c:\Users\benoror\my-node-project\node_modules\libxslt\node_modules\libxmljs-mt\build\vendor\libxml.vcxproj]
c:\users\benoror\my-node-project\node_modules\libxslt\node_modules\libxmljs-mt\vendor\libxml\timsort.h(342): war ning C4244: 'function' : conversion from 'const int64_t' to 'const size_t', possible loss of data [c:\Users\benoror\my-node-project\node_modules\libxslt\node_modules\libxmljs-mt\build\vendor\libxml.vcxproj]
c:\users\benoror\my-node-project\node_modules\libxslt\node_modules\libxmljs-mt\vendor\libxml\timsort.h(348): war ning C4244: 'function' : conversion from 'const int64_t' to 'size_t', possible loss of data [c:\Users\benoror\my-node-project\node_modules\libxslt\node_modules\libxmljs-mt\build\vendor\libxml.vcxproj]
c:\users\benoror\my-node-project\node_modules\libxslt\node_modules\libxmljs-mt\vendor\libxml\timsort.h(372): war ning C4244: 'function' : conversion from 'const int64_t' to 'size_t', possible loss of data [c:\Users\benoror\my-node-project\node_modules\libxslt\node_modules\libxmljs-mt\build\vendor\libxml.vcxproj]
c:\users\benoror\my-node-project\node_modules\libxslt\node_modules\libxmljs-mt\vendor\libxml\timsort.h(477): war ning C4244: 'function' : conversion from 'int64_t' to 'const size_t', possible loss of data [c:\Users\benoror\my-node-project\node_modules\libxslt\node_modules\libxmljs-mt\build\vendor\libxml.vcxproj]
c:\users\benoror\my-node-project\node_modules\libxslt\node_modules\libxmljs-mt\vendor\libxml\timsort.h(477): war ning C4244: 'function' : conversion from 'int64_t' to 'const size_t', possible loss of data [c:\Users\benoror\my-node-project\node_modules\libxslt\node_modules\libxmljs-mt\build\vendor\libxml.vcxproj]
c:\users\benoror\my-node-project\node_modules\libxslt\node_modules\libxmljs-mt\vendor\libxml\timsort.h(478): war ning C4244: 'function' : conversion from 'int64_t' to 'const size_t', possible loss of data [c:\Users\benoror\my-node-project\node_modules\libxslt\node_modules\libxmljs-mt\build\vendor\libxml.vcxproj]
c:\users\benoror\my-node-project\node_modules\libxslt\node_modules\libxmljs-mt\vendor\libxml\timsort.h(478): war ning C4244: 'function' : conversion from 'int64_t' to 'const size_t', possible loss of data [c:\Users\benoror\my-node-project\node_modules\libxslt\node_modules\libxmljs-mt\build\vendor\libxml.vcxproj]
c:\users\benoror\my-node-project\node_modules\libxslt\node_modules\libxmljs-mt\vendor\libxml\timsort.h(479): war ning C4244: 'function' : conversion from 'int64_t' to 'const size_t', possible loss of data [c:\Users\benoror\my-node-project\node_modules\libxslt\node_modules\libxmljs-mt\build\vendor\libxml.vcxproj]
c:\users\benoror\my-node-project\node_modules\libxslt\node_modules\libxmljs-mt\vendor\libxml\timsort.h(479): war ning C4244: 'function' : conversion from 'int64_t' to 'const size_t', possible loss of data [c:\Users\benoror\my-node-project\node_modules\libxslt\node_modules\libxmljs-mt\build\vendor\libxml.vcxproj]
c:\users\benoror\my-node-project\node_modules\libxslt\node_modules\libxmljs-mt\vendor\libxml\timsort.h(488): war ning C4244: 'function' : conversion from 'int64_t' to 'const size_t', possible loss of data [c:\Users\benoror\my-node-project\node_modules\libxslt\node_modules\libxmljs-mt\build\vendor\libxml.vcxproj]
c:\users\benoror\my-node-project\node_modules\libxslt\node_modules\libxmljs-mt\vendor\libxml\timsort.h(488): war ning C4244: 'function' : conversion from 'int64_t' to 'const size_t', possible loss of data [c:\Users\benoror\my-node-project\node_modules\libxslt\node_modules\libxmljs-mt\build\vendor\libxml.vcxproj]
..\..\vendor\libxml\xmlIO.c(668): warning C4133: 'function' : incompatible types - from 'stat *' to '_stat64i32 *' [c:\Users\benoror \my-node-project\node_modules\libxslt\node_modules\libxmljs-mt\build\vendor\libxml.vcxproj]
..\..\vendor\libxml\xmlIO.c(829): warning C4013: 'read' undefined; assuming extern returning int [c:\Users\benoror\my-node-project\node_modules\libxslt\node_modules\libxmljs-mt\build\vendor\libxml.vcxproj]
..\..\vendor\libxml\xmlIO.c(850): warning C4013: 'write' undefined; assuming extern returning int [c:\Users\benoror\my-node-project\node_modules\libxslt\node_modules\libxmljs-mt\build\vendor\libxml.vcxproj]
..\..\vendor\libxml\xmlIO.c(868): warning C4013: 'close' undefined; assuming extern returning int [c:\Users\benoror\my-node-project\node_modules\libxslt\node_modules\libxmljs-mt\build\vendor\libxml.vcxproj]
..\..\vendor\libxml\xmlIO.c(3844): warning C4013: 'getcwd' undefined; assuming extern returning int [c:\Users\benoror\my-node-project\node_modules\libxslt\node_modules\libxmljs-mt\build\vendor\libxml.vcxproj]
..\..\vendor\libxml\xmlIO.c(3844): warning C4047: '!=' : 'int' differs in levels of indirection from 'void *' [c:\Users\benoror\my-node-project\node_modules\libxslt\node_modules\libxmljs-mt\build\vendor\libxml.vcxproj]
libxml.vcxproj -> c:\Users\benoror\my-node-project\node_modules\libxslt\node_modules\libxmljs-mt\build\Release
\\libxml.lib
libxmljs.cc
xml_attribute.cc
xml_document.cc
xml_element.cc
xml_comment.cc
xml_namespace.cc
xml_node.cc
xml_sax_parser.cc
c:\users\benoror\my-node-project\node_modules\libxslt\node_modules\libxmljs-mt\node_modules\nan\nan_new.h(208):
warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning) [c:\Users\benoror\my-node-project\node_modules\libxslt\node_modules\libxmljs-mt\build\xmljs.vcxproj]
..\src\libxmljs.cc(159) : see reference to function template instantiation 'v8::Local<T> NanNew<v8::Boolean,int>(A0)' bein
g compiled
with
[
T=v8::Boolean,
A0=int
]
xml_syntax_error.cc
xml_xpath_context.cc
c:\users\benoror\my-node-project\node_modules\libxslt\node_modules\libxmljs-mt\node_modules\nan\nan_new.h(208):
warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning) [c:\Users\benoror\my-node-project\node_modules\libxslt\node_modules\libxmljs-mt\build\xmljs.vcxproj]
..\src\xml_xpath_context.cc(50) : see reference to function template instantiation 'v8::Local<T> NanNew<v8::Boolean,int>(A
0)' being compiled
with
[
T=v8::Boolean,
A0=int
]
c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\vector(753): warning C4530: C++ exception handler used, but unwind se mantics are not enabled. Specify /EHsc [c:\Users\benoror\my-node-project\node_modules\libxslt\node_modules\libxm ljs-mt\build\xmljs.vcxproj]
c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\vector(746) : while compiling class template member functio
n 'void std::vector<_Ty>::reserve(unsigned int)'
with
[
_Ty=uint16_t
]
c:\users\benoror\my-node-project\node_modules\libxslt\node_modules\libxmljs-mt\node_modules\nan\nan_im
plementation_pre_12_inl.h(215) : see reference to class template instantiation 'std::vector<_Ty>' being compiled
with
[
_Ty=uint16_t
]
Creating library c:\Users\benoror\my-node-project\node_modules\libxslt\node_modules\libxmljs-mt\build\Relea
se\xmljs.lib and object c:\Users\benoror\my-node-project\node_modules\libxslt\node_modules\libxmljs-mt\build\R
elease\xmljs.exp
Generating code
Finished generating code
xmljs.vcxproj -> c:\Users\benoror\my-node-project\node_modules\libxslt\node_modules\libxmljs-mt\build\Release\
\xmljs.node
> [email protected] install c:\Users\benoror\my-node-project\node_modules\libxslt
> node-gyp rebuild
c:\Users\benoror\my-node-project\node_modules\libxslt>node "C:\Users\benoror\AppData\Roaming\nvm\v0.10.36\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
common.c
crypto.c
date.c
dynamic.c
exslt.c
functions.c
math.c
saxon.c
c:\Users\benoror\my-node-project\node_modules\libxslt\deps\libxslt.config\win\ia32\config.h(95): warning C4005:
'HAVE_STAT' : macro redefinition [c:\Users\benoror\my-node-project\node_modules\libxslt\build\deps\libexslt.vcxp roj]
c:\Users\benoror\my-node-project\node_modules\libxslt\node_modules\libxmljs-mt\vendor\libxml\include\w
in32config.h(18) : see previous definition of 'HAVE_STAT'
c:\Users\benoror\my-node-project\node_modules\libxslt\deps\libxslt.config\win\ia32\config.h(98): warning C4005:
'HAVE_STDARG_H' : macro redefinition [c:\Users\benoror\my-node-project\node_modules\libxslt\build\deps\libexslt. vcxproj]
c:\Users\benoror\my-node-project\node_modules\libxslt\node_modules\libxmljs-mt\vendor\libxml\include\w
in32config.h(5) : see previous definition of 'HAVE_STDARG_H'
c:\Users\benoror\my-node-project\node_modules\libxslt\deps\libxslt.config\win\ia32\config.h(104): warning C4005: 'HAVE_STDLIB_H' : macro redefinition [c:\Users\benoror\my-node-project\node_modules\libxslt\build\deps\libexslt .vcxproj]
c:\Users\benoror\my-node-project\node_modules\libxslt\node_modules\libxmljs-mt\vendor\libxml\include\w
in32config.h(19) : see previous definition of 'HAVE_STDLIB_H'
c:\Users\benoror\my-node-project\node_modules\libxslt\deps\libxslt.config\win\ia32\config.h(116): warning C4005: 'HAVE_SYS_STAT_H' : macro redefinition [c:\Users\benoror\my-node-project\node_modules\libxslt\build\deps\libexs lt.vcxproj]
c:\Users\benoror\my-node-project\node_modules\libxslt\node_modules\libxmljs-mt\vendor\libxml\include\w
in32config.h(16) : see previous definition of 'HAVE_SYS_STAT_H'
c:\Users\benoror\my-node-project\node_modules\libxslt\deps\libxslt.config\win\ia32\config.h(131): warning C4005: 'HAVE_TIME_H' : macro redefinition [c:\Users\benoror\my-node-project\node_modules\libxslt\build\deps\libexslt.v cxproj]
c:\Users\benoror\my-node-project\node_modules\libxslt\node_modules\libxmljs-mt\vendor\libxml\include\w
in32config.h(20) : see previous definition of 'HAVE_TIME_H'
sets.c
strings.c
libexslt.vcxproj -> c:\Users\benoror\my-node-project\node_modules\libxslt\build\Release\\libexslt.lib
attributes.c
attrvt.c
documents.c
extensions.c
extra.c
functions.c
imports.c
keys.c
..\..\deps\libxslt\libxslt\extensions.c(377): warning C4013: 'LIBXSLT_DEFAULT_PLUGINS_PATH' undefined; assuming extern returning int [c:\Users\benoror\my-node-project\node_modules\libxslt\build\deps\libxslt.vcxproj]
namespaces.c
numbers.c
pattern.c
preproc.c
security.c
templates.c
transform.c
variables.c
xslt.c
xsltlocale.c
xsltutils.c
libxslt.vcxproj -> c:\Users\benoror\my-node-project\node_modules\libxslt\build\Release\\libxslt.lib
node_libxslt.cc
stylesheet.cc
..\src\node_libxslt.cc(1): warning C4005: 'BUILDING_NODE_EXTENSION' : macro redefinition [c:\Users\benoror\my-node-project\node_modules\libxslt\build\node-libxslt.vcxproj]
command-line arguments : see previous definition of 'BUILDING_NODE_EXTENSION'
c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xlocale(323): warning C4530: C++ exception handler used, but unwind s emantics are not enabled. Specify /EHsc [c:\Users\benoror\my-node-project\node_modules\libxslt\build\node-libxsl t.vcxproj]
C:\Users\benoror\.node-gyp\0.10.36\deps\v8\include\v8.h(179): warning C4506: no definition for inline function 'v8::Persistent<T> v8 ::Persistent<T>::New(v8::Handle<T>)' [c:\Users\benoror\my-node-project\node_modules\libxslt\build\node-libxslt.v cxproj]
with
[
T=v8::Object
]
..\src\node_libxslt.cc(95): warning C4018: '<' : signed/unsigned mismatch [c:\Users\benoror\my-node-project\node _modules\libxslt\build\node-libxslt.vcxproj]
C:\Users\benoror\.node-gyp\0.10.36\deps\v8\include\v8.h(179): warning C4506: no definition for inline function 'v8::Persistent<T> v8 ::Persistent<T>::New(v8::Handle<T>)' [c:\Users\benoror\my-node-project\node_modules\libxslt\build\node-libxslt.v cxproj]
with
[
T=v8::Object
]
Creating library c:\Users\benoror\my-node-project\node_modules\libxslt\build\Release\node-libxslt.lib and o
bject c:\Users\benoror\my-node-project\node_modules\libxslt\build\Release\node-libxslt.exp
node_libxslt.obj : error LNK2001: unresolved external symbol "public: virtual __thiscall libxmljs::WorkerParent::~WorkerParent(void) " (??1WorkerParent@libxmljs@@UAE@XZ) [c:\Users\benoror\my-node-project\node_modules\libxslt\build\node-libxslt.v cxproj]
node_libxslt.obj : error LNK2001: unresolved external symbol "public: __thiscall libxmljs::WorkerParent::WorkerParent(void)" (??0Wor kerParent@libxmljs@@QAE@XZ) [c:\Users\benoror\my-node-project\node_modules\libxslt\build\node-libxslt.vcxproj]
node_libxslt.obj : error LNK2001: unresolved external symbol "public: virtual __thiscall libxmljs::WorkerSentinel::~WorkerSentinel(v oid)" (??1WorkerSentinel@libxmljs@@UAE@XZ) [c:\Users\benoror\my-node-project\node_modules\libxslt\build\node-lib xslt.vcxproj]
node_libxslt.obj : error LNK2001: unresolved external symbol "public: __thiscall libxmljs::WorkerSentinel::WorkerSentinel(class libx mljs::WorkerParent &)" (??0WorkerSentinel@libxmljs@@QAE@AAVWorkerParent@1@@Z) [c:\Users\benoror\my-node-project\ node_modules\libxslt\build\node-libxslt.vcxproj]
libxslt.lib(extensions.obj) : error LNK2001: unresolved external symbol _xmlModuleClose [c:\Users\benoror\my-node-project\node_modules\libxslt\build\node-libxslt.vcxproj]
libxslt.lib(extensions.obj) : error LNK2001: unresolved external symbol _xmlModuleSymbol [c:\Users\benoror\my-node-project\node_modules\libxslt\build\node-libxslt.vcxproj]
libxslt.lib(extensions.obj) : error LNK2001: unresolved external symbol _xmlModuleOpen [c:\Users\benoror\my-node-project\node_modules\libxslt\build\node-libxslt.vcxproj]
libxslt.lib(extensions.obj) : error LNK2001: unresolved external symbol _LIBXSLT_DEFAULT_PLUGINS_PATH [c:\Users\benoror\my-node-project\node_modules\libxslt\build\node-libxslt.vcxproj]
c:\Users\benoror\my-node-project\node_modules\libxslt\build\Release\node-libxslt.node : fatal error LNK1120: 8 u nresolved externals [c:\Users\benoror\my-node-project\node_modules\libxslt\build\node-libxslt.vcxproj]
gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\MSBuild\12.0\bin\msbuild.exe` failed with exit code: 1
gyp ERR! stack at ChildProcess.onExit (C:\Users\benoror\AppData\Roaming\nvm\v0.10.36\node_modules\npm\node_modules\node-gyp\lib\build.js:267:23)
gyp ERR! stack at ChildProcess.emit (events.js:98:17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:820:12)
gyp ERR! System Windows_NT 6.2.9200
gyp ERR! command "node" "C:\\Users\\benoror\\AppData\\Roaming\\nvm\\v0.10.36\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd c:\Users\benoror\my-node-project\node_modules\libxslt
gyp ERR! node -v v0.10.36
gyp ERR! node-gyp -v v1.0.1
gyp ERR! not ok
npm ERR! [email protected] install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is most likely a problem with the libxslt package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-gyp rebuild
npm ERR! You can get their info via:
npm ERR! npm owner ls libxslt
npm ERR! There is likely additional logging output above.
npm ERR! System Windows_NT 6.2.9200
npm ERR! command "c:\\Program Files\\nodejs\\node.exe" "c:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "libxslt"
npm ERR! cwd c:\Users\benoror\my-node-project
npm ERR! node -v v0.10.36
npm ERR! npm -v 1.4.28
npm ERR! code ELIFECYCLE
npm ERR! not ok code 0
If my xslt/xml files are stored in a DB, is it possible to customize the include/import resolution of XSLT files so that I can pass the XSLT's requested includes from the database.
Pseudo example:
xslt.resolver = function(fileName) {
var buffer;
// read file content into buffer from DB
return buffer;
}
This is a spin-off from #30 (comment).
When passing a callback function to the parse
or apply
function, they perform their operation asynchroneously. However, when one of the arguments is a string which has to be parsed as an XML document, that parsing happens synchroneously using libxmljs.parseXml
. It might be more consistent to replace those synchroneous calls with libxml.Document.fromXmlAsync(buffer, callback)
which operates asynchroneously. Or with something similar which allows us to fix the encoding so it doesn't get auto-detected from the file header.
vsaprintf is missing on windows and it stops 0.7.0
from building
I'm trying to substitute node_xslt (which doesn't compile in node v0.12) with node-libxslt in this module: https://github.com/jaydata/jaydata/blob/development/JaySvcUtil/JaySvcUtil.js line: 278.
this is what I've done:
var libxslt = require('libxslt');
var paramObj = {
'SerivceUri': "'" + cnf.SerivceUri + "'",
'EntityBaseClass': "'" + cnf.EntityBaseClass + "'",
'ContextBaseClass': "'" + cnf.ContextBaseClass + "'",
'AutoCreateContext': "'" + cnf.AutoCreateContext + "'",
'ContextInstanceName': "'" + cnf.ContextInstanceName + "'",
'EntitySetBaseClass': "'" + cnf.EntitySetBaseClass + "'",
'CollectionBaseClass': + cnf.CollectionBaseClass + "'",
'DefaultNamespace': "'" + cnf.DefaultNamespace + "'",
'MaxDataserviceVersion': "'" + (versionInfo.maxVersion || '3.0') + "'",
'AllowedTypesList': "'" + cnf.typeFilter + "'",
'GenerateNavigationProperties': "'" + cnf.navigation + "'"
};
var stylesheetDoc = libxslt.libxmljs.parseXml(transformXslt);
var stylesheet = libxslt.parse(stylesheetDoc);
var result = stylesheet.apply(metadata,paramObj);
return result;
but it doesn't work ... what's missing?
Since 373dcc8 we duplicate the xml document which contains the stylesheet. For the most common use case, namely that where the xml document is used as a stylesheet and nothing else, this means avoidable overhead. It would be better to combine parsing the stylesheet document and constructing a stylesheet object into a single step, so that we don't have to wrap the xml document for use by node.
Coding this should be reasonably easy, once we have decided what API to expose for this.
The current API should probably remain in place. Should we re-use the same function, and perform some case distinction based on the type of the argument? Interpret it as a document to be parsed if it's a Buffer
, and as an already parsed XML document if it's any other object
? Should we do an instanceof Document
check, or some ducktyping heuristics, to verify it's an XML document?
How about string
as input? Should we convert that to a buffer, or interpret it as a file name? Both approaches seem reasonable, which means that both will likely confuse some users who expect the other.
As far as I can tell, this is because of some required changes to libxmljs-mt. I have a pull request open there to get it building again: gagern/libxmljs#10, but I haven't had any luck with using that to fix this project's build (I get some linker errors):
node_libxslt.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual __cdecl libxmljs::WorkerSentinel::~WorkerSentinel(void)" (__imp_??1WorkerSentinel@libxmljs@@UEAA@XZ) [C:\dev\murrayju\libxsltjs\build\node- libxslt.vcxproj]
node_libxslt.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __cdecl libxmljs::WorkerSentinel::WorkerSentinel(class libxmljs::WorkerParent &)" (__imp_??0WorkerSentinel@libxmljs@@QEAA@AEAVWorkerParent@1@@Z) [C :\dev\murrayju\libxsltjs\build\node-libxslt.vcxproj]
node_libxslt.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual __cdecl libxmljs::WorkerParent::~WorkerParent(void)" (__imp_??1WorkerParent@libxmljs@@UEAA@XZ) [C:\dev\murrayju\libxsltjs\build\node-libxsl t.vcxproj]
node_libxslt.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __cdecl libxmljs::WorkerParent::WorkerParent(void)" (__imp_??0WorkerParent@libxmljs@@QEAA@XZ) [C:\dev\murrayju\libxsltjs\build\node-libxslt.vcxproj ]
C:\dev\murrayju\libxsltjs\build\Release\node-libxslt.node : fatal error LNK1120: 4 unresolved externals [C:\dev\murrayju\libxsltjs\build\node-libxslt.vcxproj]
Regardless whether you have
<xsl:output method="text" />
and/or
<xsl:output omit-xml-declaration="yes" />
there is always an xml declarion in the result string, which is not desired in those cases.
As noted here: gagern/libxmljs#12
I too cant get past node 9 in :
%> npm install libxslt
> [email protected] install /Users/bosson/Documents/workspace/sites/illuminet-se/node_modules/libxmljs-mt
> node-gyp rebuild
CXX(target) Release/obj.target/xmljs/src/libxmljs.o
../src/libxmljs.cc:69:17: error: no member named 'IsDead' in 'v8::V8'
if (v8::V8::IsDead())
~~~~~~~~^
1 error generated.
make: *** [Release/obj.target/xmljs/src/libxmljs.o] Error 1
libxmljs-mt seems stale.
After just importing this library my app gets stuck, i'm using react with webpack.
Here is the warning/error:
WARNING in ./node_modules/bindings/bindings.js
76:22-40 Critical dependency: the request of a dependency is an expression
WARNING in ./node_modules/bindings/bindings.js
76:43-53 Critical dependency: the request of a dependency is an expression
node --version
v8.0.0
yarn --version
0.27.5
I'm on Windows 10 x64
This package depends on an old version of libxmljs that can't be built with iojs (and possibly node 0.12.x). There was a fix in libxmljs 0.14.1: see libxmljs/libxmljs#310
Hi,
I'm using a stylesheet which loads an external file like this:
<xsl:variable name="secondaryFileXml" select="document($languageXPath)"/>
where languageXPath contains a relative path and all works, everyone is happy.
The issue is I'm developing an API which transforms the XSL server-side, and I'd like that path to be an URL instead of a filesystem path (or at least a path relative to the stylesheet itself), but if I change $languageXPath with something else, let's say http://localhost:3000/public/[...]/it.xml I get:
I/O warning : failed to load external entity "http://localhost:3000/public/[...]/it.xml"
It goes without saying that opening that url in a browser works just fine, as well as letting a browser perform the transformation.
I took a look at the underlying libxmljs and it seems that the HTTP part is optional, so enabling it would probably work.
Is there anything we could do?
Thanks
Hi!
I have a project with a complex structure of xsl and xml data.
Production environment is not highload (less than 10 rps).
Segfault occurs for every 300-1000 request, but 100% when I try to run synthetic performance tests.
To reproduce this error, i've created a isolated example, in which the error occurs on different versions of Node (0.12, 4, 5), but more often on 4-5.
(libxslt is compiled from master to work with Node 4-5)
require('segfault-handler').registerHandler('crash.log');
var libxslt = require('libxslt');
var xml = '<?xml version="1.0" encoding="utf-8"?>\n<root></root>';
var xsl = '<?xml version="1.0" encoding="utf-8"?>\n' +
'<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">' +
'<xsl:template match="/"><xsl:apply-templates /></xsl:template>' +
'</xsl:stylesheet>'
;
libxslt.parse(xsl, function (err, xslObject) {
var transform = function () {
xslObject.apply(xml, function (err, result) {});
};
var counter = 10e3;
while (counter--) {
transform();
}
});
Error logs are different from run to run.
Log1:
*** Error in `node': double free or corruption (!prev): 0x000000000265e8f0 ***
======= Backtrace: =========
/lib64/libc.so.6(+0x7d1fd)[0x7f58ae9071fd]
/home/t/test/node_modules/libxslt/build/Release/node-libxslt.node(xsltApplyTemplates+0x697)[0x7f58ac08ec47]
/home/t/test/node_modules/libxslt/build/Release/node-libxslt.node(+0x11d26)[0x7f58ac089d26]
/home/t/test/node_modules/libxslt/build/Release/node-libxslt.node(+0x15662)[0x7f58ac08d662]
/home/t/test/node_modules/libxslt/build/Release/node-libxslt.node(xsltProcessOneNode+0x78)[0x7f58ac08dd38]
/home/t/test/node_modules/libxslt/build/Release/node-libxslt.node(+0x1973b)[0x7f58ac09173b]
/home/t/test/node_modules/libxslt/build/Release/node-libxslt.node(_ZN11ApplyWorker7ExecuteEv+0x43)[0x7f58ac088303]
node[0xfd11a1]
node[0xfdf449]
/lib64/libpthread.so.0(+0x7df5)[0x7f58aec52df5]
/lib64/libc.so.6(clone+0x6d)[0x7f58ae9801ad]
======= Memory map: ========
00400000-01706000 r-xp 00000000 fd:01 2341768 /home/t/.nvm/versions/node/v5.0.0/bin/node
01905000-0191f000 rw-p 01305000 fd:01 2341768 /home/t/.nvm/versions/node/v5.0.0/bin/node
0191f000-01930000 rw-p 00000000 00:00 0
01f38000-026d5000 rw-p 00000000 00:00 0 [heap]
408b5123000-408b5124000 r-xp 00000000 00:00 0
64dd4049000-64dd4200000 ---p 00000000 00:00 0
64dd4200000-64dd4205000 rw-p 00000000 00:00 0
64dd4205000-64dd4206000 ---p 00000000 00:00 0
64dd4206000-64dd4207000 rwxp 00000000 00:00 0
64dd4207000-64dd4300000 ---p 00000000 00:00 0
64dd4300000-64dd4305000 rw-p 00000000 00:00 0
64dd4305000-64dd4306000 ---p 00000000 00:00 0
64dd4306000-64dd4307000 rwxp 00000000 00:00 0
64dd4307000-64dd4400000 ---p 00000000 00:00 0
64dd4400000-64dd4405000 rw-p 00000000 00:00 0
64dd4405000-64dd4406000 ---p 00000000 00:00 0
64dd4406000-64dd4407000 rwxp 00000000 00:00 0
64dd4407000-64dd4500000 ---p 00000000 00:00 0
64dd4500000-64dd4505000 rw-p 00000000 00:00 0
64dd4505000-64dd4506000 ---p 00000000 00:00 0
64dd4506000-64dd45ff000 rwxp 00000000 00:00 0
64dd45ff000-64df4049000 ---p 00000000 00:00 0
6d3fa7f8000-6d3fa838000 rw-p 00000000 00:00 0
6d3fa838000-6d3fabf8000 ---p 00000000 00:00 0
e6758100000-e6758200000 rw-p 00000000 00:00 0
100aa2b00000-100aa2c00000 rw-p 00000000 00:00 0
17877e500000-17877e600000 rw-p 00000000 00:00 0
2120ee94b000-2120ee980000 ---p 00000000 00:00 0
2120ee980000-2120ee9a0000 rw-p 00000000 00:00 0
2120ee9a0000-2120ee9ab000 ---p 00000000 00:00 0
297ddc000000-297ddc400000 rw-p 00000000 00:00 0
297ddc400000-297ddd000000 ---p 00000000 00:00 0
297ddd000000-297ddd400000 rw-p 00000000 00:00 0
297ddd400000-297dde000000 ---p 00000000 00:00 0
2a01dd300000-2a01dd400000 rw-p 00000000 00:00 0
34dedd900000-34dedda00000 rw-p 00000000 00:00 0
34e81d87c000-34e81d89c000 rw-p 00000000 00:00 0
34e81d89c000-34e81da7c000 ---p 00000000 00:00 0
7f5888000000-7f5888023000 rw-p 00000000 00:00 0
7f5888023000-7f588c000000 ---p 00000000 00:00 0
7f5890000000-7f58902dc000 rw-p 00000000 00:00 0
7f58902dc000-7f5894000000 ---p 00000000 00:00 0
7f5894000000-7f5894023000 rw-p 00000000 00:00 0
7f5894023000-7f5898000000 ---p 00000000 00:00 0
7f5898000000-7f5898237000 rw-p 00000000 00:00 0
7f5898237000-7f589c000000 ---p 00000000 00:00 0
7f589c000000-7f589c26e000 rw-p 00000000 00:00 0
7f589c26e000-7f58a0000000 ---p 00000000 00:00 0
7f58a0000000-7f58a02db000 rw-p 00000000 00:00 0
7f58a02db000-7f58a4000000 ---p 00000000 00:00 0
7f58a5ffc000-7f58a5ffd000 ---p 00000000 00:00 0
7f58a5ffd000-7f58a67fd000 rw-p 00000000 00:00 0 [stack:30062]
7f58a67fd000-7f58a67fe000 ---p 00000000 00:00 0
7f58a67fe000-7f58a6ffe000 rw-p 00000000 00:00 0 [stack:30061]
7f58a6ffe000-7f58a6fff000 ---p 00000000 00:00 0
7f58a6fff000-7f58a77ff000 rw-p 00000000 00:00 0 [stack:30060]
7f58a77ff000-7f58a7800000 ---p 00000000 00:00 0
7f58a7800000-7f58a8000000 rw-p 00000000 00:00 0 [stack:30059]
7f58a8000000-7f58a8023000 rw-p 00000000 00:00 0
7f58a8023000-7f58ac000000 ---p 00000000 00:00 0
7f58ac078000-7f58ac0d3000 r-xp 00000000 fd:01 19352035 /home/t/test/node_modules/libxslt/build/Release/node-libxslt.node
7f58ac0d3000-7f58ac2d2000 ---p 0005b000 fd:01 19352035 /home/t/test/node_modules/libxslt/build/Release/node-libxslt.node
7f58ac2d2000-7f58ac2d3000 r--p 0005a000 fd:01 19352035 /home/t/test/node_modules/libxslt/build/Release/node-libxslt.node
7f58ac2d3000-7f58ac2d5000 rw-p 0005b000 fd:01 19352035 /home/t/test/node_modules/libxslt/build/Release/node-libxslt.node
7f58ac2d5000-7f58ac474000 r-xp 00000000 fd:01 35554380 /home/t/test/node_modules/libxslt/node_modules/libxmljs-mt/build/Release/xmljs.node
7f58ac474000-7f58ac674000 ---p 0019f000 fd:01 35554380 /home/t/test/node_modules/libxslt/node_modules/libxmljs-mt/build/Release/xmljs.node
7f58ac674000-7f58ac67c000 r--p 0019f000 fd:01 35554380 /home/t/test/node_modules/libxslt/node_modules/libxmljs-mt/build/Release/xmljs.node
7f58ac67c000-7f58ac680000 rw-p 001a7000 fd:01 35554380 /home/t/test/node_modules/libxslt/node_modules/libxmljs-mt/build/Release/xmljs.node
7f58ac680000-7f58ac682000 rw-p 00000000 00:00 0
7f58ac682000-7f58ac685000 r-xp 00000000 fd:01 2339304 /home/t/test/node_modules/segfault-handler/build/Release/segfault-handler.node
7f58ac685000-7f58ac884000 ---p 00003000 fd:01 2339304 /home/t/test/node_modules/segfault-handler/build/Release/segfault-handler.node
7f58ac884000-7f58ac885000 r--p 00002000 fd:01 2339304 /home/t/test/node_modules/segfault-handler/build/Release/segfault-handler.node
7f58ac885000-7f58ac886000 rw-p 00003000 fd:01 2339304 /home/t/test/node_modules/segfault-handler/build/Release/segfault-handler.node
7f58ac886000-7f58ac887000 ---p 00000000 00:00 0
7f58ac887000-7f58ad087000 rw-p 00000000 00:00 0 [stack:30058]
7f58ad087000-7f58ad088000 ---p 00000000 00:00 0
7f58ad088000-7f58ad888000 rw-p 00000000 00:00 0 [stack:30057]
7f58ad888000-7f58ad889000 ---p 00000000 00:00 0
7f58ad889000-7f58ae089000 rw-p 00000000 00:00 0 [stack:30056]
7f58ae089000-7f58ae08a000 ---p 00000000 00:00 0
7f58ae08a000-7f58ae88a000 rw-p 00000000 00:00 0 [stack:30055]
7f58ae88a000-7f58aea40000 r-xp 00000000 fd:01 33697001 /usr/lib64/libc-2.17.so
7f58aea40000-7f58aec40000 ---p 001b6000 fd:01 33697001 /usr/lib64/libc-2.17.so
7f58aec40000-7f58aec44000 r--p 001b6000 fd:01 33697001 /usr/lib64/libc-2.17.so
7f58aec44000-7f58aec46000 rw-p 001ba000 fd:01 33697001 /usr/lib64/libc-2.17.so
7f58aec46000-7f58aec4b000 rw-p 00000000 00:00 0
7f58aec4b000-7f58aec61000 r-xp 00000000 fd:01 34882049 /usr/lib64/libpthread-2.17.so
7f58aec61000-7f58aee61000 ---p 00016000 fd:01 34882049 /usr/lib64/libpthread-2.17.so
7f58aee61000-7f58aee62000 r--p 00016000 fd:01 34882049 /usr/lib64/libpthread-2.17.so
7f58aee62000-7f58aee63000 rw-p 00017000 fd:01 34882049 /usr/lib64/libpthread-2.17.so
7f58aee63000-7f58aee67000 rw-p 00000000 00:00 0
7f58aee67000-7f58aee7c000 r-xp 00000000 fd:01 36385014 /usr/lib64/libgcc_s-4.8.3-20140911.so.1
7f58aee7c000-7f58af07b000 ---p 00015000 fd:01 36385014 /usr/lib64/libgcc_s-4.8.3-20140911.so.1
7f58af07b000-7f58af07c000 r--p 00014000 fd:01 36385014 /usr/lib64/libgcc_s-4.8.3-20140911.so.1
7f58af07c000-7f58af07d000 rw-p 00015000 fd:01 36385014 /usr/lib64/libgcc_s-4.8.3-20140911.so.1
7f58af07d000-7f58af17e000 r-xp 00000000 fd:01 34813712 /usr/lib64/libm-2.17.so
7f58af17e000-7f58af37d000 ---p 00101000 fd:01 34813712 /usr/lib64/libm-2.17.so
7f58af37d000-7f58af37e000 r--p 00100000 fd:01 34813712 /PID 30054 received SIGSEGV for address: 0x100000074
/home/t/test/node_modules/segfault-handler/build/Release/segfault-handler.node(Aborted
Log2:
*** Error in `node': double free or corruption (!prev): 0x0000000002db8f30 ***
PID 30363 received SIGSEGV for address: 0x100000074
/home/t/test/node_modules/segfault-handler/build/Release/segfault-handler.node(+0x1aca)[0x7ff3e93f4aca]
/lib64/libpthread.so.0(+0xf130)[0x7ff3eb9cb130]
/home/t/test/node_modules/libxslt/build/Release/node-libxslt.node(+0x193f5)[0x7ff3e8e023f5]
/home/t/test/node_modules/libxslt/build/Release/node-libxslt.node(_ZN11ApplyWorker7ExecuteEv+0x43)[0x7ff3e8df9303]
node[0xfd11a1]
node[0xfdf449]
/lib64/libpthread.so.0(+0x7df5)[0x7ff3eb9c3df5]
/lib64/libc.so.6(clone+0x6d)[0x7ff3eb6f11ad]
PID 30363 received SIGSEGV for address: 0x100000074
/home/t/test/node_modules/segfault-handler/build/Release/segfault-handler.node(+0x1aca)[0x7ff3e93f4aca]
PID 30363 received SIGSEGV for address: 0x100000074
/home/t/test/node_modules/segfault-handler/build/Release/segfault-handler.node(+0x1aca)[0x7ff3e93f4aca]
/lib64/libpthread.so.0(+0xf130)[0x7ff3eb9cb130]
/home/t/test/node_modules/libxslt/build/Release/node-libxslt.node(+0x193f5)[0x7ff3e8e023f5]
/home/t/test/node_modules/libxslt/build/Release/node-libxslt.node(_ZN11ApplyWorker7ExecuteEv+0x43)[0x7ff3e8df9303]
node[0xfd11a1]
/lib64/libpthread.so.0(+0xf130)[0x7ff3eb9cb130]
/home/t/test/node_modules/libxslt/build/Release/node-libxslt.node(+0x193f5)[0x7ff3e8e023f5]
/home/t/test/node_modules/libxslt/build/Release/node-libxslt.node(_ZN11ApplyWorker7ExecuteEv+0x43)[0x7ff3e8df9303]
node[0xfd11a1]
node[0xfdf449]
node[0xfdf449]
/lib64/libpthread.so.0(+0x7df5)[0x7ff3eb9c3df5]
/lib64/libc.so.6(clone+0x6d)[0x7ff3eb6f11ad]
@gagern may be you can help with this strange error?:)
Hi,
So I have been using this for years. But after upgrading my node version from 8.16.1
-> 12.16.1
it gives me following error as soon as I run the project.
Unhandled asynchronous exception: TypeError: binding.registerEXSLT is not a function
at Object.<anonymous> (path/to/my/project/node_modules/libxslt/index.js:10:9)
I already read this thread here but this error is new I believe.
Node version : 12.16.1
OS Ubuntu 18 LTS
Package manager : yarn
Hi!
Memory leaks began to appear after this commit fcce129
Here are some examples of measurements:
(before) vs (after) in megabytes
counter = 1e2
43 vs 43
counter = 1e3
220 vs 420
counter = 3e3
240 vs 1261
Test code:
'use strict';
var libxslt = require('libxslt');
var xml = '<?xml version="1.0" encoding="utf-8"?>\n<root>';
for (let i = 0; i < 1e3; i++) {
xml += `<item>${i}</item>`;
}
xml += '</root>';
var xsl = '<?xml version="1.0" encoding="utf-8"?>\n' +
'<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">' +
'<xsl:output version="1.0" indent="no" omit-xml-declaration="yes" />' +
'<xsl:template match="/"><xsl:apply-templates select="root/item" /></xsl:template>' +
'</xsl:stylesheet>'
;
var xslObj = libxslt.parse(xsl);
var rss = process.memoryUsage().rss;
var counter = 1e2;
for (let i = 0; i < counter; i++) {
xslObj.apply(xml, function () {});
}
console.log(Math.round((process.memoryUsage().rss - rss) / Math.pow(2, 20)));
Unfortunately, segfault occurs without SaveToPersistent
worker arguments (details here #28).
But when arguments are saved, GC can't collect them, and memory usage is growing permanently with every call of transform.
See the title. If you try to install on MacOS in a path such as: /Users/xxx/Documents/Path With Spaces/node-project
. The build will fail.
I'm trying to process a template that has XSL includes in it. Those files weren't available so the parser was spitting out errors on the console, but the returned err object only had, "Failed to parse stylesheet" in it which wasn't very helpful. It was a good 30 minutes before I saw the messages in the console and they were MUCH more helpful. This was especially nasty because I had no reason to think my template was bad. It is working elsewhere and well-formed.
Are those messages to stdout from the library and not available for you to include in err? What about passing a 3rd object into the callback and have it carry the full output from stdout?
Below is the most relevant bit, but I've also attached the full NPM log.
108 verbose lifecycle [email protected]
install: CWD: C:\PRJ\AZPREP\GIT\WEB\BatchManWeb\node_modules\libxsltinstall: Args: [ '/d /s /c', 'node-gyp rebuild' ]
109 silly lifecycle [email protected]
110 silly lifecycle [email protected]install: Returned: code: 1 signal: nullinstall: Failed to exec install script
111 info lifecycle [email protected]
112 verbose unlock done using C:\Users\username\AppData\Roaming\npm-cache_locks\staging-99c8fbd337195d0a.lock for C:\PRJ\AZPREP\GIT\WEB\BatchManWeb\node_modules.staging
113 verbose stack Error: [email protected] install:node-gyp rebuild
113 verbose stack Exit status 1
113 verbose stack at EventEmitter. (C:\Users\username\AppData\Roaming\npm\node_modules\npm\lib\utils\lifecycle.js:283:16)
113 verbose stack at emitTwo (events.js:106:13)
113 verbose stack at EventEmitter.emit (events.js:191:7)
113 verbose stack at ChildProcess. (C:\Users\username\AppData\Roaming\npm\node_modules\npm\lib\utils\spawn.js:40:14)
113 verbose stack at emitTwo (events.js:106:13)
113 verbose stack at ChildProcess.emit (events.js:191:7)
113 verbose stack at maybeClose (internal/child_process.js:886:16)
113 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
114 verbose pkgid [email protected]
115 verbose cwd C:\PRJ\AZPREP\GIT\WEB\BatchManWeb
116 verbose Windows_NT 10.0.15063
117 verbose argv "C:\Program Files\nodejs\node.exe" "C:\Users\username\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js" "install" "[email protected]" "--save"
118 verbose node v6.10.3
119 verbose npm v5.0.1
120 error code ELIFECYCLE
121 error errno 1
122 error [email protected] install:node-gyp rebuild
122 error Exit status 1
123 error Failed at the [email protected] install script.
123 error This is probably not a problem with npm. There is likely additional logging output above.
124 verbose exit [ 1, true ]
A few days ago I discovered that many of my transformations using stylesheet.apply() were not completing in a reasonable period of time and it looks as if only a single process is being used. Is that expected behavior? Is there a way to get multi-threaded behavior? Any idea of what the practical limits are in terms of size/nodes (in case I'm somewhere near that)?
I've slimmed this issue down to this sample, its causing some weird core dumps when I do some xpath query to the document before delivering it to the xslt parser.
This is happening after some retries (150 on my machine), it looks like a leak.
can someone bring some light over it?
removing the xmldoc.get("/") line it runs ok forever.
"use strict";//with or without strict
var fs=require("fs");
var libxslt=require("libxslt");
var libxml=libxslt.libxmljs;
for(var cnt=0;cnt<10000;cnt++) {
let xmldoc=libxml.parseXml(fs.readFileSync("template/@muf.xslt").toString());
console.log(cnt);
xmldoc.get("/");//removing this query (find or get) it runs ok
let doc=libxslt.parse(xmldoc);
}
[email protected]
node v4.2.3
This is a spin-off from #30 (comment).
Several API functions in index.js
accept either an XML document or a string as an argument. A check using typeof source === 'string'
is usually used to make this distinction. It would be nice if these functions were to accept Buffer objects as well. Buffer.isBuffer(source)
could be used to distinguish that case.
The code in XmlDocument::FromXml
reads like it should support auto-detecing the encoding if a buffer gets passed in, so we wouldn't have to worry about this.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.