Showing
58 changed files
with
3238 additions
and
4 deletions
... | @@ -984,6 +984,26 @@ | ... | @@ -984,6 +984,26 @@ |
984 | "bin": { | 984 | "bin": { |
985 | "xml-js": "bin/cli.js" | 985 | "xml-js": "bin/cli.js" |
986 | } | 986 | } |
987 | + }, | ||
988 | + "node_modules/xml2js": { | ||
989 | + "version": "0.4.23", | ||
990 | + "resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.4.23.tgz", | ||
991 | + "integrity": "sha512-ySPiMjM0+pLDftHgXY4By0uswI3SPKLDw/i3UXbnO8M/p28zqexCUoPmQFrYD+/1BzhGJSs2i1ERWKJAtiLrug==", | ||
992 | + "dependencies": { | ||
993 | + "sax": ">=0.6.0", | ||
994 | + "xmlbuilder": "~11.0.0" | ||
995 | + }, | ||
996 | + "engines": { | ||
997 | + "node": ">=4.0.0" | ||
998 | + } | ||
999 | + }, | ||
1000 | + "node_modules/xmlbuilder": { | ||
1001 | + "version": "11.0.1", | ||
1002 | + "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-11.0.1.tgz", | ||
1003 | + "integrity": "sha512-fDlsI/kFEx7gLvbecc0/ohLG50fugQp8ryHzMTuW9vSa1GJ0XYWKnhsUx7oie3G98+r56aTQIUB4kht42R3JvA==", | ||
1004 | + "engines": { | ||
1005 | + "node": ">=4.0" | ||
1006 | + } | ||
987 | } | 1007 | } |
988 | } | 1008 | } |
989 | } | 1009 | } | ... | ... |
node_modules/xml2js/LICENSE
0 → 100644
1 | +Copyright 2010, 2011, 2012, 2013. All rights reserved. | ||
2 | + | ||
3 | +Permission is hereby granted, free of charge, to any person obtaining a copy | ||
4 | +of this software and associated documentation files (the "Software"), to | ||
5 | +deal in the Software without restriction, including without limitation the | ||
6 | +rights to use, copy, modify, merge, publish, distribute, sublicense, and/or | ||
7 | +sell copies of the Software, and to permit persons to whom the Software is | ||
8 | +furnished to do so, subject to the following conditions: | ||
9 | + | ||
10 | +The above copyright notice and this permission notice shall be included in | ||
11 | +all copies or substantial portions of the Software. | ||
12 | + | ||
13 | +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
14 | +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
15 | +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
16 | +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
17 | +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
18 | +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS | ||
19 | +IN THE SOFTWARE. |
node_modules/xml2js/README.md
0 → 100644
This diff is collapsed. Click to expand it.
node_modules/xml2js/lib/bom.js
0 → 100644
node_modules/xml2js/lib/builder.js
0 → 100644
1 | +// Generated by CoffeeScript 1.12.7 | ||
2 | +(function() { | ||
3 | + "use strict"; | ||
4 | + var builder, defaults, escapeCDATA, requiresCDATA, wrapCDATA, | ||
5 | + hasProp = {}.hasOwnProperty; | ||
6 | + | ||
7 | + builder = require('xmlbuilder'); | ||
8 | + | ||
9 | + defaults = require('./defaults').defaults; | ||
10 | + | ||
11 | + requiresCDATA = function(entry) { | ||
12 | + return typeof entry === "string" && (entry.indexOf('&') >= 0 || entry.indexOf('>') >= 0 || entry.indexOf('<') >= 0); | ||
13 | + }; | ||
14 | + | ||
15 | + wrapCDATA = function(entry) { | ||
16 | + return "<![CDATA[" + (escapeCDATA(entry)) + "]]>"; | ||
17 | + }; | ||
18 | + | ||
19 | + escapeCDATA = function(entry) { | ||
20 | + return entry.replace(']]>', ']]]]><![CDATA[>'); | ||
21 | + }; | ||
22 | + | ||
23 | + exports.Builder = (function() { | ||
24 | + function Builder(opts) { | ||
25 | + var key, ref, value; | ||
26 | + this.options = {}; | ||
27 | + ref = defaults["0.2"]; | ||
28 | + for (key in ref) { | ||
29 | + if (!hasProp.call(ref, key)) continue; | ||
30 | + value = ref[key]; | ||
31 | + this.options[key] = value; | ||
32 | + } | ||
33 | + for (key in opts) { | ||
34 | + if (!hasProp.call(opts, key)) continue; | ||
35 | + value = opts[key]; | ||
36 | + this.options[key] = value; | ||
37 | + } | ||
38 | + } | ||
39 | + | ||
40 | + Builder.prototype.buildObject = function(rootObj) { | ||
41 | + var attrkey, charkey, render, rootElement, rootName; | ||
42 | + attrkey = this.options.attrkey; | ||
43 | + charkey = this.options.charkey; | ||
44 | + if ((Object.keys(rootObj).length === 1) && (this.options.rootName === defaults['0.2'].rootName)) { | ||
45 | + rootName = Object.keys(rootObj)[0]; | ||
46 | + rootObj = rootObj[rootName]; | ||
47 | + } else { | ||
48 | + rootName = this.options.rootName; | ||
49 | + } | ||
50 | + render = (function(_this) { | ||
51 | + return function(element, obj) { | ||
52 | + var attr, child, entry, index, key, value; | ||
53 | + if (typeof obj !== 'object') { | ||
54 | + if (_this.options.cdata && requiresCDATA(obj)) { | ||
55 | + element.raw(wrapCDATA(obj)); | ||
56 | + } else { | ||
57 | + element.txt(obj); | ||
58 | + } | ||
59 | + } else if (Array.isArray(obj)) { | ||
60 | + for (index in obj) { | ||
61 | + if (!hasProp.call(obj, index)) continue; | ||
62 | + child = obj[index]; | ||
63 | + for (key in child) { | ||
64 | + entry = child[key]; | ||
65 | + element = render(element.ele(key), entry).up(); | ||
66 | + } | ||
67 | + } | ||
68 | + } else { | ||
69 | + for (key in obj) { | ||
70 | + if (!hasProp.call(obj, key)) continue; | ||
71 | + child = obj[key]; | ||
72 | + if (key === attrkey) { | ||
73 | + if (typeof child === "object") { | ||
74 | + for (attr in child) { | ||
75 | + value = child[attr]; | ||
76 | + element = element.att(attr, value); | ||
77 | + } | ||
78 | + } | ||
79 | + } else if (key === charkey) { | ||
80 | + if (_this.options.cdata && requiresCDATA(child)) { | ||
81 | + element = element.raw(wrapCDATA(child)); | ||
82 | + } else { | ||
83 | + element = element.txt(child); | ||
84 | + } | ||
85 | + } else if (Array.isArray(child)) { | ||
86 | + for (index in child) { | ||
87 | + if (!hasProp.call(child, index)) continue; | ||
88 | + entry = child[index]; | ||
89 | + if (typeof entry === 'string') { | ||
90 | + if (_this.options.cdata && requiresCDATA(entry)) { | ||
91 | + element = element.ele(key).raw(wrapCDATA(entry)).up(); | ||
92 | + } else { | ||
93 | + element = element.ele(key, entry).up(); | ||
94 | + } | ||
95 | + } else { | ||
96 | + element = render(element.ele(key), entry).up(); | ||
97 | + } | ||
98 | + } | ||
99 | + } else if (typeof child === "object") { | ||
100 | + element = render(element.ele(key), child).up(); | ||
101 | + } else { | ||
102 | + if (typeof child === 'string' && _this.options.cdata && requiresCDATA(child)) { | ||
103 | + element = element.ele(key).raw(wrapCDATA(child)).up(); | ||
104 | + } else { | ||
105 | + if (child == null) { | ||
106 | + child = ''; | ||
107 | + } | ||
108 | + element = element.ele(key, child.toString()).up(); | ||
109 | + } | ||
110 | + } | ||
111 | + } | ||
112 | + } | ||
113 | + return element; | ||
114 | + }; | ||
115 | + })(this); | ||
116 | + rootElement = builder.create(rootName, this.options.xmldec, this.options.doctype, { | ||
117 | + headless: this.options.headless, | ||
118 | + allowSurrogateChars: this.options.allowSurrogateChars | ||
119 | + }); | ||
120 | + return render(rootElement, rootObj).end(this.options.renderOpts); | ||
121 | + }; | ||
122 | + | ||
123 | + return Builder; | ||
124 | + | ||
125 | + })(); | ||
126 | + | ||
127 | +}).call(this); |
node_modules/xml2js/lib/defaults.js
0 → 100644
1 | +// Generated by CoffeeScript 1.12.7 | ||
2 | +(function() { | ||
3 | + exports.defaults = { | ||
4 | + "0.1": { | ||
5 | + explicitCharkey: false, | ||
6 | + trim: true, | ||
7 | + normalize: true, | ||
8 | + normalizeTags: false, | ||
9 | + attrkey: "@", | ||
10 | + charkey: "#", | ||
11 | + explicitArray: false, | ||
12 | + ignoreAttrs: false, | ||
13 | + mergeAttrs: false, | ||
14 | + explicitRoot: false, | ||
15 | + validator: null, | ||
16 | + xmlns: false, | ||
17 | + explicitChildren: false, | ||
18 | + childkey: '@@', | ||
19 | + charsAsChildren: false, | ||
20 | + includeWhiteChars: false, | ||
21 | + async: false, | ||
22 | + strict: true, | ||
23 | + attrNameProcessors: null, | ||
24 | + attrValueProcessors: null, | ||
25 | + tagNameProcessors: null, | ||
26 | + valueProcessors: null, | ||
27 | + emptyTag: '' | ||
28 | + }, | ||
29 | + "0.2": { | ||
30 | + explicitCharkey: false, | ||
31 | + trim: false, | ||
32 | + normalize: false, | ||
33 | + normalizeTags: false, | ||
34 | + attrkey: "$", | ||
35 | + charkey: "_", | ||
36 | + explicitArray: true, | ||
37 | + ignoreAttrs: false, | ||
38 | + mergeAttrs: false, | ||
39 | + explicitRoot: true, | ||
40 | + validator: null, | ||
41 | + xmlns: false, | ||
42 | + explicitChildren: false, | ||
43 | + preserveChildrenOrder: false, | ||
44 | + childkey: '$$', | ||
45 | + charsAsChildren: false, | ||
46 | + includeWhiteChars: false, | ||
47 | + async: false, | ||
48 | + strict: true, | ||
49 | + attrNameProcessors: null, | ||
50 | + attrValueProcessors: null, | ||
51 | + tagNameProcessors: null, | ||
52 | + valueProcessors: null, | ||
53 | + rootName: 'root', | ||
54 | + xmldec: { | ||
55 | + 'version': '1.0', | ||
56 | + 'encoding': 'UTF-8', | ||
57 | + 'standalone': true | ||
58 | + }, | ||
59 | + doctype: null, | ||
60 | + renderOpts: { | ||
61 | + 'pretty': true, | ||
62 | + 'indent': ' ', | ||
63 | + 'newline': '\n' | ||
64 | + }, | ||
65 | + headless: false, | ||
66 | + chunkSize: 10000, | ||
67 | + emptyTag: '', | ||
68 | + cdata: false | ||
69 | + } | ||
70 | + }; | ||
71 | + | ||
72 | +}).call(this); |
node_modules/xml2js/lib/parser.js
0 → 100644
This diff is collapsed. Click to expand it.
node_modules/xml2js/lib/processors.js
0 → 100644
1 | +// Generated by CoffeeScript 1.12.7 | ||
2 | +(function() { | ||
3 | + "use strict"; | ||
4 | + var prefixMatch; | ||
5 | + | ||
6 | + prefixMatch = new RegExp(/(?!xmlns)^.*:/); | ||
7 | + | ||
8 | + exports.normalize = function(str) { | ||
9 | + return str.toLowerCase(); | ||
10 | + }; | ||
11 | + | ||
12 | + exports.firstCharLowerCase = function(str) { | ||
13 | + return str.charAt(0).toLowerCase() + str.slice(1); | ||
14 | + }; | ||
15 | + | ||
16 | + exports.stripPrefix = function(str) { | ||
17 | + return str.replace(prefixMatch, ''); | ||
18 | + }; | ||
19 | + | ||
20 | + exports.parseNumbers = function(str) { | ||
21 | + if (!isNaN(str)) { | ||
22 | + str = str % 1 === 0 ? parseInt(str, 10) : parseFloat(str); | ||
23 | + } | ||
24 | + return str; | ||
25 | + }; | ||
26 | + | ||
27 | + exports.parseBooleans = function(str) { | ||
28 | + if (/^(?:true|false)$/i.test(str)) { | ||
29 | + str = str.toLowerCase() === 'true'; | ||
30 | + } | ||
31 | + return str; | ||
32 | + }; | ||
33 | + | ||
34 | +}).call(this); |
node_modules/xml2js/lib/xml2js.js
0 → 100644
1 | +// Generated by CoffeeScript 1.12.7 | ||
2 | +(function() { | ||
3 | + "use strict"; | ||
4 | + var builder, defaults, parser, processors, | ||
5 | + extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, | ||
6 | + hasProp = {}.hasOwnProperty; | ||
7 | + | ||
8 | + defaults = require('./defaults'); | ||
9 | + | ||
10 | + builder = require('./builder'); | ||
11 | + | ||
12 | + parser = require('./parser'); | ||
13 | + | ||
14 | + processors = require('./processors'); | ||
15 | + | ||
16 | + exports.defaults = defaults.defaults; | ||
17 | + | ||
18 | + exports.processors = processors; | ||
19 | + | ||
20 | + exports.ValidationError = (function(superClass) { | ||
21 | + extend(ValidationError, superClass); | ||
22 | + | ||
23 | + function ValidationError(message) { | ||
24 | + this.message = message; | ||
25 | + } | ||
26 | + | ||
27 | + return ValidationError; | ||
28 | + | ||
29 | + })(Error); | ||
30 | + | ||
31 | + exports.Builder = builder.Builder; | ||
32 | + | ||
33 | + exports.Parser = parser.Parser; | ||
34 | + | ||
35 | + exports.parseString = parser.parseString; | ||
36 | + | ||
37 | + exports.parseStringPromise = parser.parseStringPromise; | ||
38 | + | ||
39 | +}).call(this); |
node_modules/xml2js/package.json
0 → 100644
1 | +{ | ||
2 | + "name": "xml2js", | ||
3 | + "description": "Simple XML to JavaScript object converter.", | ||
4 | + "keywords": [ | ||
5 | + "xml", | ||
6 | + "json" | ||
7 | + ], | ||
8 | + "homepage": "https://github.com/Leonidas-from-XIV/node-xml2js", | ||
9 | + "version": "0.4.23", | ||
10 | + "author": "Marek Kubica <marek@xivilization.net> (https://xivilization.net)", | ||
11 | + "contributors": [ | ||
12 | + "maqr <maqr.lollerskates@gmail.com> (https://github.com/maqr)", | ||
13 | + "Ben Weaver (http://benweaver.com/)", | ||
14 | + "Jae Kwon (https://github.com/jaekwon)", | ||
15 | + "Jim Robert", | ||
16 | + "Ștefan Rusu (http://www.saltwaterc.eu/)", | ||
17 | + "Carter Cole <carter.cole@cartercole.com> (http://cartercole.com/)", | ||
18 | + "Kurt Raschke <kurt@kurtraschke.com> (http://www.kurtraschke.com/)", | ||
19 | + "Contra <contra@australia.edu> (https://github.com/Contra)", | ||
20 | + "Marcelo Diniz <marudiniz@gmail.com> (https://github.com/mdiniz)", | ||
21 | + "Michael Hart (https://github.com/mhart)", | ||
22 | + "Zachary Scott <zachary@zacharyscott.net> (http://zacharyscott.net/)", | ||
23 | + "Raoul Millais (https://github.com/raoulmillais)", | ||
24 | + "Salsita Software (http://www.salsitasoft.com/)", | ||
25 | + "Mike Schilling <mike@emotive.com> (http://www.emotive.com/)", | ||
26 | + "Jackson Tian <shyvo1987@gmail.com> (http://weibo.com/shyvo)", | ||
27 | + "Mikhail Zyatin <mikhail.zyatin@gmail.com> (https://github.com/Sitin)", | ||
28 | + "Chris Tavares <ctavares@microsoft.com> (https://github.com/christav)", | ||
29 | + "Frank Xu <yyfrankyy@gmail.com> (http://f2e.us/)", | ||
30 | + "Guido D'Albore <guido@bitstorm.it> (http://www.bitstorm.it/)", | ||
31 | + "Jack Senechal (http://jacksenechal.com/)", | ||
32 | + "Matthias Hölzl <tc@xantira.com> (https://github.com/hoelzl)", | ||
33 | + "Camille Reynders <info@creynders.be> (http://www.creynders.be/)", | ||
34 | + "Taylor Gautier (https://github.com/tsgautier)", | ||
35 | + "Todd Bryan (https://github.com/toddrbryan)", | ||
36 | + "Leore Avidar <leore.avidar@gmail.com> (http://leoreavidar.com/)", | ||
37 | + "Dave Aitken <dave.aitken@gmail.com> (http://www.actionshrimp.com/)", | ||
38 | + "Shaney Orrowe <shaney.orrowe@practiceweb.co.uk>", | ||
39 | + "Candle <candle@candle.me.uk>", | ||
40 | + "Jess Telford <hi@jes.st> (http://jes.st)", | ||
41 | + "Tom Hughes <<tom@compton.nu> (http://compton.nu/)", | ||
42 | + "Piotr Rochala (http://rocha.la/)", | ||
43 | + "Michael Avila (https://github.com/michaelavila)", | ||
44 | + "Ryan Gahl (https://github.com/ryedin)", | ||
45 | + "Eric Laberge <e.laberge@gmail.com> (https://github.com/elaberge)", | ||
46 | + "Benjamin E. Coe <ben@npmjs.com> (https://twitter.com/benjamincoe)", | ||
47 | + "Stephen Cresswell (https://github.com/cressie176)", | ||
48 | + "Pascal Ehlert <pascal@hacksrus.net> (http://www.hacksrus.net/)", | ||
49 | + "Tom Spencer <fiznool@gmail.com> (http://fiznool.com/)", | ||
50 | + "Tristian Flanagan <tflanagan@datacollaborative.com> (https://github.com/tflanagan)", | ||
51 | + "Tim Johns <timjohns@yahoo.com> (https://github.com/TimJohns)", | ||
52 | + "Bogdan Chadkin <trysound@yandex.ru> (https://github.com/TrySound)", | ||
53 | + "David Wood <david.p.wood@gmail.com> (http://codesleuth.co.uk/)", | ||
54 | + "Nicolas Maquet (https://github.com/nmaquet)", | ||
55 | + "Lovell Fuller (http://lovell.info/)", | ||
56 | + "d3adc0d3 (https://github.com/d3adc0d3)" | ||
57 | + ], | ||
58 | + "main": "./lib/xml2js", | ||
59 | + "files": [ | ||
60 | + "lib" | ||
61 | + ], | ||
62 | + "directories": { | ||
63 | + "lib": "./lib" | ||
64 | + }, | ||
65 | + "scripts": { | ||
66 | + "build": "cake build", | ||
67 | + "test": "zap", | ||
68 | + "coverage": "nyc npm test && nyc report", | ||
69 | + "coveralls": "nyc npm test && nyc report --reporter=text-lcov | coveralls", | ||
70 | + "doc": "cake doc" | ||
71 | + }, | ||
72 | + "repository": { | ||
73 | + "type": "git", | ||
74 | + "url": "https://github.com/Leonidas-from-XIV/node-xml2js.git" | ||
75 | + }, | ||
76 | + "dependencies": { | ||
77 | + "sax": ">=0.6.0", | ||
78 | + "xmlbuilder": "~11.0.0" | ||
79 | + }, | ||
80 | + "devDependencies": { | ||
81 | + "coffee-script": ">=1.10.0", | ||
82 | + "coveralls": "^3.0.1", | ||
83 | + "diff": ">=1.0.8", | ||
84 | + "docco": ">=0.6.2", | ||
85 | + "nyc": ">=2.2.1", | ||
86 | + "zap": ">=0.2.9" | ||
87 | + }, | ||
88 | + "engines": { | ||
89 | + "node": ">=4.0.0" | ||
90 | + }, | ||
91 | + "license": "MIT" | ||
92 | +} |
node_modules/xmlbuilder/CHANGELOG.md
0 → 100644
This diff is collapsed. Click to expand it.
node_modules/xmlbuilder/LICENSE
0 → 100644
1 | +The MIT License (MIT) | ||
2 | + | ||
3 | +Copyright (c) 2013 Ozgur Ozcitak | ||
4 | + | ||
5 | +Permission is hereby granted, free of charge, to any person obtaining a copy | ||
6 | +of this software and associated documentation files (the "Software"), to deal | ||
7 | +in the Software without restriction, including without limitation the rights | ||
8 | +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
9 | +copies of the Software, and to permit persons to whom the Software is | ||
10 | +furnished to do so, subject to the following conditions: | ||
11 | + | ||
12 | +The above copyright notice and this permission notice shall be included in | ||
13 | +all copies or substantial portions of the Software. | ||
14 | + | ||
15 | +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
16 | +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
17 | +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
18 | +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
19 | +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
20 | +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
21 | +THE SOFTWARE. |
node_modules/xmlbuilder/README.md
0 → 100644
1 | +# xmlbuilder-js | ||
2 | + | ||
3 | +An XML builder for [node.js](https://nodejs.org/) similar to | ||
4 | +[java-xmlbuilder](https://github.com/jmurty/java-xmlbuilder). | ||
5 | + | ||
6 | +[![License](http://img.shields.io/npm/l/xmlbuilder.svg?style=flat-square)](http://opensource.org/licenses/MIT) | ||
7 | +[![NPM Version](http://img.shields.io/npm/v/xmlbuilder.svg?style=flat-square)](https://npmjs.com/package/xmlbuilder) | ||
8 | +[![NPM Downloads](https://img.shields.io/npm/dm/xmlbuilder.svg?style=flat-square)](https://npmjs.com/package/xmlbuilder) | ||
9 | + | ||
10 | +[![Travis Build Status](http://img.shields.io/travis/oozcitak/xmlbuilder-js.svg?style=flat-square)](http://travis-ci.org/oozcitak/xmlbuilder-js) | ||
11 | +[![AppVeyor Build status](https://ci.appveyor.com/api/projects/status/bf7odb20hj77isry?svg=true)](https://ci.appveyor.com/project/oozcitak/xmlbuilder-js) | ||
12 | +[![Dev Dependency Status](http://img.shields.io/david/dev/oozcitak/xmlbuilder-js.svg?style=flat-square)](https://david-dm.org/oozcitak/xmlbuilder-js) | ||
13 | +[![Code Coverage](https://img.shields.io/coveralls/oozcitak/xmlbuilder-js.svg?style=flat-square)](https://coveralls.io/github/oozcitak/xmlbuilder-js) | ||
14 | + | ||
15 | +### Installation: | ||
16 | + | ||
17 | +``` sh | ||
18 | +npm install xmlbuilder | ||
19 | +``` | ||
20 | + | ||
21 | +### Usage: | ||
22 | + | ||
23 | +``` js | ||
24 | +var builder = require('xmlbuilder'); | ||
25 | +var xml = builder.create('root') | ||
26 | + .ele('xmlbuilder') | ||
27 | + .ele('repo', {'type': 'git'}, 'git://github.com/oozcitak/xmlbuilder-js.git') | ||
28 | + .end({ pretty: true}); | ||
29 | + | ||
30 | +console.log(xml); | ||
31 | +``` | ||
32 | + | ||
33 | +will result in: | ||
34 | + | ||
35 | +``` xml | ||
36 | +<?xml version="1.0"?> | ||
37 | +<root> | ||
38 | + <xmlbuilder> | ||
39 | + <repo type="git">git://github.com/oozcitak/xmlbuilder-js.git</repo> | ||
40 | + </xmlbuilder> | ||
41 | +</root> | ||
42 | +``` | ||
43 | + | ||
44 | +It is also possible to convert objects into nodes: | ||
45 | + | ||
46 | +``` js | ||
47 | +builder.create({ | ||
48 | + root: { | ||
49 | + xmlbuilder: { | ||
50 | + repo: { | ||
51 | + '@type': 'git', // attributes start with @ | ||
52 | + '#text': 'git://github.com/oozcitak/xmlbuilder-js.git' // text node | ||
53 | + } | ||
54 | + } | ||
55 | + } | ||
56 | +}); | ||
57 | +``` | ||
58 | + | ||
59 | +If you need to do some processing: | ||
60 | + | ||
61 | +``` js | ||
62 | +var root = builder.create('squares'); | ||
63 | +root.com('f(x) = x^2'); | ||
64 | +for(var i = 1; i <= 5; i++) | ||
65 | +{ | ||
66 | + var item = root.ele('data'); | ||
67 | + item.att('x', i); | ||
68 | + item.att('y', i * i); | ||
69 | +} | ||
70 | +``` | ||
71 | + | ||
72 | +This will result in: | ||
73 | + | ||
74 | +``` xml | ||
75 | +<?xml version="1.0"?> | ||
76 | +<squares> | ||
77 | + <!-- f(x) = x^2 --> | ||
78 | + <data x="1" y="1"/> | ||
79 | + <data x="2" y="4"/> | ||
80 | + <data x="3" y="9"/> | ||
81 | + <data x="4" y="16"/> | ||
82 | + <data x="5" y="25"/> | ||
83 | +</squares> | ||
84 | +``` | ||
85 | + | ||
86 | +See the [wiki](https://github.com/oozcitak/xmlbuilder-js/wiki) for details and [examples](https://github.com/oozcitak/xmlbuilder-js/wiki/Examples) for more complex examples. |
node_modules/xmlbuilder/appveyor.yml
0 → 100644
1 | +environment: | ||
2 | + matrix: | ||
3 | + - nodejs_version: "4" | ||
4 | + - nodejs_version: "5" | ||
5 | + - nodejs_version: "6" | ||
6 | + - nodejs_version: "8" | ||
7 | + - nodejs_version: "10" | ||
8 | + - nodejs_version: "" # latest | ||
9 | + | ||
10 | +install: | ||
11 | + - ps: "Install-Product node $env:nodejs_version" | ||
12 | + - "npm install" | ||
13 | + | ||
14 | +test_script: | ||
15 | + - "node --version" | ||
16 | + - "npm --version" | ||
17 | + - "npm test" | ||
18 | + | ||
19 | +build: off | ||
20 | + |
node_modules/xmlbuilder/lib/Derivation.js
0 → 100644
node_modules/xmlbuilder/lib/NodeType.js
0 → 100644
1 | +// Generated by CoffeeScript 1.12.7 | ||
2 | +(function() { | ||
3 | + module.exports = { | ||
4 | + Element: 1, | ||
5 | + Attribute: 2, | ||
6 | + Text: 3, | ||
7 | + CData: 4, | ||
8 | + EntityReference: 5, | ||
9 | + EntityDeclaration: 6, | ||
10 | + ProcessingInstruction: 7, | ||
11 | + Comment: 8, | ||
12 | + Document: 9, | ||
13 | + DocType: 10, | ||
14 | + DocumentFragment: 11, | ||
15 | + NotationDeclaration: 12, | ||
16 | + Declaration: 201, | ||
17 | + Raw: 202, | ||
18 | + AttributeDeclaration: 203, | ||
19 | + ElementDeclaration: 204, | ||
20 | + Dummy: 205 | ||
21 | + }; | ||
22 | + | ||
23 | +}).call(this); |
node_modules/xmlbuilder/lib/OperationType.js
0 → 100644
node_modules/xmlbuilder/lib/Utility.js
0 → 100644
1 | +// Generated by CoffeeScript 1.12.7 | ||
2 | +(function() { | ||
3 | + var assign, getValue, isArray, isEmpty, isFunction, isObject, isPlainObject, | ||
4 | + slice = [].slice, | ||
5 | + hasProp = {}.hasOwnProperty; | ||
6 | + | ||
7 | + assign = function() { | ||
8 | + var i, key, len, source, sources, target; | ||
9 | + target = arguments[0], sources = 2 <= arguments.length ? slice.call(arguments, 1) : []; | ||
10 | + if (isFunction(Object.assign)) { | ||
11 | + Object.assign.apply(null, arguments); | ||
12 | + } else { | ||
13 | + for (i = 0, len = sources.length; i < len; i++) { | ||
14 | + source = sources[i]; | ||
15 | + if (source != null) { | ||
16 | + for (key in source) { | ||
17 | + if (!hasProp.call(source, key)) continue; | ||
18 | + target[key] = source[key]; | ||
19 | + } | ||
20 | + } | ||
21 | + } | ||
22 | + } | ||
23 | + return target; | ||
24 | + }; | ||
25 | + | ||
26 | + isFunction = function(val) { | ||
27 | + return !!val && Object.prototype.toString.call(val) === '[object Function]'; | ||
28 | + }; | ||
29 | + | ||
30 | + isObject = function(val) { | ||
31 | + var ref; | ||
32 | + return !!val && ((ref = typeof val) === 'function' || ref === 'object'); | ||
33 | + }; | ||
34 | + | ||
35 | + isArray = function(val) { | ||
36 | + if (isFunction(Array.isArray)) { | ||
37 | + return Array.isArray(val); | ||
38 | + } else { | ||
39 | + return Object.prototype.toString.call(val) === '[object Array]'; | ||
40 | + } | ||
41 | + }; | ||
42 | + | ||
43 | + isEmpty = function(val) { | ||
44 | + var key; | ||
45 | + if (isArray(val)) { | ||
46 | + return !val.length; | ||
47 | + } else { | ||
48 | + for (key in val) { | ||
49 | + if (!hasProp.call(val, key)) continue; | ||
50 | + return false; | ||
51 | + } | ||
52 | + return true; | ||
53 | + } | ||
54 | + }; | ||
55 | + | ||
56 | + isPlainObject = function(val) { | ||
57 | + var ctor, proto; | ||
58 | + return isObject(val) && (proto = Object.getPrototypeOf(val)) && (ctor = proto.constructor) && (typeof ctor === 'function') && (ctor instanceof ctor) && (Function.prototype.toString.call(ctor) === Function.prototype.toString.call(Object)); | ||
59 | + }; | ||
60 | + | ||
61 | + getValue = function(obj) { | ||
62 | + if (isFunction(obj.valueOf)) { | ||
63 | + return obj.valueOf(); | ||
64 | + } else { | ||
65 | + return obj; | ||
66 | + } | ||
67 | + }; | ||
68 | + | ||
69 | + module.exports.assign = assign; | ||
70 | + | ||
71 | + module.exports.isFunction = isFunction; | ||
72 | + | ||
73 | + module.exports.isObject = isObject; | ||
74 | + | ||
75 | + module.exports.isArray = isArray; | ||
76 | + | ||
77 | + module.exports.isEmpty = isEmpty; | ||
78 | + | ||
79 | + module.exports.isPlainObject = isPlainObject; | ||
80 | + | ||
81 | + module.exports.getValue = getValue; | ||
82 | + | ||
83 | +}).call(this); |
node_modules/xmlbuilder/lib/WriterState.js
0 → 100644
node_modules/xmlbuilder/lib/XMLAttribute.js
0 → 100644
1 | +// Generated by CoffeeScript 1.12.7 | ||
2 | +(function() { | ||
3 | + var NodeType, XMLAttribute, XMLNode; | ||
4 | + | ||
5 | + NodeType = require('./NodeType'); | ||
6 | + | ||
7 | + XMLNode = require('./XMLNode'); | ||
8 | + | ||
9 | + module.exports = XMLAttribute = (function() { | ||
10 | + function XMLAttribute(parent, name, value) { | ||
11 | + this.parent = parent; | ||
12 | + if (this.parent) { | ||
13 | + this.options = this.parent.options; | ||
14 | + this.stringify = this.parent.stringify; | ||
15 | + } | ||
16 | + if (name == null) { | ||
17 | + throw new Error("Missing attribute name. " + this.debugInfo(name)); | ||
18 | + } | ||
19 | + this.name = this.stringify.name(name); | ||
20 | + this.value = this.stringify.attValue(value); | ||
21 | + this.type = NodeType.Attribute; | ||
22 | + this.isId = false; | ||
23 | + this.schemaTypeInfo = null; | ||
24 | + } | ||
25 | + | ||
26 | + Object.defineProperty(XMLAttribute.prototype, 'nodeType', { | ||
27 | + get: function() { | ||
28 | + return this.type; | ||
29 | + } | ||
30 | + }); | ||
31 | + | ||
32 | + Object.defineProperty(XMLAttribute.prototype, 'ownerElement', { | ||
33 | + get: function() { | ||
34 | + return this.parent; | ||
35 | + } | ||
36 | + }); | ||
37 | + | ||
38 | + Object.defineProperty(XMLAttribute.prototype, 'textContent', { | ||
39 | + get: function() { | ||
40 | + return this.value; | ||
41 | + }, | ||
42 | + set: function(value) { | ||
43 | + return this.value = value || ''; | ||
44 | + } | ||
45 | + }); | ||
46 | + | ||
47 | + Object.defineProperty(XMLAttribute.prototype, 'namespaceURI', { | ||
48 | + get: function() { | ||
49 | + return ''; | ||
50 | + } | ||
51 | + }); | ||
52 | + | ||
53 | + Object.defineProperty(XMLAttribute.prototype, 'prefix', { | ||
54 | + get: function() { | ||
55 | + return ''; | ||
56 | + } | ||
57 | + }); | ||
58 | + | ||
59 | + Object.defineProperty(XMLAttribute.prototype, 'localName', { | ||
60 | + get: function() { | ||
61 | + return this.name; | ||
62 | + } | ||
63 | + }); | ||
64 | + | ||
65 | + Object.defineProperty(XMLAttribute.prototype, 'specified', { | ||
66 | + get: function() { | ||
67 | + return true; | ||
68 | + } | ||
69 | + }); | ||
70 | + | ||
71 | + XMLAttribute.prototype.clone = function() { | ||
72 | + return Object.create(this); | ||
73 | + }; | ||
74 | + | ||
75 | + XMLAttribute.prototype.toString = function(options) { | ||
76 | + return this.options.writer.attribute(this, this.options.writer.filterOptions(options)); | ||
77 | + }; | ||
78 | + | ||
79 | + XMLAttribute.prototype.debugInfo = function(name) { | ||
80 | + name = name || this.name; | ||
81 | + if (name == null) { | ||
82 | + return "parent: <" + this.parent.name + ">"; | ||
83 | + } else { | ||
84 | + return "attribute: {" + name + "}, parent: <" + this.parent.name + ">"; | ||
85 | + } | ||
86 | + }; | ||
87 | + | ||
88 | + XMLAttribute.prototype.isEqualNode = function(node) { | ||
89 | + if (node.namespaceURI !== this.namespaceURI) { | ||
90 | + return false; | ||
91 | + } | ||
92 | + if (node.prefix !== this.prefix) { | ||
93 | + return false; | ||
94 | + } | ||
95 | + if (node.localName !== this.localName) { | ||
96 | + return false; | ||
97 | + } | ||
98 | + if (node.value !== this.value) { | ||
99 | + return false; | ||
100 | + } | ||
101 | + return true; | ||
102 | + }; | ||
103 | + | ||
104 | + return XMLAttribute; | ||
105 | + | ||
106 | + })(); | ||
107 | + | ||
108 | +}).call(this); |
node_modules/xmlbuilder/lib/XMLCData.js
0 → 100644
1 | +// Generated by CoffeeScript 1.12.7 | ||
2 | +(function() { | ||
3 | + var NodeType, XMLCData, XMLCharacterData, | ||
4 | + extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, | ||
5 | + hasProp = {}.hasOwnProperty; | ||
6 | + | ||
7 | + NodeType = require('./NodeType'); | ||
8 | + | ||
9 | + XMLCharacterData = require('./XMLCharacterData'); | ||
10 | + | ||
11 | + module.exports = XMLCData = (function(superClass) { | ||
12 | + extend(XMLCData, superClass); | ||
13 | + | ||
14 | + function XMLCData(parent, text) { | ||
15 | + XMLCData.__super__.constructor.call(this, parent); | ||
16 | + if (text == null) { | ||
17 | + throw new Error("Missing CDATA text. " + this.debugInfo()); | ||
18 | + } | ||
19 | + this.name = "#cdata-section"; | ||
20 | + this.type = NodeType.CData; | ||
21 | + this.value = this.stringify.cdata(text); | ||
22 | + } | ||
23 | + | ||
24 | + XMLCData.prototype.clone = function() { | ||
25 | + return Object.create(this); | ||
26 | + }; | ||
27 | + | ||
28 | + XMLCData.prototype.toString = function(options) { | ||
29 | + return this.options.writer.cdata(this, this.options.writer.filterOptions(options)); | ||
30 | + }; | ||
31 | + | ||
32 | + return XMLCData; | ||
33 | + | ||
34 | + })(XMLCharacterData); | ||
35 | + | ||
36 | +}).call(this); |
1 | +// Generated by CoffeeScript 1.12.7 | ||
2 | +(function() { | ||
3 | + var XMLCharacterData, XMLNode, | ||
4 | + extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, | ||
5 | + hasProp = {}.hasOwnProperty; | ||
6 | + | ||
7 | + XMLNode = require('./XMLNode'); | ||
8 | + | ||
9 | + module.exports = XMLCharacterData = (function(superClass) { | ||
10 | + extend(XMLCharacterData, superClass); | ||
11 | + | ||
12 | + function XMLCharacterData(parent) { | ||
13 | + XMLCharacterData.__super__.constructor.call(this, parent); | ||
14 | + this.value = ''; | ||
15 | + } | ||
16 | + | ||
17 | + Object.defineProperty(XMLCharacterData.prototype, 'data', { | ||
18 | + get: function() { | ||
19 | + return this.value; | ||
20 | + }, | ||
21 | + set: function(value) { | ||
22 | + return this.value = value || ''; | ||
23 | + } | ||
24 | + }); | ||
25 | + | ||
26 | + Object.defineProperty(XMLCharacterData.prototype, 'length', { | ||
27 | + get: function() { | ||
28 | + return this.value.length; | ||
29 | + } | ||
30 | + }); | ||
31 | + | ||
32 | + Object.defineProperty(XMLCharacterData.prototype, 'textContent', { | ||
33 | + get: function() { | ||
34 | + return this.value; | ||
35 | + }, | ||
36 | + set: function(value) { | ||
37 | + return this.value = value || ''; | ||
38 | + } | ||
39 | + }); | ||
40 | + | ||
41 | + XMLCharacterData.prototype.clone = function() { | ||
42 | + return Object.create(this); | ||
43 | + }; | ||
44 | + | ||
45 | + XMLCharacterData.prototype.substringData = function(offset, count) { | ||
46 | + throw new Error("This DOM method is not implemented." + this.debugInfo()); | ||
47 | + }; | ||
48 | + | ||
49 | + XMLCharacterData.prototype.appendData = function(arg) { | ||
50 | + throw new Error("This DOM method is not implemented." + this.debugInfo()); | ||
51 | + }; | ||
52 | + | ||
53 | + XMLCharacterData.prototype.insertData = function(offset, arg) { | ||
54 | + throw new Error("This DOM method is not implemented." + this.debugInfo()); | ||
55 | + }; | ||
56 | + | ||
57 | + XMLCharacterData.prototype.deleteData = function(offset, count) { | ||
58 | + throw new Error("This DOM method is not implemented." + this.debugInfo()); | ||
59 | + }; | ||
60 | + | ||
61 | + XMLCharacterData.prototype.replaceData = function(offset, count, arg) { | ||
62 | + throw new Error("This DOM method is not implemented." + this.debugInfo()); | ||
63 | + }; | ||
64 | + | ||
65 | + XMLCharacterData.prototype.isEqualNode = function(node) { | ||
66 | + if (!XMLCharacterData.__super__.isEqualNode.apply(this, arguments).isEqualNode(node)) { | ||
67 | + return false; | ||
68 | + } | ||
69 | + if (node.data !== this.data) { | ||
70 | + return false; | ||
71 | + } | ||
72 | + return true; | ||
73 | + }; | ||
74 | + | ||
75 | + return XMLCharacterData; | ||
76 | + | ||
77 | + })(XMLNode); | ||
78 | + | ||
79 | +}).call(this); |
node_modules/xmlbuilder/lib/XMLComment.js
0 → 100644
1 | +// Generated by CoffeeScript 1.12.7 | ||
2 | +(function() { | ||
3 | + var NodeType, XMLCharacterData, XMLComment, | ||
4 | + extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, | ||
5 | + hasProp = {}.hasOwnProperty; | ||
6 | + | ||
7 | + NodeType = require('./NodeType'); | ||
8 | + | ||
9 | + XMLCharacterData = require('./XMLCharacterData'); | ||
10 | + | ||
11 | + module.exports = XMLComment = (function(superClass) { | ||
12 | + extend(XMLComment, superClass); | ||
13 | + | ||
14 | + function XMLComment(parent, text) { | ||
15 | + XMLComment.__super__.constructor.call(this, parent); | ||
16 | + if (text == null) { | ||
17 | + throw new Error("Missing comment text. " + this.debugInfo()); | ||
18 | + } | ||
19 | + this.name = "#comment"; | ||
20 | + this.type = NodeType.Comment; | ||
21 | + this.value = this.stringify.comment(text); | ||
22 | + } | ||
23 | + | ||
24 | + XMLComment.prototype.clone = function() { | ||
25 | + return Object.create(this); | ||
26 | + }; | ||
27 | + | ||
28 | + XMLComment.prototype.toString = function(options) { | ||
29 | + return this.options.writer.comment(this, this.options.writer.filterOptions(options)); | ||
30 | + }; | ||
31 | + | ||
32 | + return XMLComment; | ||
33 | + | ||
34 | + })(XMLCharacterData); | ||
35 | + | ||
36 | +}).call(this); |
1 | +// Generated by CoffeeScript 1.12.7 | ||
2 | +(function() { | ||
3 | + var XMLDOMConfiguration, XMLDOMErrorHandler, XMLDOMStringList; | ||
4 | + | ||
5 | + XMLDOMErrorHandler = require('./XMLDOMErrorHandler'); | ||
6 | + | ||
7 | + XMLDOMStringList = require('./XMLDOMStringList'); | ||
8 | + | ||
9 | + module.exports = XMLDOMConfiguration = (function() { | ||
10 | + function XMLDOMConfiguration() { | ||
11 | + var clonedSelf; | ||
12 | + this.defaultParams = { | ||
13 | + "canonical-form": false, | ||
14 | + "cdata-sections": false, | ||
15 | + "comments": false, | ||
16 | + "datatype-normalization": false, | ||
17 | + "element-content-whitespace": true, | ||
18 | + "entities": true, | ||
19 | + "error-handler": new XMLDOMErrorHandler(), | ||
20 | + "infoset": true, | ||
21 | + "validate-if-schema": false, | ||
22 | + "namespaces": true, | ||
23 | + "namespace-declarations": true, | ||
24 | + "normalize-characters": false, | ||
25 | + "schema-location": '', | ||
26 | + "schema-type": '', | ||
27 | + "split-cdata-sections": true, | ||
28 | + "validate": false, | ||
29 | + "well-formed": true | ||
30 | + }; | ||
31 | + this.params = clonedSelf = Object.create(this.defaultParams); | ||
32 | + } | ||
33 | + | ||
34 | + Object.defineProperty(XMLDOMConfiguration.prototype, 'parameterNames', { | ||
35 | + get: function() { | ||
36 | + return new XMLDOMStringList(Object.keys(this.defaultParams)); | ||
37 | + } | ||
38 | + }); | ||
39 | + | ||
40 | + XMLDOMConfiguration.prototype.getParameter = function(name) { | ||
41 | + if (this.params.hasOwnProperty(name)) { | ||
42 | + return this.params[name]; | ||
43 | + } else { | ||
44 | + return null; | ||
45 | + } | ||
46 | + }; | ||
47 | + | ||
48 | + XMLDOMConfiguration.prototype.canSetParameter = function(name, value) { | ||
49 | + return true; | ||
50 | + }; | ||
51 | + | ||
52 | + XMLDOMConfiguration.prototype.setParameter = function(name, value) { | ||
53 | + if (value != null) { | ||
54 | + return this.params[name] = value; | ||
55 | + } else { | ||
56 | + return delete this.params[name]; | ||
57 | + } | ||
58 | + }; | ||
59 | + | ||
60 | + return XMLDOMConfiguration; | ||
61 | + | ||
62 | + })(); | ||
63 | + | ||
64 | +}).call(this); |
1 | +// Generated by CoffeeScript 1.12.7 | ||
2 | +(function() { | ||
3 | + var XMLDOMErrorHandler; | ||
4 | + | ||
5 | + module.exports = XMLDOMErrorHandler = (function() { | ||
6 | + function XMLDOMErrorHandler() {} | ||
7 | + | ||
8 | + XMLDOMErrorHandler.prototype.handleError = function(error) { | ||
9 | + throw new Error(error); | ||
10 | + }; | ||
11 | + | ||
12 | + return XMLDOMErrorHandler; | ||
13 | + | ||
14 | + })(); | ||
15 | + | ||
16 | +}).call(this); |
1 | +// Generated by CoffeeScript 1.12.7 | ||
2 | +(function() { | ||
3 | + var XMLDOMImplementation; | ||
4 | + | ||
5 | + module.exports = XMLDOMImplementation = (function() { | ||
6 | + function XMLDOMImplementation() {} | ||
7 | + | ||
8 | + XMLDOMImplementation.prototype.hasFeature = function(feature, version) { | ||
9 | + return true; | ||
10 | + }; | ||
11 | + | ||
12 | + XMLDOMImplementation.prototype.createDocumentType = function(qualifiedName, publicId, systemId) { | ||
13 | + throw new Error("This DOM method is not implemented."); | ||
14 | + }; | ||
15 | + | ||
16 | + XMLDOMImplementation.prototype.createDocument = function(namespaceURI, qualifiedName, doctype) { | ||
17 | + throw new Error("This DOM method is not implemented."); | ||
18 | + }; | ||
19 | + | ||
20 | + XMLDOMImplementation.prototype.createHTMLDocument = function(title) { | ||
21 | + throw new Error("This DOM method is not implemented."); | ||
22 | + }; | ||
23 | + | ||
24 | + XMLDOMImplementation.prototype.getFeature = function(feature, version) { | ||
25 | + throw new Error("This DOM method is not implemented."); | ||
26 | + }; | ||
27 | + | ||
28 | + return XMLDOMImplementation; | ||
29 | + | ||
30 | + })(); | ||
31 | + | ||
32 | +}).call(this); |
1 | +// Generated by CoffeeScript 1.12.7 | ||
2 | +(function() { | ||
3 | + var XMLDOMStringList; | ||
4 | + | ||
5 | + module.exports = XMLDOMStringList = (function() { | ||
6 | + function XMLDOMStringList(arr) { | ||
7 | + this.arr = arr || []; | ||
8 | + } | ||
9 | + | ||
10 | + Object.defineProperty(XMLDOMStringList.prototype, 'length', { | ||
11 | + get: function() { | ||
12 | + return this.arr.length; | ||
13 | + } | ||
14 | + }); | ||
15 | + | ||
16 | + XMLDOMStringList.prototype.item = function(index) { | ||
17 | + return this.arr[index] || null; | ||
18 | + }; | ||
19 | + | ||
20 | + XMLDOMStringList.prototype.contains = function(str) { | ||
21 | + return this.arr.indexOf(str) !== -1; | ||
22 | + }; | ||
23 | + | ||
24 | + return XMLDOMStringList; | ||
25 | + | ||
26 | + })(); | ||
27 | + | ||
28 | +}).call(this); |
node_modules/xmlbuilder/lib/XMLDTDAttList.js
0 → 100644
1 | +// Generated by CoffeeScript 1.12.7 | ||
2 | +(function() { | ||
3 | + var NodeType, XMLDTDAttList, XMLNode, | ||
4 | + extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, | ||
5 | + hasProp = {}.hasOwnProperty; | ||
6 | + | ||
7 | + XMLNode = require('./XMLNode'); | ||
8 | + | ||
9 | + NodeType = require('./NodeType'); | ||
10 | + | ||
11 | + module.exports = XMLDTDAttList = (function(superClass) { | ||
12 | + extend(XMLDTDAttList, superClass); | ||
13 | + | ||
14 | + function XMLDTDAttList(parent, elementName, attributeName, attributeType, defaultValueType, defaultValue) { | ||
15 | + XMLDTDAttList.__super__.constructor.call(this, parent); | ||
16 | + if (elementName == null) { | ||
17 | + throw new Error("Missing DTD element name. " + this.debugInfo()); | ||
18 | + } | ||
19 | + if (attributeName == null) { | ||
20 | + throw new Error("Missing DTD attribute name. " + this.debugInfo(elementName)); | ||
21 | + } | ||
22 | + if (!attributeType) { | ||
23 | + throw new Error("Missing DTD attribute type. " + this.debugInfo(elementName)); | ||
24 | + } | ||
25 | + if (!defaultValueType) { | ||
26 | + throw new Error("Missing DTD attribute default. " + this.debugInfo(elementName)); | ||
27 | + } | ||
28 | + if (defaultValueType.indexOf('#') !== 0) { | ||
29 | + defaultValueType = '#' + defaultValueType; | ||
30 | + } | ||
31 | + if (!defaultValueType.match(/^(#REQUIRED|#IMPLIED|#FIXED|#DEFAULT)$/)) { | ||
32 | + throw new Error("Invalid default value type; expected: #REQUIRED, #IMPLIED, #FIXED or #DEFAULT. " + this.debugInfo(elementName)); | ||
33 | + } | ||
34 | + if (defaultValue && !defaultValueType.match(/^(#FIXED|#DEFAULT)$/)) { | ||
35 | + throw new Error("Default value only applies to #FIXED or #DEFAULT. " + this.debugInfo(elementName)); | ||
36 | + } | ||
37 | + this.elementName = this.stringify.name(elementName); | ||
38 | + this.type = NodeType.AttributeDeclaration; | ||
39 | + this.attributeName = this.stringify.name(attributeName); | ||
40 | + this.attributeType = this.stringify.dtdAttType(attributeType); | ||
41 | + if (defaultValue) { | ||
42 | + this.defaultValue = this.stringify.dtdAttDefault(defaultValue); | ||
43 | + } | ||
44 | + this.defaultValueType = defaultValueType; | ||
45 | + } | ||
46 | + | ||
47 | + XMLDTDAttList.prototype.toString = function(options) { | ||
48 | + return this.options.writer.dtdAttList(this, this.options.writer.filterOptions(options)); | ||
49 | + }; | ||
50 | + | ||
51 | + return XMLDTDAttList; | ||
52 | + | ||
53 | + })(XMLNode); | ||
54 | + | ||
55 | +}).call(this); |
node_modules/xmlbuilder/lib/XMLDTDElement.js
0 → 100644
1 | +// Generated by CoffeeScript 1.12.7 | ||
2 | +(function() { | ||
3 | + var NodeType, XMLDTDElement, XMLNode, | ||
4 | + extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, | ||
5 | + hasProp = {}.hasOwnProperty; | ||
6 | + | ||
7 | + XMLNode = require('./XMLNode'); | ||
8 | + | ||
9 | + NodeType = require('./NodeType'); | ||
10 | + | ||
11 | + module.exports = XMLDTDElement = (function(superClass) { | ||
12 | + extend(XMLDTDElement, superClass); | ||
13 | + | ||
14 | + function XMLDTDElement(parent, name, value) { | ||
15 | + XMLDTDElement.__super__.constructor.call(this, parent); | ||
16 | + if (name == null) { | ||
17 | + throw new Error("Missing DTD element name. " + this.debugInfo()); | ||
18 | + } | ||
19 | + if (!value) { | ||
20 | + value = '(#PCDATA)'; | ||
21 | + } | ||
22 | + if (Array.isArray(value)) { | ||
23 | + value = '(' + value.join(',') + ')'; | ||
24 | + } | ||
25 | + this.name = this.stringify.name(name); | ||
26 | + this.type = NodeType.ElementDeclaration; | ||
27 | + this.value = this.stringify.dtdElementValue(value); | ||
28 | + } | ||
29 | + | ||
30 | + XMLDTDElement.prototype.toString = function(options) { | ||
31 | + return this.options.writer.dtdElement(this, this.options.writer.filterOptions(options)); | ||
32 | + }; | ||
33 | + | ||
34 | + return XMLDTDElement; | ||
35 | + | ||
36 | + })(XMLNode); | ||
37 | + | ||
38 | +}).call(this); |
node_modules/xmlbuilder/lib/XMLDTDEntity.js
0 → 100644
1 | +// Generated by CoffeeScript 1.12.7 | ||
2 | +(function() { | ||
3 | + var NodeType, XMLDTDEntity, XMLNode, isObject, | ||
4 | + extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, | ||
5 | + hasProp = {}.hasOwnProperty; | ||
6 | + | ||
7 | + isObject = require('./Utility').isObject; | ||
8 | + | ||
9 | + XMLNode = require('./XMLNode'); | ||
10 | + | ||
11 | + NodeType = require('./NodeType'); | ||
12 | + | ||
13 | + module.exports = XMLDTDEntity = (function(superClass) { | ||
14 | + extend(XMLDTDEntity, superClass); | ||
15 | + | ||
16 | + function XMLDTDEntity(parent, pe, name, value) { | ||
17 | + XMLDTDEntity.__super__.constructor.call(this, parent); | ||
18 | + if (name == null) { | ||
19 | + throw new Error("Missing DTD entity name. " + this.debugInfo(name)); | ||
20 | + } | ||
21 | + if (value == null) { | ||
22 | + throw new Error("Missing DTD entity value. " + this.debugInfo(name)); | ||
23 | + } | ||
24 | + this.pe = !!pe; | ||
25 | + this.name = this.stringify.name(name); | ||
26 | + this.type = NodeType.EntityDeclaration; | ||
27 | + if (!isObject(value)) { | ||
28 | + this.value = this.stringify.dtdEntityValue(value); | ||
29 | + this.internal = true; | ||
30 | + } else { | ||
31 | + if (!value.pubID && !value.sysID) { | ||
32 | + throw new Error("Public and/or system identifiers are required for an external entity. " + this.debugInfo(name)); | ||
33 | + } | ||
34 | + if (value.pubID && !value.sysID) { | ||
35 | + throw new Error("System identifier is required for a public external entity. " + this.debugInfo(name)); | ||
36 | + } | ||
37 | + this.internal = false; | ||
38 | + if (value.pubID != null) { | ||
39 | + this.pubID = this.stringify.dtdPubID(value.pubID); | ||
40 | + } | ||
41 | + if (value.sysID != null) { | ||
42 | + this.sysID = this.stringify.dtdSysID(value.sysID); | ||
43 | + } | ||
44 | + if (value.nData != null) { | ||
45 | + this.nData = this.stringify.dtdNData(value.nData); | ||
46 | + } | ||
47 | + if (this.pe && this.nData) { | ||
48 | + throw new Error("Notation declaration is not allowed in a parameter entity. " + this.debugInfo(name)); | ||
49 | + } | ||
50 | + } | ||
51 | + } | ||
52 | + | ||
53 | + Object.defineProperty(XMLDTDEntity.prototype, 'publicId', { | ||
54 | + get: function() { | ||
55 | + return this.pubID; | ||
56 | + } | ||
57 | + }); | ||
58 | + | ||
59 | + Object.defineProperty(XMLDTDEntity.prototype, 'systemId', { | ||
60 | + get: function() { | ||
61 | + return this.sysID; | ||
62 | + } | ||
63 | + }); | ||
64 | + | ||
65 | + Object.defineProperty(XMLDTDEntity.prototype, 'notationName', { | ||
66 | + get: function() { | ||
67 | + return this.nData || null; | ||
68 | + } | ||
69 | + }); | ||
70 | + | ||
71 | + Object.defineProperty(XMLDTDEntity.prototype, 'inputEncoding', { | ||
72 | + get: function() { | ||
73 | + return null; | ||
74 | + } | ||
75 | + }); | ||
76 | + | ||
77 | + Object.defineProperty(XMLDTDEntity.prototype, 'xmlEncoding', { | ||
78 | + get: function() { | ||
79 | + return null; | ||
80 | + } | ||
81 | + }); | ||
82 | + | ||
83 | + Object.defineProperty(XMLDTDEntity.prototype, 'xmlVersion', { | ||
84 | + get: function() { | ||
85 | + return null; | ||
86 | + } | ||
87 | + }); | ||
88 | + | ||
89 | + XMLDTDEntity.prototype.toString = function(options) { | ||
90 | + return this.options.writer.dtdEntity(this, this.options.writer.filterOptions(options)); | ||
91 | + }; | ||
92 | + | ||
93 | + return XMLDTDEntity; | ||
94 | + | ||
95 | + })(XMLNode); | ||
96 | + | ||
97 | +}).call(this); |
1 | +// Generated by CoffeeScript 1.12.7 | ||
2 | +(function() { | ||
3 | + var NodeType, XMLDTDNotation, XMLNode, | ||
4 | + extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, | ||
5 | + hasProp = {}.hasOwnProperty; | ||
6 | + | ||
7 | + XMLNode = require('./XMLNode'); | ||
8 | + | ||
9 | + NodeType = require('./NodeType'); | ||
10 | + | ||
11 | + module.exports = XMLDTDNotation = (function(superClass) { | ||
12 | + extend(XMLDTDNotation, superClass); | ||
13 | + | ||
14 | + function XMLDTDNotation(parent, name, value) { | ||
15 | + XMLDTDNotation.__super__.constructor.call(this, parent); | ||
16 | + if (name == null) { | ||
17 | + throw new Error("Missing DTD notation name. " + this.debugInfo(name)); | ||
18 | + } | ||
19 | + if (!value.pubID && !value.sysID) { | ||
20 | + throw new Error("Public or system identifiers are required for an external entity. " + this.debugInfo(name)); | ||
21 | + } | ||
22 | + this.name = this.stringify.name(name); | ||
23 | + this.type = NodeType.NotationDeclaration; | ||
24 | + if (value.pubID != null) { | ||
25 | + this.pubID = this.stringify.dtdPubID(value.pubID); | ||
26 | + } | ||
27 | + if (value.sysID != null) { | ||
28 | + this.sysID = this.stringify.dtdSysID(value.sysID); | ||
29 | + } | ||
30 | + } | ||
31 | + | ||
32 | + Object.defineProperty(XMLDTDNotation.prototype, 'publicId', { | ||
33 | + get: function() { | ||
34 | + return this.pubID; | ||
35 | + } | ||
36 | + }); | ||
37 | + | ||
38 | + Object.defineProperty(XMLDTDNotation.prototype, 'systemId', { | ||
39 | + get: function() { | ||
40 | + return this.sysID; | ||
41 | + } | ||
42 | + }); | ||
43 | + | ||
44 | + XMLDTDNotation.prototype.toString = function(options) { | ||
45 | + return this.options.writer.dtdNotation(this, this.options.writer.filterOptions(options)); | ||
46 | + }; | ||
47 | + | ||
48 | + return XMLDTDNotation; | ||
49 | + | ||
50 | + })(XMLNode); | ||
51 | + | ||
52 | +}).call(this); |
1 | +// Generated by CoffeeScript 1.12.7 | ||
2 | +(function() { | ||
3 | + var NodeType, XMLDeclaration, XMLNode, isObject, | ||
4 | + extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, | ||
5 | + hasProp = {}.hasOwnProperty; | ||
6 | + | ||
7 | + isObject = require('./Utility').isObject; | ||
8 | + | ||
9 | + XMLNode = require('./XMLNode'); | ||
10 | + | ||
11 | + NodeType = require('./NodeType'); | ||
12 | + | ||
13 | + module.exports = XMLDeclaration = (function(superClass) { | ||
14 | + extend(XMLDeclaration, superClass); | ||
15 | + | ||
16 | + function XMLDeclaration(parent, version, encoding, standalone) { | ||
17 | + var ref; | ||
18 | + XMLDeclaration.__super__.constructor.call(this, parent); | ||
19 | + if (isObject(version)) { | ||
20 | + ref = version, version = ref.version, encoding = ref.encoding, standalone = ref.standalone; | ||
21 | + } | ||
22 | + if (!version) { | ||
23 | + version = '1.0'; | ||
24 | + } | ||
25 | + this.type = NodeType.Declaration; | ||
26 | + this.version = this.stringify.xmlVersion(version); | ||
27 | + if (encoding != null) { | ||
28 | + this.encoding = this.stringify.xmlEncoding(encoding); | ||
29 | + } | ||
30 | + if (standalone != null) { | ||
31 | + this.standalone = this.stringify.xmlStandalone(standalone); | ||
32 | + } | ||
33 | + } | ||
34 | + | ||
35 | + XMLDeclaration.prototype.toString = function(options) { | ||
36 | + return this.options.writer.declaration(this, this.options.writer.filterOptions(options)); | ||
37 | + }; | ||
38 | + | ||
39 | + return XMLDeclaration; | ||
40 | + | ||
41 | + })(XMLNode); | ||
42 | + | ||
43 | +}).call(this); |
node_modules/xmlbuilder/lib/XMLDocType.js
0 → 100644
1 | +// Generated by CoffeeScript 1.12.7 | ||
2 | +(function() { | ||
3 | + var NodeType, XMLDTDAttList, XMLDTDElement, XMLDTDEntity, XMLDTDNotation, XMLDocType, XMLNamedNodeMap, XMLNode, isObject, | ||
4 | + extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, | ||
5 | + hasProp = {}.hasOwnProperty; | ||
6 | + | ||
7 | + isObject = require('./Utility').isObject; | ||
8 | + | ||
9 | + XMLNode = require('./XMLNode'); | ||
10 | + | ||
11 | + NodeType = require('./NodeType'); | ||
12 | + | ||
13 | + XMLDTDAttList = require('./XMLDTDAttList'); | ||
14 | + | ||
15 | + XMLDTDEntity = require('./XMLDTDEntity'); | ||
16 | + | ||
17 | + XMLDTDElement = require('./XMLDTDElement'); | ||
18 | + | ||
19 | + XMLDTDNotation = require('./XMLDTDNotation'); | ||
20 | + | ||
21 | + XMLNamedNodeMap = require('./XMLNamedNodeMap'); | ||
22 | + | ||
23 | + module.exports = XMLDocType = (function(superClass) { | ||
24 | + extend(XMLDocType, superClass); | ||
25 | + | ||
26 | + function XMLDocType(parent, pubID, sysID) { | ||
27 | + var child, i, len, ref, ref1, ref2; | ||
28 | + XMLDocType.__super__.constructor.call(this, parent); | ||
29 | + this.type = NodeType.DocType; | ||
30 | + if (parent.children) { | ||
31 | + ref = parent.children; | ||
32 | + for (i = 0, len = ref.length; i < len; i++) { | ||
33 | + child = ref[i]; | ||
34 | + if (child.type === NodeType.Element) { | ||
35 | + this.name = child.name; | ||
36 | + break; | ||
37 | + } | ||
38 | + } | ||
39 | + } | ||
40 | + this.documentObject = parent; | ||
41 | + if (isObject(pubID)) { | ||
42 | + ref1 = pubID, pubID = ref1.pubID, sysID = ref1.sysID; | ||
43 | + } | ||
44 | + if (sysID == null) { | ||
45 | + ref2 = [pubID, sysID], sysID = ref2[0], pubID = ref2[1]; | ||
46 | + } | ||
47 | + if (pubID != null) { | ||
48 | + this.pubID = this.stringify.dtdPubID(pubID); | ||
49 | + } | ||
50 | + if (sysID != null) { | ||
51 | + this.sysID = this.stringify.dtdSysID(sysID); | ||
52 | + } | ||
53 | + } | ||
54 | + | ||
55 | + Object.defineProperty(XMLDocType.prototype, 'entities', { | ||
56 | + get: function() { | ||
57 | + var child, i, len, nodes, ref; | ||
58 | + nodes = {}; | ||
59 | + ref = this.children; | ||
60 | + for (i = 0, len = ref.length; i < len; i++) { | ||
61 | + child = ref[i]; | ||
62 | + if ((child.type === NodeType.EntityDeclaration) && !child.pe) { | ||
63 | + nodes[child.name] = child; | ||
64 | + } | ||
65 | + } | ||
66 | + return new XMLNamedNodeMap(nodes); | ||
67 | + } | ||
68 | + }); | ||
69 | + | ||
70 | + Object.defineProperty(XMLDocType.prototype, 'notations', { | ||
71 | + get: function() { | ||
72 | + var child, i, len, nodes, ref; | ||
73 | + nodes = {}; | ||
74 | + ref = this.children; | ||
75 | + for (i = 0, len = ref.length; i < len; i++) { | ||
76 | + child = ref[i]; | ||
77 | + if (child.type === NodeType.NotationDeclaration) { | ||
78 | + nodes[child.name] = child; | ||
79 | + } | ||
80 | + } | ||
81 | + return new XMLNamedNodeMap(nodes); | ||
82 | + } | ||
83 | + }); | ||
84 | + | ||
85 | + Object.defineProperty(XMLDocType.prototype, 'publicId', { | ||
86 | + get: function() { | ||
87 | + return this.pubID; | ||
88 | + } | ||
89 | + }); | ||
90 | + | ||
91 | + Object.defineProperty(XMLDocType.prototype, 'systemId', { | ||
92 | + get: function() { | ||
93 | + return this.sysID; | ||
94 | + } | ||
95 | + }); | ||
96 | + | ||
97 | + Object.defineProperty(XMLDocType.prototype, 'internalSubset', { | ||
98 | + get: function() { | ||
99 | + throw new Error("This DOM method is not implemented." + this.debugInfo()); | ||
100 | + } | ||
101 | + }); | ||
102 | + | ||
103 | + XMLDocType.prototype.element = function(name, value) { | ||
104 | + var child; | ||
105 | + child = new XMLDTDElement(this, name, value); | ||
106 | + this.children.push(child); | ||
107 | + return this; | ||
108 | + }; | ||
109 | + | ||
110 | + XMLDocType.prototype.attList = function(elementName, attributeName, attributeType, defaultValueType, defaultValue) { | ||
111 | + var child; | ||
112 | + child = new XMLDTDAttList(this, elementName, attributeName, attributeType, defaultValueType, defaultValue); | ||
113 | + this.children.push(child); | ||
114 | + return this; | ||
115 | + }; | ||
116 | + | ||
117 | + XMLDocType.prototype.entity = function(name, value) { | ||
118 | + var child; | ||
119 | + child = new XMLDTDEntity(this, false, name, value); | ||
120 | + this.children.push(child); | ||
121 | + return this; | ||
122 | + }; | ||
123 | + | ||
124 | + XMLDocType.prototype.pEntity = function(name, value) { | ||
125 | + var child; | ||
126 | + child = new XMLDTDEntity(this, true, name, value); | ||
127 | + this.children.push(child); | ||
128 | + return this; | ||
129 | + }; | ||
130 | + | ||
131 | + XMLDocType.prototype.notation = function(name, value) { | ||
132 | + var child; | ||
133 | + child = new XMLDTDNotation(this, name, value); | ||
134 | + this.children.push(child); | ||
135 | + return this; | ||
136 | + }; | ||
137 | + | ||
138 | + XMLDocType.prototype.toString = function(options) { | ||
139 | + return this.options.writer.docType(this, this.options.writer.filterOptions(options)); | ||
140 | + }; | ||
141 | + | ||
142 | + XMLDocType.prototype.ele = function(name, value) { | ||
143 | + return this.element(name, value); | ||
144 | + }; | ||
145 | + | ||
146 | + XMLDocType.prototype.att = function(elementName, attributeName, attributeType, defaultValueType, defaultValue) { | ||
147 | + return this.attList(elementName, attributeName, attributeType, defaultValueType, defaultValue); | ||
148 | + }; | ||
149 | + | ||
150 | + XMLDocType.prototype.ent = function(name, value) { | ||
151 | + return this.entity(name, value); | ||
152 | + }; | ||
153 | + | ||
154 | + XMLDocType.prototype.pent = function(name, value) { | ||
155 | + return this.pEntity(name, value); | ||
156 | + }; | ||
157 | + | ||
158 | + XMLDocType.prototype.not = function(name, value) { | ||
159 | + return this.notation(name, value); | ||
160 | + }; | ||
161 | + | ||
162 | + XMLDocType.prototype.up = function() { | ||
163 | + return this.root() || this.documentObject; | ||
164 | + }; | ||
165 | + | ||
166 | + XMLDocType.prototype.isEqualNode = function(node) { | ||
167 | + if (!XMLDocType.__super__.isEqualNode.apply(this, arguments).isEqualNode(node)) { | ||
168 | + return false; | ||
169 | + } | ||
170 | + if (node.name !== this.name) { | ||
171 | + return false; | ||
172 | + } | ||
173 | + if (node.publicId !== this.publicId) { | ||
174 | + return false; | ||
175 | + } | ||
176 | + if (node.systemId !== this.systemId) { | ||
177 | + return false; | ||
178 | + } | ||
179 | + return true; | ||
180 | + }; | ||
181 | + | ||
182 | + return XMLDocType; | ||
183 | + | ||
184 | + })(XMLNode); | ||
185 | + | ||
186 | +}).call(this); |
node_modules/xmlbuilder/lib/XMLDocument.js
0 → 100644
1 | +// Generated by CoffeeScript 1.12.7 | ||
2 | +(function() { | ||
3 | + var NodeType, XMLDOMConfiguration, XMLDOMImplementation, XMLDocument, XMLNode, XMLStringWriter, XMLStringifier, isPlainObject, | ||
4 | + extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, | ||
5 | + hasProp = {}.hasOwnProperty; | ||
6 | + | ||
7 | + isPlainObject = require('./Utility').isPlainObject; | ||
8 | + | ||
9 | + XMLDOMImplementation = require('./XMLDOMImplementation'); | ||
10 | + | ||
11 | + XMLDOMConfiguration = require('./XMLDOMConfiguration'); | ||
12 | + | ||
13 | + XMLNode = require('./XMLNode'); | ||
14 | + | ||
15 | + NodeType = require('./NodeType'); | ||
16 | + | ||
17 | + XMLStringifier = require('./XMLStringifier'); | ||
18 | + | ||
19 | + XMLStringWriter = require('./XMLStringWriter'); | ||
20 | + | ||
21 | + module.exports = XMLDocument = (function(superClass) { | ||
22 | + extend(XMLDocument, superClass); | ||
23 | + | ||
24 | + function XMLDocument(options) { | ||
25 | + XMLDocument.__super__.constructor.call(this, null); | ||
26 | + this.name = "#document"; | ||
27 | + this.type = NodeType.Document; | ||
28 | + this.documentURI = null; | ||
29 | + this.domConfig = new XMLDOMConfiguration(); | ||
30 | + options || (options = {}); | ||
31 | + if (!options.writer) { | ||
32 | + options.writer = new XMLStringWriter(); | ||
33 | + } | ||
34 | + this.options = options; | ||
35 | + this.stringify = new XMLStringifier(options); | ||
36 | + } | ||
37 | + | ||
38 | + Object.defineProperty(XMLDocument.prototype, 'implementation', { | ||
39 | + value: new XMLDOMImplementation() | ||
40 | + }); | ||
41 | + | ||
42 | + Object.defineProperty(XMLDocument.prototype, 'doctype', { | ||
43 | + get: function() { | ||
44 | + var child, i, len, ref; | ||
45 | + ref = this.children; | ||
46 | + for (i = 0, len = ref.length; i < len; i++) { | ||
47 | + child = ref[i]; | ||
48 | + if (child.type === NodeType.DocType) { | ||
49 | + return child; | ||
50 | + } | ||
51 | + } | ||
52 | + return null; | ||
53 | + } | ||
54 | + }); | ||
55 | + | ||
56 | + Object.defineProperty(XMLDocument.prototype, 'documentElement', { | ||
57 | + get: function() { | ||
58 | + return this.rootObject || null; | ||
59 | + } | ||
60 | + }); | ||
61 | + | ||
62 | + Object.defineProperty(XMLDocument.prototype, 'inputEncoding', { | ||
63 | + get: function() { | ||
64 | + return null; | ||
65 | + } | ||
66 | + }); | ||
67 | + | ||
68 | + Object.defineProperty(XMLDocument.prototype, 'strictErrorChecking', { | ||
69 | + get: function() { | ||
70 | + return false; | ||
71 | + } | ||
72 | + }); | ||
73 | + | ||
74 | + Object.defineProperty(XMLDocument.prototype, 'xmlEncoding', { | ||
75 | + get: function() { | ||
76 | + if (this.children.length !== 0 && this.children[0].type === NodeType.Declaration) { | ||
77 | + return this.children[0].encoding; | ||
78 | + } else { | ||
79 | + return null; | ||
80 | + } | ||
81 | + } | ||
82 | + }); | ||
83 | + | ||
84 | + Object.defineProperty(XMLDocument.prototype, 'xmlStandalone', { | ||
85 | + get: function() { | ||
86 | + if (this.children.length !== 0 && this.children[0].type === NodeType.Declaration) { | ||
87 | + return this.children[0].standalone === 'yes'; | ||
88 | + } else { | ||
89 | + return false; | ||
90 | + } | ||
91 | + } | ||
92 | + }); | ||
93 | + | ||
94 | + Object.defineProperty(XMLDocument.prototype, 'xmlVersion', { | ||
95 | + get: function() { | ||
96 | + if (this.children.length !== 0 && this.children[0].type === NodeType.Declaration) { | ||
97 | + return this.children[0].version; | ||
98 | + } else { | ||
99 | + return "1.0"; | ||
100 | + } | ||
101 | + } | ||
102 | + }); | ||
103 | + | ||
104 | + Object.defineProperty(XMLDocument.prototype, 'URL', { | ||
105 | + get: function() { | ||
106 | + return this.documentURI; | ||
107 | + } | ||
108 | + }); | ||
109 | + | ||
110 | + Object.defineProperty(XMLDocument.prototype, 'origin', { | ||
111 | + get: function() { | ||
112 | + return null; | ||
113 | + } | ||
114 | + }); | ||
115 | + | ||
116 | + Object.defineProperty(XMLDocument.prototype, 'compatMode', { | ||
117 | + get: function() { | ||
118 | + return null; | ||
119 | + } | ||
120 | + }); | ||
121 | + | ||
122 | + Object.defineProperty(XMLDocument.prototype, 'characterSet', { | ||
123 | + get: function() { | ||
124 | + return null; | ||
125 | + } | ||
126 | + }); | ||
127 | + | ||
128 | + Object.defineProperty(XMLDocument.prototype, 'contentType', { | ||
129 | + get: function() { | ||
130 | + return null; | ||
131 | + } | ||
132 | + }); | ||
133 | + | ||
134 | + XMLDocument.prototype.end = function(writer) { | ||
135 | + var writerOptions; | ||
136 | + writerOptions = {}; | ||
137 | + if (!writer) { | ||
138 | + writer = this.options.writer; | ||
139 | + } else if (isPlainObject(writer)) { | ||
140 | + writerOptions = writer; | ||
141 | + writer = this.options.writer; | ||
142 | + } | ||
143 | + return writer.document(this, writer.filterOptions(writerOptions)); | ||
144 | + }; | ||
145 | + | ||
146 | + XMLDocument.prototype.toString = function(options) { | ||
147 | + return this.options.writer.document(this, this.options.writer.filterOptions(options)); | ||
148 | + }; | ||
149 | + | ||
150 | + XMLDocument.prototype.createElement = function(tagName) { | ||
151 | + throw new Error("This DOM method is not implemented." + this.debugInfo()); | ||
152 | + }; | ||
153 | + | ||
154 | + XMLDocument.prototype.createDocumentFragment = function() { | ||
155 | + throw new Error("This DOM method is not implemented." + this.debugInfo()); | ||
156 | + }; | ||
157 | + | ||
158 | + XMLDocument.prototype.createTextNode = function(data) { | ||
159 | + throw new Error("This DOM method is not implemented." + this.debugInfo()); | ||
160 | + }; | ||
161 | + | ||
162 | + XMLDocument.prototype.createComment = function(data) { | ||
163 | + throw new Error("This DOM method is not implemented." + this.debugInfo()); | ||
164 | + }; | ||
165 | + | ||
166 | + XMLDocument.prototype.createCDATASection = function(data) { | ||
167 | + throw new Error("This DOM method is not implemented." + this.debugInfo()); | ||
168 | + }; | ||
169 | + | ||
170 | + XMLDocument.prototype.createProcessingInstruction = function(target, data) { | ||
171 | + throw new Error("This DOM method is not implemented." + this.debugInfo()); | ||
172 | + }; | ||
173 | + | ||
174 | + XMLDocument.prototype.createAttribute = function(name) { | ||
175 | + throw new Error("This DOM method is not implemented." + this.debugInfo()); | ||
176 | + }; | ||
177 | + | ||
178 | + XMLDocument.prototype.createEntityReference = function(name) { | ||
179 | + throw new Error("This DOM method is not implemented." + this.debugInfo()); | ||
180 | + }; | ||
181 | + | ||
182 | + XMLDocument.prototype.getElementsByTagName = function(tagname) { | ||
183 | + throw new Error("This DOM method is not implemented." + this.debugInfo()); | ||
184 | + }; | ||
185 | + | ||
186 | + XMLDocument.prototype.importNode = function(importedNode, deep) { | ||
187 | + throw new Error("This DOM method is not implemented." + this.debugInfo()); | ||
188 | + }; | ||
189 | + | ||
190 | + XMLDocument.prototype.createElementNS = function(namespaceURI, qualifiedName) { | ||
191 | + throw new Error("This DOM method is not implemented." + this.debugInfo()); | ||
192 | + }; | ||
193 | + | ||
194 | + XMLDocument.prototype.createAttributeNS = function(namespaceURI, qualifiedName) { | ||
195 | + throw new Error("This DOM method is not implemented." + this.debugInfo()); | ||
196 | + }; | ||
197 | + | ||
198 | + XMLDocument.prototype.getElementsByTagNameNS = function(namespaceURI, localName) { | ||
199 | + throw new Error("This DOM method is not implemented." + this.debugInfo()); | ||
200 | + }; | ||
201 | + | ||
202 | + XMLDocument.prototype.getElementById = function(elementId) { | ||
203 | + throw new Error("This DOM method is not implemented." + this.debugInfo()); | ||
204 | + }; | ||
205 | + | ||
206 | + XMLDocument.prototype.adoptNode = function(source) { | ||
207 | + throw new Error("This DOM method is not implemented." + this.debugInfo()); | ||
208 | + }; | ||
209 | + | ||
210 | + XMLDocument.prototype.normalizeDocument = function() { | ||
211 | + throw new Error("This DOM method is not implemented." + this.debugInfo()); | ||
212 | + }; | ||
213 | + | ||
214 | + XMLDocument.prototype.renameNode = function(node, namespaceURI, qualifiedName) { | ||
215 | + throw new Error("This DOM method is not implemented." + this.debugInfo()); | ||
216 | + }; | ||
217 | + | ||
218 | + XMLDocument.prototype.getElementsByClassName = function(classNames) { | ||
219 | + throw new Error("This DOM method is not implemented." + this.debugInfo()); | ||
220 | + }; | ||
221 | + | ||
222 | + XMLDocument.prototype.createEvent = function(eventInterface) { | ||
223 | + throw new Error("This DOM method is not implemented." + this.debugInfo()); | ||
224 | + }; | ||
225 | + | ||
226 | + XMLDocument.prototype.createRange = function() { | ||
227 | + throw new Error("This DOM method is not implemented." + this.debugInfo()); | ||
228 | + }; | ||
229 | + | ||
230 | + XMLDocument.prototype.createNodeIterator = function(root, whatToShow, filter) { | ||
231 | + throw new Error("This DOM method is not implemented." + this.debugInfo()); | ||
232 | + }; | ||
233 | + | ||
234 | + XMLDocument.prototype.createTreeWalker = function(root, whatToShow, filter) { | ||
235 | + throw new Error("This DOM method is not implemented." + this.debugInfo()); | ||
236 | + }; | ||
237 | + | ||
238 | + return XMLDocument; | ||
239 | + | ||
240 | + })(XMLNode); | ||
241 | + | ||
242 | +}).call(this); |
node_modules/xmlbuilder/lib/XMLDocumentCB.js
0 → 100644
This diff is collapsed. Click to expand it.
1 | +// Generated by CoffeeScript 1.12.7 | ||
2 | +(function() { | ||
3 | + var NodeType, XMLDocumentFragment, XMLNode, | ||
4 | + extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, | ||
5 | + hasProp = {}.hasOwnProperty; | ||
6 | + | ||
7 | + XMLNode = require('./XMLNode'); | ||
8 | + | ||
9 | + NodeType = require('./NodeType'); | ||
10 | + | ||
11 | + module.exports = XMLDocumentFragment = (function(superClass) { | ||
12 | + extend(XMLDocumentFragment, superClass); | ||
13 | + | ||
14 | + function XMLDocumentFragment() { | ||
15 | + XMLDocumentFragment.__super__.constructor.call(this, null); | ||
16 | + this.name = "#document-fragment"; | ||
17 | + this.type = NodeType.DocumentFragment; | ||
18 | + } | ||
19 | + | ||
20 | + return XMLDocumentFragment; | ||
21 | + | ||
22 | + })(XMLNode); | ||
23 | + | ||
24 | +}).call(this); |
node_modules/xmlbuilder/lib/XMLDummy.js
0 → 100644
1 | +// Generated by CoffeeScript 1.12.7 | ||
2 | +(function() { | ||
3 | + var NodeType, XMLDummy, XMLNode, | ||
4 | + extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, | ||
5 | + hasProp = {}.hasOwnProperty; | ||
6 | + | ||
7 | + XMLNode = require('./XMLNode'); | ||
8 | + | ||
9 | + NodeType = require('./NodeType'); | ||
10 | + | ||
11 | + module.exports = XMLDummy = (function(superClass) { | ||
12 | + extend(XMLDummy, superClass); | ||
13 | + | ||
14 | + function XMLDummy(parent) { | ||
15 | + XMLDummy.__super__.constructor.call(this, parent); | ||
16 | + this.type = NodeType.Dummy; | ||
17 | + } | ||
18 | + | ||
19 | + XMLDummy.prototype.clone = function() { | ||
20 | + return Object.create(this); | ||
21 | + }; | ||
22 | + | ||
23 | + XMLDummy.prototype.toString = function(options) { | ||
24 | + return ''; | ||
25 | + }; | ||
26 | + | ||
27 | + return XMLDummy; | ||
28 | + | ||
29 | + })(XMLNode); | ||
30 | + | ||
31 | +}).call(this); |
node_modules/xmlbuilder/lib/XMLElement.js
0 → 100644
1 | +// Generated by CoffeeScript 1.12.7 | ||
2 | +(function() { | ||
3 | + var NodeType, XMLAttribute, XMLElement, XMLNamedNodeMap, XMLNode, getValue, isFunction, isObject, ref, | ||
4 | + extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, | ||
5 | + hasProp = {}.hasOwnProperty; | ||
6 | + | ||
7 | + ref = require('./Utility'), isObject = ref.isObject, isFunction = ref.isFunction, getValue = ref.getValue; | ||
8 | + | ||
9 | + XMLNode = require('./XMLNode'); | ||
10 | + | ||
11 | + NodeType = require('./NodeType'); | ||
12 | + | ||
13 | + XMLAttribute = require('./XMLAttribute'); | ||
14 | + | ||
15 | + XMLNamedNodeMap = require('./XMLNamedNodeMap'); | ||
16 | + | ||
17 | + module.exports = XMLElement = (function(superClass) { | ||
18 | + extend(XMLElement, superClass); | ||
19 | + | ||
20 | + function XMLElement(parent, name, attributes) { | ||
21 | + var child, j, len, ref1; | ||
22 | + XMLElement.__super__.constructor.call(this, parent); | ||
23 | + if (name == null) { | ||
24 | + throw new Error("Missing element name. " + this.debugInfo()); | ||
25 | + } | ||
26 | + this.name = this.stringify.name(name); | ||
27 | + this.type = NodeType.Element; | ||
28 | + this.attribs = {}; | ||
29 | + this.schemaTypeInfo = null; | ||
30 | + if (attributes != null) { | ||
31 | + this.attribute(attributes); | ||
32 | + } | ||
33 | + if (parent.type === NodeType.Document) { | ||
34 | + this.isRoot = true; | ||
35 | + this.documentObject = parent; | ||
36 | + parent.rootObject = this; | ||
37 | + if (parent.children) { | ||
38 | + ref1 = parent.children; | ||
39 | + for (j = 0, len = ref1.length; j < len; j++) { | ||
40 | + child = ref1[j]; | ||
41 | + if (child.type === NodeType.DocType) { | ||
42 | + child.name = this.name; | ||
43 | + break; | ||
44 | + } | ||
45 | + } | ||
46 | + } | ||
47 | + } | ||
48 | + } | ||
49 | + | ||
50 | + Object.defineProperty(XMLElement.prototype, 'tagName', { | ||
51 | + get: function() { | ||
52 | + return this.name; | ||
53 | + } | ||
54 | + }); | ||
55 | + | ||
56 | + Object.defineProperty(XMLElement.prototype, 'namespaceURI', { | ||
57 | + get: function() { | ||
58 | + return ''; | ||
59 | + } | ||
60 | + }); | ||
61 | + | ||
62 | + Object.defineProperty(XMLElement.prototype, 'prefix', { | ||
63 | + get: function() { | ||
64 | + return ''; | ||
65 | + } | ||
66 | + }); | ||
67 | + | ||
68 | + Object.defineProperty(XMLElement.prototype, 'localName', { | ||
69 | + get: function() { | ||
70 | + return this.name; | ||
71 | + } | ||
72 | + }); | ||
73 | + | ||
74 | + Object.defineProperty(XMLElement.prototype, 'id', { | ||
75 | + get: function() { | ||
76 | + throw new Error("This DOM method is not implemented." + this.debugInfo()); | ||
77 | + } | ||
78 | + }); | ||
79 | + | ||
80 | + Object.defineProperty(XMLElement.prototype, 'className', { | ||
81 | + get: function() { | ||
82 | + throw new Error("This DOM method is not implemented." + this.debugInfo()); | ||
83 | + } | ||
84 | + }); | ||
85 | + | ||
86 | + Object.defineProperty(XMLElement.prototype, 'classList', { | ||
87 | + get: function() { | ||
88 | + throw new Error("This DOM method is not implemented." + this.debugInfo()); | ||
89 | + } | ||
90 | + }); | ||
91 | + | ||
92 | + Object.defineProperty(XMLElement.prototype, 'attributes', { | ||
93 | + get: function() { | ||
94 | + if (!this.attributeMap || !this.attributeMap.nodes) { | ||
95 | + this.attributeMap = new XMLNamedNodeMap(this.attribs); | ||
96 | + } | ||
97 | + return this.attributeMap; | ||
98 | + } | ||
99 | + }); | ||
100 | + | ||
101 | + XMLElement.prototype.clone = function() { | ||
102 | + var att, attName, clonedSelf, ref1; | ||
103 | + clonedSelf = Object.create(this); | ||
104 | + if (clonedSelf.isRoot) { | ||
105 | + clonedSelf.documentObject = null; | ||
106 | + } | ||
107 | + clonedSelf.attribs = {}; | ||
108 | + ref1 = this.attribs; | ||
109 | + for (attName in ref1) { | ||
110 | + if (!hasProp.call(ref1, attName)) continue; | ||
111 | + att = ref1[attName]; | ||
112 | + clonedSelf.attribs[attName] = att.clone(); | ||
113 | + } | ||
114 | + clonedSelf.children = []; | ||
115 | + this.children.forEach(function(child) { | ||
116 | + var clonedChild; | ||
117 | + clonedChild = child.clone(); | ||
118 | + clonedChild.parent = clonedSelf; | ||
119 | + return clonedSelf.children.push(clonedChild); | ||
120 | + }); | ||
121 | + return clonedSelf; | ||
122 | + }; | ||
123 | + | ||
124 | + XMLElement.prototype.attribute = function(name, value) { | ||
125 | + var attName, attValue; | ||
126 | + if (name != null) { | ||
127 | + name = getValue(name); | ||
128 | + } | ||
129 | + if (isObject(name)) { | ||
130 | + for (attName in name) { | ||
131 | + if (!hasProp.call(name, attName)) continue; | ||
132 | + attValue = name[attName]; | ||
133 | + this.attribute(attName, attValue); | ||
134 | + } | ||
135 | + } else { | ||
136 | + if (isFunction(value)) { | ||
137 | + value = value.apply(); | ||
138 | + } | ||
139 | + if (this.options.keepNullAttributes && (value == null)) { | ||
140 | + this.attribs[name] = new XMLAttribute(this, name, ""); | ||
141 | + } else if (value != null) { | ||
142 | + this.attribs[name] = new XMLAttribute(this, name, value); | ||
143 | + } | ||
144 | + } | ||
145 | + return this; | ||
146 | + }; | ||
147 | + | ||
148 | + XMLElement.prototype.removeAttribute = function(name) { | ||
149 | + var attName, j, len; | ||
150 | + if (name == null) { | ||
151 | + throw new Error("Missing attribute name. " + this.debugInfo()); | ||
152 | + } | ||
153 | + name = getValue(name); | ||
154 | + if (Array.isArray(name)) { | ||
155 | + for (j = 0, len = name.length; j < len; j++) { | ||
156 | + attName = name[j]; | ||
157 | + delete this.attribs[attName]; | ||
158 | + } | ||
159 | + } else { | ||
160 | + delete this.attribs[name]; | ||
161 | + } | ||
162 | + return this; | ||
163 | + }; | ||
164 | + | ||
165 | + XMLElement.prototype.toString = function(options) { | ||
166 | + return this.options.writer.element(this, this.options.writer.filterOptions(options)); | ||
167 | + }; | ||
168 | + | ||
169 | + XMLElement.prototype.att = function(name, value) { | ||
170 | + return this.attribute(name, value); | ||
171 | + }; | ||
172 | + | ||
173 | + XMLElement.prototype.a = function(name, value) { | ||
174 | + return this.attribute(name, value); | ||
175 | + }; | ||
176 | + | ||
177 | + XMLElement.prototype.getAttribute = function(name) { | ||
178 | + if (this.attribs.hasOwnProperty(name)) { | ||
179 | + return this.attribs[name].value; | ||
180 | + } else { | ||
181 | + return null; | ||
182 | + } | ||
183 | + }; | ||
184 | + | ||
185 | + XMLElement.prototype.setAttribute = function(name, value) { | ||
186 | + throw new Error("This DOM method is not implemented." + this.debugInfo()); | ||
187 | + }; | ||
188 | + | ||
189 | + XMLElement.prototype.getAttributeNode = function(name) { | ||
190 | + if (this.attribs.hasOwnProperty(name)) { | ||
191 | + return this.attribs[name]; | ||
192 | + } else { | ||
193 | + return null; | ||
194 | + } | ||
195 | + }; | ||
196 | + | ||
197 | + XMLElement.prototype.setAttributeNode = function(newAttr) { | ||
198 | + throw new Error("This DOM method is not implemented." + this.debugInfo()); | ||
199 | + }; | ||
200 | + | ||
201 | + XMLElement.prototype.removeAttributeNode = function(oldAttr) { | ||
202 | + throw new Error("This DOM method is not implemented." + this.debugInfo()); | ||
203 | + }; | ||
204 | + | ||
205 | + XMLElement.prototype.getElementsByTagName = function(name) { | ||
206 | + throw new Error("This DOM method is not implemented." + this.debugInfo()); | ||
207 | + }; | ||
208 | + | ||
209 | + XMLElement.prototype.getAttributeNS = function(namespaceURI, localName) { | ||
210 | + throw new Error("This DOM method is not implemented." + this.debugInfo()); | ||
211 | + }; | ||
212 | + | ||
213 | + XMLElement.prototype.setAttributeNS = function(namespaceURI, qualifiedName, value) { | ||
214 | + throw new Error("This DOM method is not implemented." + this.debugInfo()); | ||
215 | + }; | ||
216 | + | ||
217 | + XMLElement.prototype.removeAttributeNS = function(namespaceURI, localName) { | ||
218 | + throw new Error("This DOM method is not implemented." + this.debugInfo()); | ||
219 | + }; | ||
220 | + | ||
221 | + XMLElement.prototype.getAttributeNodeNS = function(namespaceURI, localName) { | ||
222 | + throw new Error("This DOM method is not implemented." + this.debugInfo()); | ||
223 | + }; | ||
224 | + | ||
225 | + XMLElement.prototype.setAttributeNodeNS = function(newAttr) { | ||
226 | + throw new Error("This DOM method is not implemented." + this.debugInfo()); | ||
227 | + }; | ||
228 | + | ||
229 | + XMLElement.prototype.getElementsByTagNameNS = function(namespaceURI, localName) { | ||
230 | + throw new Error("This DOM method is not implemented." + this.debugInfo()); | ||
231 | + }; | ||
232 | + | ||
233 | + XMLElement.prototype.hasAttribute = function(name) { | ||
234 | + return this.attribs.hasOwnProperty(name); | ||
235 | + }; | ||
236 | + | ||
237 | + XMLElement.prototype.hasAttributeNS = function(namespaceURI, localName) { | ||
238 | + throw new Error("This DOM method is not implemented." + this.debugInfo()); | ||
239 | + }; | ||
240 | + | ||
241 | + XMLElement.prototype.setIdAttribute = function(name, isId) { | ||
242 | + if (this.attribs.hasOwnProperty(name)) { | ||
243 | + return this.attribs[name].isId; | ||
244 | + } else { | ||
245 | + return isId; | ||
246 | + } | ||
247 | + }; | ||
248 | + | ||
249 | + XMLElement.prototype.setIdAttributeNS = function(namespaceURI, localName, isId) { | ||
250 | + throw new Error("This DOM method is not implemented." + this.debugInfo()); | ||
251 | + }; | ||
252 | + | ||
253 | + XMLElement.prototype.setIdAttributeNode = function(idAttr, isId) { | ||
254 | + throw new Error("This DOM method is not implemented." + this.debugInfo()); | ||
255 | + }; | ||
256 | + | ||
257 | + XMLElement.prototype.getElementsByTagName = function(tagname) { | ||
258 | + throw new Error("This DOM method is not implemented." + this.debugInfo()); | ||
259 | + }; | ||
260 | + | ||
261 | + XMLElement.prototype.getElementsByTagNameNS = function(namespaceURI, localName) { | ||
262 | + throw new Error("This DOM method is not implemented." + this.debugInfo()); | ||
263 | + }; | ||
264 | + | ||
265 | + XMLElement.prototype.getElementsByClassName = function(classNames) { | ||
266 | + throw new Error("This DOM method is not implemented." + this.debugInfo()); | ||
267 | + }; | ||
268 | + | ||
269 | + XMLElement.prototype.isEqualNode = function(node) { | ||
270 | + var i, j, ref1; | ||
271 | + if (!XMLElement.__super__.isEqualNode.apply(this, arguments).isEqualNode(node)) { | ||
272 | + return false; | ||
273 | + } | ||
274 | + if (node.namespaceURI !== this.namespaceURI) { | ||
275 | + return false; | ||
276 | + } | ||
277 | + if (node.prefix !== this.prefix) { | ||
278 | + return false; | ||
279 | + } | ||
280 | + if (node.localName !== this.localName) { | ||
281 | + return false; | ||
282 | + } | ||
283 | + if (node.attribs.length !== this.attribs.length) { | ||
284 | + return false; | ||
285 | + } | ||
286 | + for (i = j = 0, ref1 = this.attribs.length - 1; 0 <= ref1 ? j <= ref1 : j >= ref1; i = 0 <= ref1 ? ++j : --j) { | ||
287 | + if (!this.attribs[i].isEqualNode(node.attribs[i])) { | ||
288 | + return false; | ||
289 | + } | ||
290 | + } | ||
291 | + return true; | ||
292 | + }; | ||
293 | + | ||
294 | + return XMLElement; | ||
295 | + | ||
296 | + })(XMLNode); | ||
297 | + | ||
298 | +}).call(this); |
1 | +// Generated by CoffeeScript 1.12.7 | ||
2 | +(function() { | ||
3 | + var XMLNamedNodeMap; | ||
4 | + | ||
5 | + module.exports = XMLNamedNodeMap = (function() { | ||
6 | + function XMLNamedNodeMap(nodes) { | ||
7 | + this.nodes = nodes; | ||
8 | + } | ||
9 | + | ||
10 | + Object.defineProperty(XMLNamedNodeMap.prototype, 'length', { | ||
11 | + get: function() { | ||
12 | + return Object.keys(this.nodes).length || 0; | ||
13 | + } | ||
14 | + }); | ||
15 | + | ||
16 | + XMLNamedNodeMap.prototype.clone = function() { | ||
17 | + return this.nodes = null; | ||
18 | + }; | ||
19 | + | ||
20 | + XMLNamedNodeMap.prototype.getNamedItem = function(name) { | ||
21 | + return this.nodes[name]; | ||
22 | + }; | ||
23 | + | ||
24 | + XMLNamedNodeMap.prototype.setNamedItem = function(node) { | ||
25 | + var oldNode; | ||
26 | + oldNode = this.nodes[node.nodeName]; | ||
27 | + this.nodes[node.nodeName] = node; | ||
28 | + return oldNode || null; | ||
29 | + }; | ||
30 | + | ||
31 | + XMLNamedNodeMap.prototype.removeNamedItem = function(name) { | ||
32 | + var oldNode; | ||
33 | + oldNode = this.nodes[name]; | ||
34 | + delete this.nodes[name]; | ||
35 | + return oldNode || null; | ||
36 | + }; | ||
37 | + | ||
38 | + XMLNamedNodeMap.prototype.item = function(index) { | ||
39 | + return this.nodes[Object.keys(this.nodes)[index]] || null; | ||
40 | + }; | ||
41 | + | ||
42 | + XMLNamedNodeMap.prototype.getNamedItemNS = function(namespaceURI, localName) { | ||
43 | + throw new Error("This DOM method is not implemented."); | ||
44 | + }; | ||
45 | + | ||
46 | + XMLNamedNodeMap.prototype.setNamedItemNS = function(node) { | ||
47 | + throw new Error("This DOM method is not implemented."); | ||
48 | + }; | ||
49 | + | ||
50 | + XMLNamedNodeMap.prototype.removeNamedItemNS = function(namespaceURI, localName) { | ||
51 | + throw new Error("This DOM method is not implemented."); | ||
52 | + }; | ||
53 | + | ||
54 | + return XMLNamedNodeMap; | ||
55 | + | ||
56 | + })(); | ||
57 | + | ||
58 | +}).call(this); |
node_modules/xmlbuilder/lib/XMLNode.js
0 → 100644
This diff is collapsed. Click to expand it.
node_modules/xmlbuilder/lib/XMLNodeFilter.js
0 → 100644
1 | +// Generated by CoffeeScript 1.12.7 | ||
2 | +(function() { | ||
3 | + var XMLNodeFilter; | ||
4 | + | ||
5 | + module.exports = XMLNodeFilter = (function() { | ||
6 | + function XMLNodeFilter() {} | ||
7 | + | ||
8 | + XMLNodeFilter.prototype.FilterAccept = 1; | ||
9 | + | ||
10 | + XMLNodeFilter.prototype.FilterReject = 2; | ||
11 | + | ||
12 | + XMLNodeFilter.prototype.FilterSkip = 3; | ||
13 | + | ||
14 | + XMLNodeFilter.prototype.ShowAll = 0xffffffff; | ||
15 | + | ||
16 | + XMLNodeFilter.prototype.ShowElement = 0x1; | ||
17 | + | ||
18 | + XMLNodeFilter.prototype.ShowAttribute = 0x2; | ||
19 | + | ||
20 | + XMLNodeFilter.prototype.ShowText = 0x4; | ||
21 | + | ||
22 | + XMLNodeFilter.prototype.ShowCDataSection = 0x8; | ||
23 | + | ||
24 | + XMLNodeFilter.prototype.ShowEntityReference = 0x10; | ||
25 | + | ||
26 | + XMLNodeFilter.prototype.ShowEntity = 0x20; | ||
27 | + | ||
28 | + XMLNodeFilter.prototype.ShowProcessingInstruction = 0x40; | ||
29 | + | ||
30 | + XMLNodeFilter.prototype.ShowComment = 0x80; | ||
31 | + | ||
32 | + XMLNodeFilter.prototype.ShowDocument = 0x100; | ||
33 | + | ||
34 | + XMLNodeFilter.prototype.ShowDocumentType = 0x200; | ||
35 | + | ||
36 | + XMLNodeFilter.prototype.ShowDocumentFragment = 0x400; | ||
37 | + | ||
38 | + XMLNodeFilter.prototype.ShowNotation = 0x800; | ||
39 | + | ||
40 | + XMLNodeFilter.prototype.acceptNode = function(node) { | ||
41 | + throw new Error("This DOM method is not implemented."); | ||
42 | + }; | ||
43 | + | ||
44 | + return XMLNodeFilter; | ||
45 | + | ||
46 | + })(); | ||
47 | + | ||
48 | +}).call(this); |
node_modules/xmlbuilder/lib/XMLNodeList.js
0 → 100644
1 | +// Generated by CoffeeScript 1.12.7 | ||
2 | +(function() { | ||
3 | + var XMLNodeList; | ||
4 | + | ||
5 | + module.exports = XMLNodeList = (function() { | ||
6 | + function XMLNodeList(nodes) { | ||
7 | + this.nodes = nodes; | ||
8 | + } | ||
9 | + | ||
10 | + Object.defineProperty(XMLNodeList.prototype, 'length', { | ||
11 | + get: function() { | ||
12 | + return this.nodes.length || 0; | ||
13 | + } | ||
14 | + }); | ||
15 | + | ||
16 | + XMLNodeList.prototype.clone = function() { | ||
17 | + return this.nodes = null; | ||
18 | + }; | ||
19 | + | ||
20 | + XMLNodeList.prototype.item = function(index) { | ||
21 | + return this.nodes[index] || null; | ||
22 | + }; | ||
23 | + | ||
24 | + return XMLNodeList; | ||
25 | + | ||
26 | + })(); | ||
27 | + | ||
28 | +}).call(this); |
1 | +// Generated by CoffeeScript 1.12.7 | ||
2 | +(function() { | ||
3 | + var NodeType, XMLCharacterData, XMLProcessingInstruction, | ||
4 | + extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, | ||
5 | + hasProp = {}.hasOwnProperty; | ||
6 | + | ||
7 | + NodeType = require('./NodeType'); | ||
8 | + | ||
9 | + XMLCharacterData = require('./XMLCharacterData'); | ||
10 | + | ||
11 | + module.exports = XMLProcessingInstruction = (function(superClass) { | ||
12 | + extend(XMLProcessingInstruction, superClass); | ||
13 | + | ||
14 | + function XMLProcessingInstruction(parent, target, value) { | ||
15 | + XMLProcessingInstruction.__super__.constructor.call(this, parent); | ||
16 | + if (target == null) { | ||
17 | + throw new Error("Missing instruction target. " + this.debugInfo()); | ||
18 | + } | ||
19 | + this.type = NodeType.ProcessingInstruction; | ||
20 | + this.target = this.stringify.insTarget(target); | ||
21 | + this.name = this.target; | ||
22 | + if (value) { | ||
23 | + this.value = this.stringify.insValue(value); | ||
24 | + } | ||
25 | + } | ||
26 | + | ||
27 | + XMLProcessingInstruction.prototype.clone = function() { | ||
28 | + return Object.create(this); | ||
29 | + }; | ||
30 | + | ||
31 | + XMLProcessingInstruction.prototype.toString = function(options) { | ||
32 | + return this.options.writer.processingInstruction(this, this.options.writer.filterOptions(options)); | ||
33 | + }; | ||
34 | + | ||
35 | + XMLProcessingInstruction.prototype.isEqualNode = function(node) { | ||
36 | + if (!XMLProcessingInstruction.__super__.isEqualNode.apply(this, arguments).isEqualNode(node)) { | ||
37 | + return false; | ||
38 | + } | ||
39 | + if (node.target !== this.target) { | ||
40 | + return false; | ||
41 | + } | ||
42 | + return true; | ||
43 | + }; | ||
44 | + | ||
45 | + return XMLProcessingInstruction; | ||
46 | + | ||
47 | + })(XMLCharacterData); | ||
48 | + | ||
49 | +}).call(this); |
node_modules/xmlbuilder/lib/XMLRaw.js
0 → 100644
1 | +// Generated by CoffeeScript 1.12.7 | ||
2 | +(function() { | ||
3 | + var NodeType, XMLNode, XMLRaw, | ||
4 | + extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, | ||
5 | + hasProp = {}.hasOwnProperty; | ||
6 | + | ||
7 | + NodeType = require('./NodeType'); | ||
8 | + | ||
9 | + XMLNode = require('./XMLNode'); | ||
10 | + | ||
11 | + module.exports = XMLRaw = (function(superClass) { | ||
12 | + extend(XMLRaw, superClass); | ||
13 | + | ||
14 | + function XMLRaw(parent, text) { | ||
15 | + XMLRaw.__super__.constructor.call(this, parent); | ||
16 | + if (text == null) { | ||
17 | + throw new Error("Missing raw text. " + this.debugInfo()); | ||
18 | + } | ||
19 | + this.type = NodeType.Raw; | ||
20 | + this.value = this.stringify.raw(text); | ||
21 | + } | ||
22 | + | ||
23 | + XMLRaw.prototype.clone = function() { | ||
24 | + return Object.create(this); | ||
25 | + }; | ||
26 | + | ||
27 | + XMLRaw.prototype.toString = function(options) { | ||
28 | + return this.options.writer.raw(this, this.options.writer.filterOptions(options)); | ||
29 | + }; | ||
30 | + | ||
31 | + return XMLRaw; | ||
32 | + | ||
33 | + })(XMLNode); | ||
34 | + | ||
35 | +}).call(this); |
1 | +// Generated by CoffeeScript 1.12.7 | ||
2 | +(function() { | ||
3 | + var NodeType, WriterState, XMLStreamWriter, XMLWriterBase, | ||
4 | + extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, | ||
5 | + hasProp = {}.hasOwnProperty; | ||
6 | + | ||
7 | + NodeType = require('./NodeType'); | ||
8 | + | ||
9 | + XMLWriterBase = require('./XMLWriterBase'); | ||
10 | + | ||
11 | + WriterState = require('./WriterState'); | ||
12 | + | ||
13 | + module.exports = XMLStreamWriter = (function(superClass) { | ||
14 | + extend(XMLStreamWriter, superClass); | ||
15 | + | ||
16 | + function XMLStreamWriter(stream, options) { | ||
17 | + this.stream = stream; | ||
18 | + XMLStreamWriter.__super__.constructor.call(this, options); | ||
19 | + } | ||
20 | + | ||
21 | + XMLStreamWriter.prototype.endline = function(node, options, level) { | ||
22 | + if (node.isLastRootNode && options.state === WriterState.CloseTag) { | ||
23 | + return ''; | ||
24 | + } else { | ||
25 | + return XMLStreamWriter.__super__.endline.call(this, node, options, level); | ||
26 | + } | ||
27 | + }; | ||
28 | + | ||
29 | + XMLStreamWriter.prototype.document = function(doc, options) { | ||
30 | + var child, i, j, k, len, len1, ref, ref1, results; | ||
31 | + ref = doc.children; | ||
32 | + for (i = j = 0, len = ref.length; j < len; i = ++j) { | ||
33 | + child = ref[i]; | ||
34 | + child.isLastRootNode = i === doc.children.length - 1; | ||
35 | + } | ||
36 | + options = this.filterOptions(options); | ||
37 | + ref1 = doc.children; | ||
38 | + results = []; | ||
39 | + for (k = 0, len1 = ref1.length; k < len1; k++) { | ||
40 | + child = ref1[k]; | ||
41 | + results.push(this.writeChildNode(child, options, 0)); | ||
42 | + } | ||
43 | + return results; | ||
44 | + }; | ||
45 | + | ||
46 | + XMLStreamWriter.prototype.attribute = function(att, options, level) { | ||
47 | + return this.stream.write(XMLStreamWriter.__super__.attribute.call(this, att, options, level)); | ||
48 | + }; | ||
49 | + | ||
50 | + XMLStreamWriter.prototype.cdata = function(node, options, level) { | ||
51 | + return this.stream.write(XMLStreamWriter.__super__.cdata.call(this, node, options, level)); | ||
52 | + }; | ||
53 | + | ||
54 | + XMLStreamWriter.prototype.comment = function(node, options, level) { | ||
55 | + return this.stream.write(XMLStreamWriter.__super__.comment.call(this, node, options, level)); | ||
56 | + }; | ||
57 | + | ||
58 | + XMLStreamWriter.prototype.declaration = function(node, options, level) { | ||
59 | + return this.stream.write(XMLStreamWriter.__super__.declaration.call(this, node, options, level)); | ||
60 | + }; | ||
61 | + | ||
62 | + XMLStreamWriter.prototype.docType = function(node, options, level) { | ||
63 | + var child, j, len, ref; | ||
64 | + level || (level = 0); | ||
65 | + this.openNode(node, options, level); | ||
66 | + options.state = WriterState.OpenTag; | ||
67 | + this.stream.write(this.indent(node, options, level)); | ||
68 | + this.stream.write('<!DOCTYPE ' + node.root().name); | ||
69 | + if (node.pubID && node.sysID) { | ||
70 | + this.stream.write(' PUBLIC "' + node.pubID + '" "' + node.sysID + '"'); | ||
71 | + } else if (node.sysID) { | ||
72 | + this.stream.write(' SYSTEM "' + node.sysID + '"'); | ||
73 | + } | ||
74 | + if (node.children.length > 0) { | ||
75 | + this.stream.write(' ['); | ||
76 | + this.stream.write(this.endline(node, options, level)); | ||
77 | + options.state = WriterState.InsideTag; | ||
78 | + ref = node.children; | ||
79 | + for (j = 0, len = ref.length; j < len; j++) { | ||
80 | + child = ref[j]; | ||
81 | + this.writeChildNode(child, options, level + 1); | ||
82 | + } | ||
83 | + options.state = WriterState.CloseTag; | ||
84 | + this.stream.write(']'); | ||
85 | + } | ||
86 | + options.state = WriterState.CloseTag; | ||
87 | + this.stream.write(options.spaceBeforeSlash + '>'); | ||
88 | + this.stream.write(this.endline(node, options, level)); | ||
89 | + options.state = WriterState.None; | ||
90 | + return this.closeNode(node, options, level); | ||
91 | + }; | ||
92 | + | ||
93 | + XMLStreamWriter.prototype.element = function(node, options, level) { | ||
94 | + var att, child, childNodeCount, firstChildNode, j, len, name, prettySuppressed, ref, ref1; | ||
95 | + level || (level = 0); | ||
96 | + this.openNode(node, options, level); | ||
97 | + options.state = WriterState.OpenTag; | ||
98 | + this.stream.write(this.indent(node, options, level) + '<' + node.name); | ||
99 | + ref = node.attribs; | ||
100 | + for (name in ref) { | ||
101 | + if (!hasProp.call(ref, name)) continue; | ||
102 | + att = ref[name]; | ||
103 | + this.attribute(att, options, level); | ||
104 | + } | ||
105 | + childNodeCount = node.children.length; | ||
106 | + firstChildNode = childNodeCount === 0 ? null : node.children[0]; | ||
107 | + if (childNodeCount === 0 || node.children.every(function(e) { | ||
108 | + return (e.type === NodeType.Text || e.type === NodeType.Raw) && e.value === ''; | ||
109 | + })) { | ||
110 | + if (options.allowEmpty) { | ||
111 | + this.stream.write('>'); | ||
112 | + options.state = WriterState.CloseTag; | ||
113 | + this.stream.write('</' + node.name + '>'); | ||
114 | + } else { | ||
115 | + options.state = WriterState.CloseTag; | ||
116 | + this.stream.write(options.spaceBeforeSlash + '/>'); | ||
117 | + } | ||
118 | + } else if (options.pretty && childNodeCount === 1 && (firstChildNode.type === NodeType.Text || firstChildNode.type === NodeType.Raw) && (firstChildNode.value != null)) { | ||
119 | + this.stream.write('>'); | ||
120 | + options.state = WriterState.InsideTag; | ||
121 | + options.suppressPrettyCount++; | ||
122 | + prettySuppressed = true; | ||
123 | + this.writeChildNode(firstChildNode, options, level + 1); | ||
124 | + options.suppressPrettyCount--; | ||
125 | + prettySuppressed = false; | ||
126 | + options.state = WriterState.CloseTag; | ||
127 | + this.stream.write('</' + node.name + '>'); | ||
128 | + } else { | ||
129 | + this.stream.write('>' + this.endline(node, options, level)); | ||
130 | + options.state = WriterState.InsideTag; | ||
131 | + ref1 = node.children; | ||
132 | + for (j = 0, len = ref1.length; j < len; j++) { | ||
133 | + child = ref1[j]; | ||
134 | + this.writeChildNode(child, options, level + 1); | ||
135 | + } | ||
136 | + options.state = WriterState.CloseTag; | ||
137 | + this.stream.write(this.indent(node, options, level) + '</' + node.name + '>'); | ||
138 | + } | ||
139 | + this.stream.write(this.endline(node, options, level)); | ||
140 | + options.state = WriterState.None; | ||
141 | + return this.closeNode(node, options, level); | ||
142 | + }; | ||
143 | + | ||
144 | + XMLStreamWriter.prototype.processingInstruction = function(node, options, level) { | ||
145 | + return this.stream.write(XMLStreamWriter.__super__.processingInstruction.call(this, node, options, level)); | ||
146 | + }; | ||
147 | + | ||
148 | + XMLStreamWriter.prototype.raw = function(node, options, level) { | ||
149 | + return this.stream.write(XMLStreamWriter.__super__.raw.call(this, node, options, level)); | ||
150 | + }; | ||
151 | + | ||
152 | + XMLStreamWriter.prototype.text = function(node, options, level) { | ||
153 | + return this.stream.write(XMLStreamWriter.__super__.text.call(this, node, options, level)); | ||
154 | + }; | ||
155 | + | ||
156 | + XMLStreamWriter.prototype.dtdAttList = function(node, options, level) { | ||
157 | + return this.stream.write(XMLStreamWriter.__super__.dtdAttList.call(this, node, options, level)); | ||
158 | + }; | ||
159 | + | ||
160 | + XMLStreamWriter.prototype.dtdElement = function(node, options, level) { | ||
161 | + return this.stream.write(XMLStreamWriter.__super__.dtdElement.call(this, node, options, level)); | ||
162 | + }; | ||
163 | + | ||
164 | + XMLStreamWriter.prototype.dtdEntity = function(node, options, level) { | ||
165 | + return this.stream.write(XMLStreamWriter.__super__.dtdEntity.call(this, node, options, level)); | ||
166 | + }; | ||
167 | + | ||
168 | + XMLStreamWriter.prototype.dtdNotation = function(node, options, level) { | ||
169 | + return this.stream.write(XMLStreamWriter.__super__.dtdNotation.call(this, node, options, level)); | ||
170 | + }; | ||
171 | + | ||
172 | + return XMLStreamWriter; | ||
173 | + | ||
174 | + })(XMLWriterBase); | ||
175 | + | ||
176 | +}).call(this); |
1 | +// Generated by CoffeeScript 1.12.7 | ||
2 | +(function() { | ||
3 | + var XMLStringWriter, XMLWriterBase, | ||
4 | + extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, | ||
5 | + hasProp = {}.hasOwnProperty; | ||
6 | + | ||
7 | + XMLWriterBase = require('./XMLWriterBase'); | ||
8 | + | ||
9 | + module.exports = XMLStringWriter = (function(superClass) { | ||
10 | + extend(XMLStringWriter, superClass); | ||
11 | + | ||
12 | + function XMLStringWriter(options) { | ||
13 | + XMLStringWriter.__super__.constructor.call(this, options); | ||
14 | + } | ||
15 | + | ||
16 | + XMLStringWriter.prototype.document = function(doc, options) { | ||
17 | + var child, i, len, r, ref; | ||
18 | + options = this.filterOptions(options); | ||
19 | + r = ''; | ||
20 | + ref = doc.children; | ||
21 | + for (i = 0, len = ref.length; i < len; i++) { | ||
22 | + child = ref[i]; | ||
23 | + r += this.writeChildNode(child, options, 0); | ||
24 | + } | ||
25 | + if (options.pretty && r.slice(-options.newline.length) === options.newline) { | ||
26 | + r = r.slice(0, -options.newline.length); | ||
27 | + } | ||
28 | + return r; | ||
29 | + }; | ||
30 | + | ||
31 | + return XMLStringWriter; | ||
32 | + | ||
33 | + })(XMLWriterBase); | ||
34 | + | ||
35 | +}).call(this); |
1 | +// Generated by CoffeeScript 1.12.7 | ||
2 | +(function() { | ||
3 | + var XMLStringifier, | ||
4 | + bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }, | ||
5 | + hasProp = {}.hasOwnProperty; | ||
6 | + | ||
7 | + module.exports = XMLStringifier = (function() { | ||
8 | + function XMLStringifier(options) { | ||
9 | + this.assertLegalName = bind(this.assertLegalName, this); | ||
10 | + this.assertLegalChar = bind(this.assertLegalChar, this); | ||
11 | + var key, ref, value; | ||
12 | + options || (options = {}); | ||
13 | + this.options = options; | ||
14 | + if (!this.options.version) { | ||
15 | + this.options.version = '1.0'; | ||
16 | + } | ||
17 | + ref = options.stringify || {}; | ||
18 | + for (key in ref) { | ||
19 | + if (!hasProp.call(ref, key)) continue; | ||
20 | + value = ref[key]; | ||
21 | + this[key] = value; | ||
22 | + } | ||
23 | + } | ||
24 | + | ||
25 | + XMLStringifier.prototype.name = function(val) { | ||
26 | + if (this.options.noValidation) { | ||
27 | + return val; | ||
28 | + } | ||
29 | + return this.assertLegalName('' + val || ''); | ||
30 | + }; | ||
31 | + | ||
32 | + XMLStringifier.prototype.text = function(val) { | ||
33 | + if (this.options.noValidation) { | ||
34 | + return val; | ||
35 | + } | ||
36 | + return this.assertLegalChar(this.textEscape('' + val || '')); | ||
37 | + }; | ||
38 | + | ||
39 | + XMLStringifier.prototype.cdata = function(val) { | ||
40 | + if (this.options.noValidation) { | ||
41 | + return val; | ||
42 | + } | ||
43 | + val = '' + val || ''; | ||
44 | + val = val.replace(']]>', ']]]]><![CDATA[>'); | ||
45 | + return this.assertLegalChar(val); | ||
46 | + }; | ||
47 | + | ||
48 | + XMLStringifier.prototype.comment = function(val) { | ||
49 | + if (this.options.noValidation) { | ||
50 | + return val; | ||
51 | + } | ||
52 | + val = '' + val || ''; | ||
53 | + if (val.match(/--/)) { | ||
54 | + throw new Error("Comment text cannot contain double-hypen: " + val); | ||
55 | + } | ||
56 | + return this.assertLegalChar(val); | ||
57 | + }; | ||
58 | + | ||
59 | + XMLStringifier.prototype.raw = function(val) { | ||
60 | + if (this.options.noValidation) { | ||
61 | + return val; | ||
62 | + } | ||
63 | + return '' + val || ''; | ||
64 | + }; | ||
65 | + | ||
66 | + XMLStringifier.prototype.attValue = function(val) { | ||
67 | + if (this.options.noValidation) { | ||
68 | + return val; | ||
69 | + } | ||
70 | + return this.assertLegalChar(this.attEscape(val = '' + val || '')); | ||
71 | + }; | ||
72 | + | ||
73 | + XMLStringifier.prototype.insTarget = function(val) { | ||
74 | + if (this.options.noValidation) { | ||
75 | + return val; | ||
76 | + } | ||
77 | + return this.assertLegalChar('' + val || ''); | ||
78 | + }; | ||
79 | + | ||
80 | + XMLStringifier.prototype.insValue = function(val) { | ||
81 | + if (this.options.noValidation) { | ||
82 | + return val; | ||
83 | + } | ||
84 | + val = '' + val || ''; | ||
85 | + if (val.match(/\?>/)) { | ||
86 | + throw new Error("Invalid processing instruction value: " + val); | ||
87 | + } | ||
88 | + return this.assertLegalChar(val); | ||
89 | + }; | ||
90 | + | ||
91 | + XMLStringifier.prototype.xmlVersion = function(val) { | ||
92 | + if (this.options.noValidation) { | ||
93 | + return val; | ||
94 | + } | ||
95 | + val = '' + val || ''; | ||
96 | + if (!val.match(/1\.[0-9]+/)) { | ||
97 | + throw new Error("Invalid version number: " + val); | ||
98 | + } | ||
99 | + return val; | ||
100 | + }; | ||
101 | + | ||
102 | + XMLStringifier.prototype.xmlEncoding = function(val) { | ||
103 | + if (this.options.noValidation) { | ||
104 | + return val; | ||
105 | + } | ||
106 | + val = '' + val || ''; | ||
107 | + if (!val.match(/^[A-Za-z](?:[A-Za-z0-9._-])*$/)) { | ||
108 | + throw new Error("Invalid encoding: " + val); | ||
109 | + } | ||
110 | + return this.assertLegalChar(val); | ||
111 | + }; | ||
112 | + | ||
113 | + XMLStringifier.prototype.xmlStandalone = function(val) { | ||
114 | + if (this.options.noValidation) { | ||
115 | + return val; | ||
116 | + } | ||
117 | + if (val) { | ||
118 | + return "yes"; | ||
119 | + } else { | ||
120 | + return "no"; | ||
121 | + } | ||
122 | + }; | ||
123 | + | ||
124 | + XMLStringifier.prototype.dtdPubID = function(val) { | ||
125 | + if (this.options.noValidation) { | ||
126 | + return val; | ||
127 | + } | ||
128 | + return this.assertLegalChar('' + val || ''); | ||
129 | + }; | ||
130 | + | ||
131 | + XMLStringifier.prototype.dtdSysID = function(val) { | ||
132 | + if (this.options.noValidation) { | ||
133 | + return val; | ||
134 | + } | ||
135 | + return this.assertLegalChar('' + val || ''); | ||
136 | + }; | ||
137 | + | ||
138 | + XMLStringifier.prototype.dtdElementValue = function(val) { | ||
139 | + if (this.options.noValidation) { | ||
140 | + return val; | ||
141 | + } | ||
142 | + return this.assertLegalChar('' + val || ''); | ||
143 | + }; | ||
144 | + | ||
145 | + XMLStringifier.prototype.dtdAttType = function(val) { | ||
146 | + if (this.options.noValidation) { | ||
147 | + return val; | ||
148 | + } | ||
149 | + return this.assertLegalChar('' + val || ''); | ||
150 | + }; | ||
151 | + | ||
152 | + XMLStringifier.prototype.dtdAttDefault = function(val) { | ||
153 | + if (this.options.noValidation) { | ||
154 | + return val; | ||
155 | + } | ||
156 | + return this.assertLegalChar('' + val || ''); | ||
157 | + }; | ||
158 | + | ||
159 | + XMLStringifier.prototype.dtdEntityValue = function(val) { | ||
160 | + if (this.options.noValidation) { | ||
161 | + return val; | ||
162 | + } | ||
163 | + return this.assertLegalChar('' + val || ''); | ||
164 | + }; | ||
165 | + | ||
166 | + XMLStringifier.prototype.dtdNData = function(val) { | ||
167 | + if (this.options.noValidation) { | ||
168 | + return val; | ||
169 | + } | ||
170 | + return this.assertLegalChar('' + val || ''); | ||
171 | + }; | ||
172 | + | ||
173 | + XMLStringifier.prototype.convertAttKey = '@'; | ||
174 | + | ||
175 | + XMLStringifier.prototype.convertPIKey = '?'; | ||
176 | + | ||
177 | + XMLStringifier.prototype.convertTextKey = '#text'; | ||
178 | + | ||
179 | + XMLStringifier.prototype.convertCDataKey = '#cdata'; | ||
180 | + | ||
181 | + XMLStringifier.prototype.convertCommentKey = '#comment'; | ||
182 | + | ||
183 | + XMLStringifier.prototype.convertRawKey = '#raw'; | ||
184 | + | ||
185 | + XMLStringifier.prototype.assertLegalChar = function(str) { | ||
186 | + var regex, res; | ||
187 | + if (this.options.noValidation) { | ||
188 | + return str; | ||
189 | + } | ||
190 | + regex = ''; | ||
191 | + if (this.options.version === '1.0') { | ||
192 | + regex = /[\0-\x08\x0B\f\x0E-\x1F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/; | ||
193 | + if (res = str.match(regex)) { | ||
194 | + throw new Error("Invalid character in string: " + str + " at index " + res.index); | ||
195 | + } | ||
196 | + } else if (this.options.version === '1.1') { | ||
197 | + regex = /[\0\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/; | ||
198 | + if (res = str.match(regex)) { | ||
199 | + throw new Error("Invalid character in string: " + str + " at index " + res.index); | ||
200 | + } | ||
201 | + } | ||
202 | + return str; | ||
203 | + }; | ||
204 | + | ||
205 | + XMLStringifier.prototype.assertLegalName = function(str) { | ||
206 | + var regex; | ||
207 | + if (this.options.noValidation) { | ||
208 | + return str; | ||
209 | + } | ||
210 | + this.assertLegalChar(str); | ||
211 | + regex = /^([:A-Z_a-z\xC0-\xD6\xD8-\xF6\xF8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])([\x2D\.0-:A-Z_a-z\xB7\xC0-\xD6\xD8-\xF6\xF8-\u037D\u037F-\u1FFF\u200C\u200D\u203F\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])*$/; | ||
212 | + if (!str.match(regex)) { | ||
213 | + throw new Error("Invalid character in name"); | ||
214 | + } | ||
215 | + return str; | ||
216 | + }; | ||
217 | + | ||
218 | + XMLStringifier.prototype.textEscape = function(str) { | ||
219 | + var ampregex; | ||
220 | + if (this.options.noValidation) { | ||
221 | + return str; | ||
222 | + } | ||
223 | + ampregex = this.options.noDoubleEncoding ? /(?!&\S+;)&/g : /&/g; | ||
224 | + return str.replace(ampregex, '&').replace(/</g, '<').replace(/>/g, '>').replace(/\r/g, '
'); | ||
225 | + }; | ||
226 | + | ||
227 | + XMLStringifier.prototype.attEscape = function(str) { | ||
228 | + var ampregex; | ||
229 | + if (this.options.noValidation) { | ||
230 | + return str; | ||
231 | + } | ||
232 | + ampregex = this.options.noDoubleEncoding ? /(?!&\S+;)&/g : /&/g; | ||
233 | + return str.replace(ampregex, '&').replace(/</g, '<').replace(/"/g, '"').replace(/\t/g, '	').replace(/\n/g, '
').replace(/\r/g, '
'); | ||
234 | + }; | ||
235 | + | ||
236 | + return XMLStringifier; | ||
237 | + | ||
238 | + })(); | ||
239 | + | ||
240 | +}).call(this); |
node_modules/xmlbuilder/lib/XMLText.js
0 → 100644
1 | +// Generated by CoffeeScript 1.12.7 | ||
2 | +(function() { | ||
3 | + var NodeType, XMLCharacterData, XMLText, | ||
4 | + extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, | ||
5 | + hasProp = {}.hasOwnProperty; | ||
6 | + | ||
7 | + NodeType = require('./NodeType'); | ||
8 | + | ||
9 | + XMLCharacterData = require('./XMLCharacterData'); | ||
10 | + | ||
11 | + module.exports = XMLText = (function(superClass) { | ||
12 | + extend(XMLText, superClass); | ||
13 | + | ||
14 | + function XMLText(parent, text) { | ||
15 | + XMLText.__super__.constructor.call(this, parent); | ||
16 | + if (text == null) { | ||
17 | + throw new Error("Missing element text. " + this.debugInfo()); | ||
18 | + } | ||
19 | + this.name = "#text"; | ||
20 | + this.type = NodeType.Text; | ||
21 | + this.value = this.stringify.text(text); | ||
22 | + } | ||
23 | + | ||
24 | + Object.defineProperty(XMLText.prototype, 'isElementContentWhitespace', { | ||
25 | + get: function() { | ||
26 | + throw new Error("This DOM method is not implemented." + this.debugInfo()); | ||
27 | + } | ||
28 | + }); | ||
29 | + | ||
30 | + Object.defineProperty(XMLText.prototype, 'wholeText', { | ||
31 | + get: function() { | ||
32 | + var next, prev, str; | ||
33 | + str = ''; | ||
34 | + prev = this.previousSibling; | ||
35 | + while (prev) { | ||
36 | + str = prev.data + str; | ||
37 | + prev = prev.previousSibling; | ||
38 | + } | ||
39 | + str += this.data; | ||
40 | + next = this.nextSibling; | ||
41 | + while (next) { | ||
42 | + str = str + next.data; | ||
43 | + next = next.nextSibling; | ||
44 | + } | ||
45 | + return str; | ||
46 | + } | ||
47 | + }); | ||
48 | + | ||
49 | + XMLText.prototype.clone = function() { | ||
50 | + return Object.create(this); | ||
51 | + }; | ||
52 | + | ||
53 | + XMLText.prototype.toString = function(options) { | ||
54 | + return this.options.writer.text(this, this.options.writer.filterOptions(options)); | ||
55 | + }; | ||
56 | + | ||
57 | + XMLText.prototype.splitText = function(offset) { | ||
58 | + throw new Error("This DOM method is not implemented." + this.debugInfo()); | ||
59 | + }; | ||
60 | + | ||
61 | + XMLText.prototype.replaceWholeText = function(content) { | ||
62 | + throw new Error("This DOM method is not implemented." + this.debugInfo()); | ||
63 | + }; | ||
64 | + | ||
65 | + return XMLText; | ||
66 | + | ||
67 | + })(XMLCharacterData); | ||
68 | + | ||
69 | +}).call(this); |
node_modules/xmlbuilder/lib/XMLTypeInfo.js
0 → 100644
1 | +// Generated by CoffeeScript 1.12.7 | ||
2 | +(function() { | ||
3 | + var Derivation, XMLTypeInfo; | ||
4 | + | ||
5 | + Derivation = require('./Derivation'); | ||
6 | + | ||
7 | + module.exports = XMLTypeInfo = (function() { | ||
8 | + function XMLTypeInfo(typeName, typeNamespace) { | ||
9 | + this.typeName = typeName; | ||
10 | + this.typeNamespace = typeNamespace; | ||
11 | + } | ||
12 | + | ||
13 | + XMLTypeInfo.prototype.isDerivedFrom = function(typeNamespaceArg, typeNameArg, derivationMethod) { | ||
14 | + throw new Error("This DOM method is not implemented."); | ||
15 | + }; | ||
16 | + | ||
17 | + return XMLTypeInfo; | ||
18 | + | ||
19 | + })(); | ||
20 | + | ||
21 | +}).call(this); |
1 | +// Generated by CoffeeScript 1.12.7 | ||
2 | +(function() { | ||
3 | + var OperationType, XMLUserDataHandler; | ||
4 | + | ||
5 | + OperationType = require('./OperationType'); | ||
6 | + | ||
7 | + module.exports = XMLUserDataHandler = (function() { | ||
8 | + function XMLUserDataHandler() {} | ||
9 | + | ||
10 | + XMLUserDataHandler.prototype.handle = function(operation, key, data, src, dst) {}; | ||
11 | + | ||
12 | + return XMLUserDataHandler; | ||
13 | + | ||
14 | + })(); | ||
15 | + | ||
16 | +}).call(this); |
node_modules/xmlbuilder/lib/XMLWriterBase.js
0 → 100644
This diff is collapsed. Click to expand it.
node_modules/xmlbuilder/lib/index.js
0 → 100644
1 | +// Generated by CoffeeScript 1.12.7 | ||
2 | +(function() { | ||
3 | + var NodeType, WriterState, XMLDOMImplementation, XMLDocument, XMLDocumentCB, XMLStreamWriter, XMLStringWriter, assign, isFunction, ref; | ||
4 | + | ||
5 | + ref = require('./Utility'), assign = ref.assign, isFunction = ref.isFunction; | ||
6 | + | ||
7 | + XMLDOMImplementation = require('./XMLDOMImplementation'); | ||
8 | + | ||
9 | + XMLDocument = require('./XMLDocument'); | ||
10 | + | ||
11 | + XMLDocumentCB = require('./XMLDocumentCB'); | ||
12 | + | ||
13 | + XMLStringWriter = require('./XMLStringWriter'); | ||
14 | + | ||
15 | + XMLStreamWriter = require('./XMLStreamWriter'); | ||
16 | + | ||
17 | + NodeType = require('./NodeType'); | ||
18 | + | ||
19 | + WriterState = require('./WriterState'); | ||
20 | + | ||
21 | + module.exports.create = function(name, xmldec, doctype, options) { | ||
22 | + var doc, root; | ||
23 | + if (name == null) { | ||
24 | + throw new Error("Root element needs a name."); | ||
25 | + } | ||
26 | + options = assign({}, xmldec, doctype, options); | ||
27 | + doc = new XMLDocument(options); | ||
28 | + root = doc.element(name); | ||
29 | + if (!options.headless) { | ||
30 | + doc.declaration(options); | ||
31 | + if ((options.pubID != null) || (options.sysID != null)) { | ||
32 | + doc.dtd(options); | ||
33 | + } | ||
34 | + } | ||
35 | + return root; | ||
36 | + }; | ||
37 | + | ||
38 | + module.exports.begin = function(options, onData, onEnd) { | ||
39 | + var ref1; | ||
40 | + if (isFunction(options)) { | ||
41 | + ref1 = [options, onData], onData = ref1[0], onEnd = ref1[1]; | ||
42 | + options = {}; | ||
43 | + } | ||
44 | + if (onData) { | ||
45 | + return new XMLDocumentCB(options, onData, onEnd); | ||
46 | + } else { | ||
47 | + return new XMLDocument(options); | ||
48 | + } | ||
49 | + }; | ||
50 | + | ||
51 | + module.exports.stringWriter = function(options) { | ||
52 | + return new XMLStringWriter(options); | ||
53 | + }; | ||
54 | + | ||
55 | + module.exports.streamWriter = function(stream, options) { | ||
56 | + return new XMLStreamWriter(stream, options); | ||
57 | + }; | ||
58 | + | ||
59 | + module.exports.implementation = new XMLDOMImplementation(); | ||
60 | + | ||
61 | + module.exports.nodeType = NodeType; | ||
62 | + | ||
63 | + module.exports.writerState = WriterState; | ||
64 | + | ||
65 | +}).call(this); |
node_modules/xmlbuilder/package.json
0 → 100644
1 | +{ | ||
2 | + "name": "xmlbuilder", | ||
3 | + "version": "11.0.1", | ||
4 | + "keywords": [ | ||
5 | + "xml", | ||
6 | + "xmlbuilder" | ||
7 | + ], | ||
8 | + "homepage": "http://github.com/oozcitak/xmlbuilder-js", | ||
9 | + "description": "An XML builder for node.js", | ||
10 | + "author": "Ozgur Ozcitak <oozcitak@gmail.com>", | ||
11 | + "contributors": [], | ||
12 | + "license": "MIT", | ||
13 | + "repository": { | ||
14 | + "type": "git", | ||
15 | + "url": "git://github.com/oozcitak/xmlbuilder-js.git" | ||
16 | + }, | ||
17 | + "bugs": { | ||
18 | + "url": "http://github.com/oozcitak/xmlbuilder-js/issues" | ||
19 | + }, | ||
20 | + "main": "./lib/index", | ||
21 | + "typings": "./typings/index.d.ts", | ||
22 | + "engines": { | ||
23 | + "node": ">=4.0" | ||
24 | + }, | ||
25 | + "dependencies": {}, | ||
26 | + "devDependencies": { | ||
27 | + "coffeescript": "1.*", | ||
28 | + "mocha": "*", | ||
29 | + "coffee-coverage": "2.*", | ||
30 | + "istanbul": "*", | ||
31 | + "coveralls": "*", | ||
32 | + "xpath": "*" | ||
33 | + }, | ||
34 | + "scripts": { | ||
35 | + "prepublishOnly": "coffee -co lib src", | ||
36 | + "postpublish": "rm -rf lib", | ||
37 | + "test": "mocha \"test/**/*.coffee\" && istanbul report text lcov" | ||
38 | + } | ||
39 | +} |
node_modules/xmlbuilder/typings/index.d.ts
0 → 100644
1 | +// Type definitions for xmlbuilder | ||
2 | +// Project: https://github.com/oozcitak/xmlbuilder-js | ||
3 | +// Definitions by: Wallymathieu <https://github.com/wallymathieu> | ||
4 | +// : GaikwadPratik <https://github.com/GaikwadPratik> | ||
5 | +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped | ||
6 | + | ||
7 | +export = xmlbuilder; | ||
8 | + | ||
9 | +declare namespace xmlbuilder { | ||
10 | + | ||
11 | + class XMLDocType { | ||
12 | + clone(): XMLDocType; | ||
13 | + element(name: string, value?: Object): XMLDocType; | ||
14 | + attList(elementName: string, attributeName: string, attributeType: string, defaultValueType?: string, defaultValue?: any): XMLDocType; | ||
15 | + entity(name: string, value: any): XMLDocType; | ||
16 | + pEntity(name: string, value: any): XMLDocType; | ||
17 | + notation(name: string, value: any): XMLDocType; | ||
18 | + cdata(value: string): XMLDocType; | ||
19 | + comment(value: string): XMLDocType; | ||
20 | + instruction(target: string, value: any): XMLDocType; | ||
21 | + root(): XMLDocType; | ||
22 | + document(): any; | ||
23 | + toString(options?: XMLToStringOptions, level?: Number): string; | ||
24 | + | ||
25 | + ele(name: string, value?: Object): XMLDocType; | ||
26 | + att(elementName: string, attributeName: string, attributeType: string, defaultValueType?: string, defaultValue?: any): XMLDocType; | ||
27 | + ent(name: string, value: any): XMLDocType; | ||
28 | + pent(name: string, value: any): XMLDocType; | ||
29 | + not(name: string, value: any): XMLDocType; | ||
30 | + dat(value: string): XMLDocType; | ||
31 | + com(value: string): XMLDocType; | ||
32 | + ins(target: string, value: any): XMLDocType; | ||
33 | + up(): XMLDocType; | ||
34 | + doc(): any; | ||
35 | + } | ||
36 | + | ||
37 | + class XMLElementOrXMLNode { | ||
38 | + // XMLElement: | ||
39 | + clone(): XMLElementOrXMLNode; | ||
40 | + attribute(name: any, value?: any): XMLElementOrXMLNode; | ||
41 | + att(name: any, value?: any): XMLElementOrXMLNode; | ||
42 | + removeAttribute(name: string): XMLElementOrXMLNode; | ||
43 | + instruction(target: string, value: any): XMLElementOrXMLNode; | ||
44 | + instruction(array: Array<any>): XMLElementOrXMLNode; | ||
45 | + instruction(obj: Object): XMLElementOrXMLNode; | ||
46 | + ins(target: string, value: any): XMLElementOrXMLNode; | ||
47 | + ins(array: Array<any>): XMLElementOrXMLNode; | ||
48 | + ins(obj: Object): XMLElementOrXMLNode; | ||
49 | + a(name: any, value?: any): XMLElementOrXMLNode; | ||
50 | + i(target: string, value: any): XMLElementOrXMLNode; | ||
51 | + i(array: Array<any>): XMLElementOrXMLNode; | ||
52 | + i(obj: Object): XMLElementOrXMLNode; | ||
53 | + toString(options?: XMLToStringOptions, level?: Number): string; | ||
54 | + // XMLNode: | ||
55 | + element(name: any, attributes?: Object, text?: any): XMLElementOrXMLNode; | ||
56 | + ele(name: any, attributes?: Object, text?: any): XMLElementOrXMLNode; | ||
57 | + insertBefore(name: any, attributes?: Object, text?: any): XMLElementOrXMLNode; | ||
58 | + insertAfter(name: any, attributes?: Object, text?: any): XMLElementOrXMLNode; | ||
59 | + remove(): XMLElementOrXMLNode; | ||
60 | + node(name: any, attributes?: Object, text?: any): XMLElementOrXMLNode; | ||
61 | + text(value: string): XMLElementOrXMLNode; | ||
62 | + cdata(value: string): XMLElementOrXMLNode; | ||
63 | + comment(value: string): XMLElementOrXMLNode; | ||
64 | + raw(value: string): XMLElementOrXMLNode; | ||
65 | + declaration(version: string, encoding: string, standalone: boolean): XMLElementOrXMLNode; | ||
66 | + doctype(pubID: string, sysID: string): XMLDocType; | ||
67 | + up(): XMLElementOrXMLNode; | ||
68 | + importDocument(input: XMLElementOrXMLNode): XMLElementOrXMLNode; | ||
69 | + root(): XMLElementOrXMLNode; | ||
70 | + document(): any; | ||
71 | + end(options?: XMLEndOptions): string; | ||
72 | + prev(): XMLElementOrXMLNode; | ||
73 | + next(): XMLElementOrXMLNode; | ||
74 | + nod(name: any, attributes?: Object, text?: any): XMLElementOrXMLNode; | ||
75 | + txt(value: string): XMLElementOrXMLNode; | ||
76 | + dat(value: string): XMLElementOrXMLNode; | ||
77 | + com(value: string): XMLElementOrXMLNode; | ||
78 | + doc(): XMLElementOrXMLNode; | ||
79 | + dec(version: string, encoding: string, standalone: boolean): XMLElementOrXMLNode; | ||
80 | + dtd(pubID: string, sysID: string): XMLDocType; | ||
81 | + e(name: any, attributes?: Object, text?: any): XMLElementOrXMLNode; | ||
82 | + n(name: any, attributes?: Object, text?: any): XMLElementOrXMLNode; | ||
83 | + t(value: string): XMLElementOrXMLNode; | ||
84 | + d(value: string): XMLElementOrXMLNode; | ||
85 | + c(value: string): XMLElementOrXMLNode; | ||
86 | + r(value: string): XMLElementOrXMLNode; | ||
87 | + u(): XMLElementOrXMLNode; | ||
88 | + } | ||
89 | + | ||
90 | + interface XMLDec { | ||
91 | + version?: string; | ||
92 | + encoding?: string; | ||
93 | + standalone?: boolean; | ||
94 | + } | ||
95 | + | ||
96 | + interface XMLDtd { | ||
97 | + pubID?: string; | ||
98 | + sysID?: string; | ||
99 | + } | ||
100 | + | ||
101 | + interface XMLStringifier { | ||
102 | + [x: string]: ((v: any) => string) | string; | ||
103 | + } | ||
104 | + | ||
105 | + interface XMLWriter { | ||
106 | + [x: string]: ((e: XMLElementOrXMLNode, options: WriterOptions, level?: number) => void); | ||
107 | + } | ||
108 | + | ||
109 | + interface XMLCreateOptions { | ||
110 | + headless?: boolean; | ||
111 | + keepNullNodes?: boolean; | ||
112 | + keepNullAttributes?: boolean; | ||
113 | + ignoreDecorators?: boolean; | ||
114 | + separateArrayItems?: boolean; | ||
115 | + noDoubleEncoding?: boolean; | ||
116 | + stringify?: XMLStringifier; | ||
117 | + } | ||
118 | + | ||
119 | + interface XMLToStringOptions { | ||
120 | + pretty?: boolean; | ||
121 | + indent?: string; | ||
122 | + offset?: number; | ||
123 | + newline?: string; | ||
124 | + allowEmpty?: boolean; | ||
125 | + spacebeforeslash?: string; | ||
126 | + } | ||
127 | + | ||
128 | + interface XMLEndOptions extends XMLToStringOptions { | ||
129 | + writer?: XMLWriter; | ||
130 | + } | ||
131 | + | ||
132 | + interface WriterOptions { | ||
133 | + pretty?: boolean; | ||
134 | + indent?: string; | ||
135 | + newline?: string; | ||
136 | + offset?: number; | ||
137 | + allowEmpty?: boolean; | ||
138 | + dontPrettyTextNodes?: boolean; | ||
139 | + spaceBeforeSlash?: string | boolean; | ||
140 | + user? :any; | ||
141 | + state?: WriterState; | ||
142 | + } | ||
143 | + | ||
144 | + enum WriterState { | ||
145 | + None = 0, | ||
146 | + OpenTag = 1, | ||
147 | + InsideTag = 2, | ||
148 | + CloseTag = 3 | ||
149 | + } | ||
150 | + | ||
151 | + function create(nameOrObjSpec: string | { [name: string]: Object }, xmldecOrOptions?: XMLDec | XMLCreateOptions, doctypeOrOptions?: XMLDtd | XMLCreateOptions, options?: XMLCreateOptions): XMLElementOrXMLNode; | ||
152 | + function begin(): XMLElementOrXMLNode; | ||
153 | +} | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
... | @@ -12,7 +12,8 @@ | ... | @@ -12,7 +12,8 @@ |
12 | "express": "^4.18.1", | 12 | "express": "^4.18.1", |
13 | "fs": "^0.0.1-security", | 13 | "fs": "^0.0.1-security", |
14 | "request": "^2.88.2", | 14 | "request": "^2.88.2", |
15 | - "xml-js": "^1.6.11" | 15 | + "xml-js": "^1.6.11", |
16 | + "xml2js": "^0.4.23" | ||
16 | } | 17 | } |
17 | }, | 18 | }, |
18 | "node_modules/accepts": { | 19 | "node_modules/accepts": { |
... | @@ -995,6 +996,26 @@ | ... | @@ -995,6 +996,26 @@ |
995 | "bin": { | 996 | "bin": { |
996 | "xml-js": "bin/cli.js" | 997 | "xml-js": "bin/cli.js" |
997 | } | 998 | } |
999 | + }, | ||
1000 | + "node_modules/xml2js": { | ||
1001 | + "version": "0.4.23", | ||
1002 | + "resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.4.23.tgz", | ||
1003 | + "integrity": "sha512-ySPiMjM0+pLDftHgXY4By0uswI3SPKLDw/i3UXbnO8M/p28zqexCUoPmQFrYD+/1BzhGJSs2i1ERWKJAtiLrug==", | ||
1004 | + "dependencies": { | ||
1005 | + "sax": ">=0.6.0", | ||
1006 | + "xmlbuilder": "~11.0.0" | ||
1007 | + }, | ||
1008 | + "engines": { | ||
1009 | + "node": ">=4.0.0" | ||
1010 | + } | ||
1011 | + }, | ||
1012 | + "node_modules/xmlbuilder": { | ||
1013 | + "version": "11.0.1", | ||
1014 | + "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-11.0.1.tgz", | ||
1015 | + "integrity": "sha512-fDlsI/kFEx7gLvbecc0/ohLG50fugQp8ryHzMTuW9vSa1GJ0XYWKnhsUx7oie3G98+r56aTQIUB4kht42R3JvA==", | ||
1016 | + "engines": { | ||
1017 | + "node": ">=4.0" | ||
1018 | + } | ||
998 | } | 1019 | } |
999 | }, | 1020 | }, |
1000 | "dependencies": { | 1021 | "dependencies": { |
... | @@ -1749,6 +1770,20 @@ | ... | @@ -1749,6 +1770,20 @@ |
1749 | "requires": { | 1770 | "requires": { |
1750 | "sax": "^1.2.4" | 1771 | "sax": "^1.2.4" |
1751 | } | 1772 | } |
1773 | + }, | ||
1774 | + "xml2js": { | ||
1775 | + "version": "0.4.23", | ||
1776 | + "resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.4.23.tgz", | ||
1777 | + "integrity": "sha512-ySPiMjM0+pLDftHgXY4By0uswI3SPKLDw/i3UXbnO8M/p28zqexCUoPmQFrYD+/1BzhGJSs2i1ERWKJAtiLrug==", | ||
1778 | + "requires": { | ||
1779 | + "sax": ">=0.6.0", | ||
1780 | + "xmlbuilder": "~11.0.0" | ||
1781 | + } | ||
1782 | + }, | ||
1783 | + "xmlbuilder": { | ||
1784 | + "version": "11.0.1", | ||
1785 | + "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-11.0.1.tgz", | ||
1786 | + "integrity": "sha512-fDlsI/kFEx7gLvbecc0/ohLG50fugQp8ryHzMTuW9vSa1GJ0XYWKnhsUx7oie3G98+r56aTQIUB4kht42R3JvA==" | ||
1752 | } | 1787 | } |
1753 | } | 1788 | } |
1754 | } | 1789 | } | ... | ... |
... | @@ -17,6 +17,7 @@ | ... | @@ -17,6 +17,7 @@ |
17 | "express": "^4.18.1", | 17 | "express": "^4.18.1", |
18 | "fs": "^0.0.1-security", | 18 | "fs": "^0.0.1-security", |
19 | "request": "^2.88.2", | 19 | "request": "^2.88.2", |
20 | - "xml-js": "^1.6.11" | 20 | + "xml-js": "^1.6.11", |
21 | + "xml2js": "^0.4.23" | ||
21 | } | 22 | } |
22 | } | 23 | } | ... | ... |
... | @@ -3,6 +3,7 @@ const app = express(); | ... | @@ -3,6 +3,7 @@ const app = express(); |
3 | const request = require("request"); | 3 | const request = require("request"); |
4 | const convert = require("xml-js"); | 4 | const convert = require("xml-js"); |
5 | const fs = require("fs"); | 5 | const fs = require("fs"); |
6 | +const xml2js = require("xml2js"); | ||
6 | 7 | ||
7 | // http://apis.data.go.kr/B090041/openapi/service/SpcdeInfoService/getHoliDeInfo?solYear=2019&solMonth=03&ServiceKey=서비스키 | 8 | // http://apis.data.go.kr/B090041/openapi/service/SpcdeInfoService/getHoliDeInfo?solYear=2019&solMonth=03&ServiceKey=서비스키 |
8 | 9 | ||
... | @@ -15,9 +16,10 @@ var url = | ... | @@ -15,9 +16,10 @@ var url = |
15 | var queryParams = "?" + "solYear" + "=" + "2022"; | 16 | var queryParams = "?" + "solYear" + "=" + "2022"; |
16 | queryParams += "&" + "solMonth" + "=" + "05"; | 17 | queryParams += "&" + "solMonth" + "=" + "05"; |
17 | queryParams += "&" + "ServiceKey" + "=" + SERVEICE_KEY; | 18 | queryParams += "&" + "ServiceKey" + "=" + SERVEICE_KEY; |
19 | +let requestUrl = url + queryParams; | ||
20 | +var text = ""; | ||
18 | 21 | ||
19 | app.get("/", function (req, res) { | 22 | app.get("/", function (req, res) { |
20 | - let requestUrl = url + queryParams; | ||
21 | request.get(requestUrl, (err, res, body) => { | 23 | request.get(requestUrl, (err, res, body) => { |
22 | if (err) { | 24 | if (err) { |
23 | console.log("err => " + err); | 25 | console.log("err => " + err); |
... | @@ -25,12 +27,20 @@ app.get("/", function (req, res) { | ... | @@ -25,12 +27,20 @@ app.get("/", function (req, res) { |
25 | if (res.statusCode == 200) { | 27 | if (res.statusCode == 200) { |
26 | var result = body; | 28 | var result = body; |
27 | var xmlToJson = convert.xml2json(result, { compact: true, spaces: 4 }); | 29 | var xmlToJson = convert.xml2json(result, { compact: true, spaces: 4 }); |
30 | + console.log(result); | ||
28 | console.log(xmlToJson); | 31 | console.log(xmlToJson); |
29 | fs.writeFileSync("holi.json", xmlToJson); | 32 | fs.writeFileSync("holi.json", xmlToJson); |
33 | + fs.writeFileSync("holi.xml", result); | ||
34 | + var parser = new xml2js.Parser(); | ||
35 | + parser.parseString(result, function (err, res) { | ||
36 | + console.log(res); | ||
37 | + text = JSON.stringify(res); | ||
38 | + console.log(text); | ||
39 | + }); | ||
30 | } | 40 | } |
31 | } | 41 | } |
32 | }); | 42 | }); |
33 | - res.send("OK"); | 43 | + res.send(text); |
34 | }); | 44 | }); |
35 | 45 | ||
36 | const port = 8080; | 46 | const port = 8080; | ... | ... |
-
Please register or login to post a comment