This file is indexed.

/usr/lib/nodejs/ltx/sax_node-xml.js is in node-ltx 0.2.0-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
var util = require('util');
var events = require('events');
var xml = require('node-xml');

/**
 * This cannot be used as long as node-xml starts parsing only after
 * setTimeout(f, 0);
 */
var SaxNodeXML = module.exports = function SaxNodeXML() {
    events.EventEmitter.call(this);
    var that = this;
    this.parser = new xml.SaxParser(function(handler) {
	handler.onStartElementNS(function(elem, attrs, prefix, uri, namespaces) {
	    var i, attrsHash = {};
	    if (prefix)
		elem = prefix + ":" + elem;
	    for(i = 0; i < attrs.length; i++) {
		var attr = attrs[i];
		attrsHash[attr[0]] = unescapeXml(attr[1]);
	    }
	    for(i = 0; i < namespaces.length; i++) {
		var namespace = namespaces[i];
		var k = !namespace[0] ? "xmlns" : "xmlns:" + namespace[0];
		attrsHash[k] = unescapeXml(namespace[1]);
	    }
	    that.emit('startElement', elem, attrsHash);
	});
	handler.onEndElementNS(function(elem, prefix, uri) {
	    if (prefix)
		elem = prefix + ":" + elem;
	    that.emit('endElement', elem);
	});
	handler.onCharacters(function(str) {
	    that.emit('text', str);
	});
	handler.onCdata(function(str) {
	    that.emit('text', str);
	});
	handler.onError(function(e) {
	    that.emit('error', e);
	});
	// TODO: other events, esp. entityDecl (billion laughs!)
    });
};
util.inherits(SaxNodeXML, events.EventEmitter);

SaxNodeXML.prototype.write = function(data) {
    this.parser.parseString(data);
};

SaxNodeXML.prototype.end = function(data) {
    if (data)
	this.write(data);
};

function unescapeXml(s) {
    return s.
        replace(/\&amp;/g, '&').
        replace(/\&lt;/g, '<').
        replace(/\&gt;/g, '>').
        replace(/\&quot;/g, '"').
        replace(/\&apos;/g, '\'');
}