Initial commit

This commit is contained in:
pasketti
2026-04-05 16:14:49 -04:00
commit ebee3a5534
14059 changed files with 2588797 additions and 0 deletions

1
node_modules/libxmljs/lib/bindings.js generated vendored Normal file
View File

@@ -0,0 +1 @@
module.exports = require('bindings')('xmljs');

23
node_modules/libxmljs/lib/comment.js generated vendored Normal file
View File

@@ -0,0 +1,23 @@
var bindings = require('./bindings');
var Document = require('./document');
/// create a new comment on the given document
/// @param doc the Document to create the comment for
/// @param {String} [content] comment content
/// @constructor
var Comment = function(doc, content) {
if (!doc) {
throw new Error('document argument required');
} else if (! (doc instanceof bindings.Document)) {
throw new Error('document argument must be an ' +
'instance of Document');
}
return new bindings.Comment(doc, content);
};
Comment.prototype = bindings.Comment.prototype;
module.exports = Comment;

170
node_modules/libxmljs/lib/document.js generated vendored Normal file
View File

@@ -0,0 +1,170 @@
var bindings = require('./bindings');
var Element = require('./element');
function assertRoot(doc) {
if(!doc.root()) {
throw new Error('Document has no root element');
}
}
/// Create a new document
/// @param {string} version xml version, default 1.0
/// @param {string} encoding the encoding, default utf8
/// @constructor
function Document(version, encoding) {
version = version || '1.0';
var doc = new bindings.Document(version);
doc.encoding(encoding || 'utf8');
return doc;
}
Document.prototype = bindings.Document.prototype;
/// get or set the root element
/// if called without any arguments, this will return the document root
/// @param {Element} [elem] if specified, this will become the new document root
Document.prototype.root = function(elem) {
return this._root(elem);
};
/// add a child node to the document
/// this will set the document root
Document.prototype.node = function(name, content) {
return this.root(Element(this, name, content));
};
/// xpath search
/// @return array of matching elements
Document.prototype.find = function(xpath, ns_uri) {
assertRoot(this);
return this.root().find(xpath, ns_uri);
};
/// xpath search
/// @return first element matching
Document.prototype.get = function(xpath, ns_uri) {
assertRoot(this);
return this.root().get(xpath, ns_uri);
};
/// @return a given child
Document.prototype.child = function(id) {
if (id === undefined || typeof id !== 'number') {
throw new Error('id argument required for #child');
}
assertRoot(this);
return this.root().child(id);
};
/// @return an Array of child nodes of the document root
Document.prototype.childNodes = function() {
assertRoot(this);
return this.root().childNodes();
};
/// @return a string representation of the document
Document.prototype.toString = function(formatted) {
return this._toString(formatted !== undefined ? formatted : true);
};
/// @return the document version
Document.prototype.version = function() {
return this._version();
};
/// @return the document encoding
Document.prototype.encoding = function(encoding) {
return this._encoding(encoding);
};
/// @return whether the XmlDocument is valid
Document.prototype.validate = function(xsd) {
return this._validate(xsd);
};
/// @return whether the XmlDocument is valid using Relaxed NG
Document.prototype.rngValidate = function(rng) {
return this._rngValidate(rng);
};
Document.prototype.getDtd = function() {
return this._getDtd();
};
Document.prototype.setDtd = function(name, ext, sys) {
if (!name) {
throw new Error('Must pass in a DTD name');
} else if (typeof name !== 'string') {
throw new Error('Must pass in a valid DTD name');
}
var params = [name];
if (typeof ext !== 'undefined') {
params.push(ext);
}
if (ext && typeof sys !== 'undefined') {
params.push(sys);
}
return this._setDtd.apply(this, params);
};
/// @return array of namespaces in document
Document.prototype.namespaces = function() {
assertRoot(this);
return this.root().namespaces();
};
Document.prototype.type = function() {
return 'document';
};
module.exports = Document;
/// parse a string into a html document
/// @param string html string to parse
/// @param {encoding:string, baseUrl:string} opts html string to parse
/// @return a Document
module.exports.fromHtml = function(string, opts) {
opts = opts || {};
// if for some reason user did not specify an object for the options
if (typeof(opts) !== 'object') {
throw new Error('fromHtml options must be an object');
}
return bindings.fromHtml(string, opts);
};
/// parse a string into a html document fragment
/// @param string html string to parse
/// @param {encoding:string, baseUrl:string} opts html string to parse
/// @return a Document
module.exports.fromHtmlFragment = function(string, opts) {
opts = opts || {};
// if for some reason user did not specify an object for the options
if (typeof(opts) !== 'object') {
throw new Error('fromHtmlFragment options must be an object');
}
opts.doctype = false;
opts.implied = false;
return bindings.fromHtml(string, opts);
};
/// parse a string into a xml document
/// @param string xml string to parse
/// @return a Document
module.exports.fromXml = function(string, options) {
return bindings.fromXml(string, options || {});
};

82
node_modules/libxmljs/lib/element.js generated vendored Normal file
View File

@@ -0,0 +1,82 @@
var bindings = require('./bindings');
/// create a new element on the given document
/// @param doc the Document to create the element for
/// @param name the element name
/// @param {String} [contenn] element content
/// @constructor
function Element(doc, name, content) {
if (!doc) {
throw new Error('document argument required');
} else if (! (doc instanceof bindings.Document)) {
throw new Error('document argument must be an ' +
'instance of Document');
} else if (!name) {
throw new Error('name argument required');
}
return new bindings.Element(doc, name, content);
}
Element.prototype = bindings.Element.prototype;
Element.prototype.attr = function() {
if (arguments.length === 1) {
var arg = arguments[0];
if (typeof arg === 'object') {
// object setter
// iterate keys/value to set attributes
for (var k in arg) {
this._attr(k, arg[k]);
};
return this;
} else if (typeof arg === 'string') {
// getter
return this._attr(arg);
}
} else if (arguments.length === 2) {
// 2 arg setter
var name = arguments[0];
var value = arguments[1];
this._attr(name, value);
return this;
}
};
/// helper method to attach a new node to this element
/// @param name the element name
/// @param {String} [content] element content
Element.prototype.node = function(name, content) {
var elem = Element(this.doc(), name, content);
this.addChild(elem);
return elem;
};
/// helper method to attach a cdata to this element
/// @param name the element name
/// @param {String} [content] element content
Element.prototype.cdata = function(content) {
this.addCData(content);
return this;
};
Element.prototype.get = function() {
var res = this.find.apply(this, arguments);
if (res instanceof Array) {
return res[0];
} else {
return res;
}
};
Element.prototype.defineNamespace = function(prefix, href) {
// if no prefix specified
if (!href) {
href = prefix;
prefix = null;
}
return new bindings.Namespace(this, prefix, href);
};
module.exports = Element;

39
node_modules/libxmljs/lib/sax_parser.js generated vendored Normal file
View File

@@ -0,0 +1,39 @@
var events = require('events');
var bindings = require('./bindings');
var SaxParser = function(callbacks) {
var parser = new bindings.SaxParser();
// attach callbacks
for (var callback in callbacks) {
parser.on(callback, callbacks[callback]);
}
return parser;
};
// Overriding the prototype, like util.inherit, wipes out the native binding.
// Copy over the methods instead.
for (var k in events.EventEmitter.prototype)
bindings.SaxParser.prototype[k] = events.EventEmitter.prototype[k];
var SaxPushParser = function(callbacks) {
var parser = new bindings.SaxPushParser();
// attach callbacks
for (var callback in callbacks) {
parser.on(callback, callbacks[callback]);
}
return parser;
};
// Overriding the prototype, like util.inherit, wipes out the native binding.
// Copy over the methods instead.
for (var k in events.EventEmitter.prototype)
bindings.SaxPushParser.prototype[k] = events.EventEmitter.prototype[k];
module.exports.SaxParser = SaxParser;
module.exports.SaxPushParser = SaxPushParser;

28
node_modules/libxmljs/lib/text.js generated vendored Normal file
View File

@@ -0,0 +1,28 @@
var bindings = require("./bindings");
/// create a new element on the given document
/// @param doc the Document to create the element for
/// @param name the element name
/// @param {String} [contenn] element content
/// @constructor
function Text(doc, content) {
if (!doc) {
throw new Error('document argument required');
}
if (!(doc instanceof bindings.Document)) {
throw new Error('document argument must be an instance of Document');
}
if (!content) {
throw new Error('content argument required');
}
return new bindings.Text(doc, content);
}
Text.prototype = bindings.Text.prototype;
module.exports = Text;