UNPKG

libxmljs

Version:

libxml bindings for v8 javascript engine

79 lines 3.5 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.SaxPushParser = exports.SaxParser = exports.parseHtmlAsync = exports.parseHtml = exports.parseXmlAsync = exports.parseXml = exports.Namespace = exports.ProcessingInstruction = exports.Comment = exports.Text = exports.Element = exports.Document = void 0; var document_1 = require("./document"); var parse_1 = require("./parse"); Object.defineProperty(exports, "parseHtml", { enumerable: true, get: function () { return parse_1.parseHtml; } }); Object.defineProperty(exports, "parseHtmlAsync", { enumerable: true, get: function () { return parse_1.parseHtmlAsync; } }); Object.defineProperty(exports, "parseXml", { enumerable: true, get: function () { return parse_1.parseXml; } }); Object.defineProperty(exports, "parseXmlAsync", { enumerable: true, get: function () { return parse_1.parseXmlAsync; } }); var sax_1 = require("./sax"); Object.defineProperty(exports, "SaxParser", { enumerable: true, get: function () { return sax_1.SaxParser; } }); Object.defineProperty(exports, "SaxPushParser", { enumerable: true, get: function () { return sax_1.SaxPushParser; } }); function Document(_ref, encoding) { if (_ref === void 0) { _ref = null; } if (encoding === void 0) { encoding = "utf8"; } return document_1.XMLDocument.createDocument(_ref, encoding); } exports.Document = Document; Document.fromXml = function (buffer, options) { return document_1.XMLDocument.fromXml(buffer, options); }; Document.fromXmlAsync = function (buffer, options) { return document_1.XMLDocument.fromXmlAsync(buffer, options); }; Document.fromHtml = function (buffer, options) { return document_1.XMLDocument.fromHtml(buffer, options); }; Document.fromHtmlAsync = function (buffer, options) { return document_1.XMLDocument.fromHtmlAsync(buffer, options); }; Document.fromHtmlFragment = function (buffer, options) { return document_1.XMLDocument.fromHtmlFragment(buffer, options); }; function Element(_ref, name, content) { if (content === void 0) { content = ""; } return _ref.createElement(name, content); } exports.Element = Element; function Text(document, content) { if (!document) { throw new Error("document argument required"); } if (!(document instanceof document_1.XMLDocument)) { throw new Error("document argument must be an instance of Document"); } if (!content) { throw new Error("content argument required"); } return document.createText(content); } exports.Text = Text; function Comment(document, content) { if (!document) { throw new Error("document argument required"); } if (!(document instanceof document_1.XMLDocument)) { throw new Error("document argument must be an instance of Document"); } return document.createComment(content); } exports.Comment = Comment; function ProcessingInstruction(document, name, content) { if (!document) { throw new Error("document argument required"); } if (!(document instanceof document_1.XMLDocument)) { throw new Error("document argument must be an instance of Document"); } if (!name) { throw new Error("name argument required"); } return document.createProcessingInstruction(name, content); } exports.ProcessingInstruction = ProcessingInstruction; function Namespace(node, prefix, href) { return node.defineNamespace(prefix, href); } exports.Namespace = Namespace; //# sourceMappingURL=api.js.map