Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fetch upstream #1

Open
wants to merge 64 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
6f1b97c
parser.test.coffee: regression tests for #356
jcsahnwaldt Jun 15, 2018
97f6841
parser test: "valueProcessor" -> "valueProcessors"
jcsahnwaldt Jun 15, 2018
aa706c0
Update README.md
kevinpagtakhan Aug 8, 2018
19a4c2f
Call function for emptyTag if specified
May 21, 2019
f074644
cr fixes (will be squashed after another cr)
May 22, 2019
fa32064
readme updated with default empty tag as function
Jun 22, 2019
ef5d7c2
Merge pull request #474 from kevinpagtakhan/patch-1
Leonidas-from-XIV Aug 29, 2019
eb6c144
Merge pull request #468 from jcsahnwaldt/patch-2
Leonidas-from-XIV Aug 29, 2019
387a83b
Bump nodejs versions to ones that are still maintained
Leonidas-from-XIV Aug 29, 2019
5770685
Merge pull request #521 from Leonidas-from-XIV/maintained-nodejs-ci
Leonidas-from-XIV Aug 29, 2019
c759711
Create a promise-specific version of parseString
mckramer Feb 13, 2018
f2a3f80
Minimal version is Node 8
Leonidas-from-XIV Aug 29, 2019
c6071f3
Add lockfile
Leonidas-from-XIV Aug 29, 2019
f41cb5f
Merge pull request #522 from Leonidas-from-XIV/parse-string-promise
Leonidas-from-XIV Aug 30, 2019
7a83bc8
updated events
arorayash Dec 20, 2018
d810f49
Merge pull request #525 from Leonidas-from-XIV/update-event
Leonidas-from-XIV Aug 30, 2019
d04c9e5
New release, 0.4.20
Leonidas-from-XIV Sep 1, 2019
1375359
Update xmlbuilder dependency to 13.x
Leonidas-from-XIV Sep 2, 2019
b47e3dc
Merge pull request #528 from Leonidas-from-XIV/xmlbuilder-update
Leonidas-from-XIV Sep 2, 2019
5b11691
New release 0.4.21
Leonidas-from-XIV Sep 2, 2019
080e904
Attempt to restore Node 4 compatibility
Leonidas-from-XIV Sep 3, 2019
81972ee
Use xmlbuilder that works with Node 4
Leonidas-from-XIV Sep 3, 2019
fd006fd
Add compatibility shim for Node < 8
Leonidas-from-XIV Sep 3, 2019
c62b085
Use promise shim instead of actual Node function
Leonidas-from-XIV Sep 3, 2019
7a6d39f
Merge pull request #531 from Leonidas-from-XIV/node-4
Leonidas-from-XIV Sep 3, 2019
aefc64a
Bump version for next release
Leonidas-from-XIV Sep 3, 2019
882ec6b
package: Remove temporary util.promisify dep
Raynos Dec 19, 2019
1adc998
src: Inline util.promisify
Raynos Dec 19, 2019
3c2c99a
regenerate lib/parser.js
Raynos Dec 19, 2019
bb266cf
Merge pull request #546 from optoolco/reduce-deps
Leonidas-from-XIV Dec 19, 2019
8fc5b92
Bump version for next release
Leonidas-from-XIV Dec 19, 2019
aad6dd6
fix issue554
Omega-Ariston Feb 19, 2020
a3ae596
append example to README for issue #552
Mar 23, 2020
a44bad4
Update README.md
Omega-Ariston Mar 23, 2020
0d71785
Merge pull request #562 from Omega-Ariston/addDocExample
Leonidas-from-XIV Mar 27, 2020
198063c
Merge pull request #556 from Omega-Ariston/fix-issue544
Leonidas-from-XIV Mar 27, 2020
1832e0b
Merge pull request #512 from economia/master
Leonidas-from-XIV Mar 27, 2020
a212950
Add documentation for `explicitCharkey` option
fnimick Jan 12, 2021
581b19a
use Object.create(null) to create all parsed objects (prevent prototy…
autopulated Mar 2, 2021
d318ce0
Update README.md
wisesimpson Jan 12, 2022
f412a12
Merge pull request #635 from wisesimpson/patch-1
Leonidas-from-XIV Jan 12, 2022
7bc3c5d
Merge pull request #598 from fnimick/master
Leonidas-from-XIV Mar 26, 2022
50a492a
Merge pull request #603 from autopulated/master
Leonidas-from-XIV Apr 9, 2023
9f730bb
Update package.json with latest PR
Leonidas-from-XIV Apr 9, 2023
3a8d46e
Update lockfile
Leonidas-from-XIV Apr 9, 2023
bd0f780
Bump dependency versions to fix security issues
Leonidas-from-XIV Apr 9, 2023
b856cb8
Add upper bound for coffeescript (for now)
Leonidas-from-XIV Apr 9, 2023
246252a
chore: revert previous CVE fix
markwhitfeld Apr 26, 2023
d486007
fix: explicitly ignore vulnerable properties
markwhitfeld Apr 26, 2023
ad3a297
refactor: extract function for key check
markwhitfeld Apr 27, 2023
4c8ec89
fix: revert incorrectly adapted code
markwhitfeld Apr 27, 2023
7292aa9
fix: include missed key check
markwhitfeld Apr 27, 2023
044cfe5
Undo API changes from #603
Leonidas-from-XIV May 25, 2023
5f6620f
Compile changed coffeescript code
Leonidas-from-XIV May 25, 2023
167a385
Fix zap to be the original dependency
Leonidas-from-XIV May 25, 2023
3b97ae5
Merge pull request #681 from Leonidas-from-XIV/cve-compat-fix
Leonidas-from-XIV May 25, 2023
1de4688
Merge pull request #680 from Leonidas-from-XIV/zap-dependency-fix
Leonidas-from-XIV May 25, 2023
a25035c
Remove old unused files
Leonidas-from-XIV May 25, 2023
0e29f0e
Release new version
Leonidas-from-XIV May 25, 2023
ba46e54
Update package lock
Leonidas-from-XIV Jul 25, 2023
30f9d61
Replace filtering of names with `defineProperty`
Leonidas-from-XIV Jul 25, 2023
8e9a120
Update version number for release 0.6.1
Leonidas-from-XIV Jul 25, 2023
cb2f77e
Fix read-only constraint via mistyped key name
Leonidas-from-XIV Jul 26, 2023
cf3e061
New release, 0.6.2
Leonidas-from-XIV Jul 26, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions .travis.yml

This file was deleted.

3 changes: 2 additions & 1 deletion Cakefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{spawn, exec} = require 'child_process'

task 'build', 'continually build the JavaScript code', ->
coffee = spawn 'coffee', ['-cw', '-o', 'lib', 'src']
coffeeScript = if process.platform == 'win32' then 'coffee.cmd' else 'coffee'
coffee = spawn coffeeScript, ['-cw', '-o', 'lib', 'src']
coffee.stdout.on 'data', (data) -> console.log data.toString().trim()

task 'doc', 'rebuild the Docco documentation', ->
Expand Down
54 changes: 50 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,33 @@ not, we got you covered! Starting with 0.2.8 you can also leave it out, in
which case `xml2js` will helpfully add it for you, no bad surprises and
inexplicable bugs!

Promise usage
-------------

```javascript
var xml2js = require('xml2js');
var xml = '<foo></foo>';

// With parser
var parser = new xml2js.Parser(/* options */);
parser.parseStringPromise(xml).then(function (result) {
console.dir(result);
console.log('Done');
})
.catch(function (err) {
// Failed
});

// Without parser
xml2js.parseStringPromise(xml /*, options */).then(function (result) {
console.dir(result);
console.log('Done');
})
.catch(function (err) {
// Failed
});
```

Parsing multiple files
----------------------

Expand Down Expand Up @@ -153,6 +180,16 @@ var obj = {name: "Super", Surname: "Man", age: 23};
var builder = new xml2js.Builder();
var xml = builder.buildObject(obj);
```
will result in:

```xml
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<root>
<name>Super</name>
<Surname>Man</Surname>
<age>23</age>
</root>
```

At the moment, a one to one bi-directional conversion is guaranteed only for
default configuration, except for `attrkey`, `charkey` and `explicitArray` options
Expand All @@ -168,6 +205,11 @@ var obj = {root: {$: {id: "my id"}, _: "my inner text"}};
var builder = new xml2js.Builder();
var xml = builder.buildObject(obj);
```
will result in:
```xml
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<root id="my id">my inner text</root>
```

### Adding xmlns attributes

Expand Down Expand Up @@ -282,14 +324,18 @@ value})``. Possible options are:
Version 0.1 default was `@`.
* `charkey` (default: `_`): Prefix that is used to access the character
content. Version 0.1 default was `#`.
* `explicitCharkey` (default: `false`)
* `explicitCharkey` (default: `false`) Determines whether or not to use
a `charkey` prefix for elements with no attributes.
* `trim` (default: `false`): Trim the whitespace at the beginning and end of
text nodes.
* `normalizeTags` (default: `false`): Normalize all tag names to lowercase.
* `normalize` (default: `false`): Trim whitespaces inside text nodes.
* `explicitRoot` (default: `true`): Set this if you want to get the root
node in the resulting object.
* `emptyTag` (default: `''`): what will the value of empty nodes be.
* `emptyTag` (default: `''`): what will the value of empty nodes be. In case
you want to use an empty object as a default value, it is better to provide a factory
function `() => ({})` instead. Without this function a plain object would
become a shared reference across all occurrences with unwanted behavior.
* `explicitArray` (default: `true`): Always put child nodes in an array if
true; otherwise an array is created only if there is more than one.
* `ignoreAttrs` (default: `false`): Ignore all XML attributes and only create
Expand Down Expand Up @@ -341,7 +387,7 @@ value})``. Possible options are:
value processing functions. Accepts an `Array` of functions with following
signature:
```javascript
function (name){
function (value, name){
//do something with `name`
return name
}
Expand All @@ -361,7 +407,7 @@ value})``. Possible options are:
processing functions. Accepts an `Array` of functions with following
signature:
```javascript
function (name){
function (value, name){
//do something with `name`
return name
}
Expand Down
79 changes: 0 additions & 79 deletions bower.json

This file was deleted.

56 changes: 47 additions & 9 deletions lib/parser.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions lib/xml2js.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading