This repository has been archived by the owner on Jul 15, 2018. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
17 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,20 @@ | ||
# ringo-easyxml | ||
|
||
One way converter from E4X XML to JSON. Usage: | ||
One way converter from XML to JSON. Usage: | ||
|
||
var {E4XtoJSON} = require("easyxml"); | ||
var {XMLtoJSON} = require("easyxml"); | ||
var xml = '<a><b>c</b></a>'; | ||
var json = E4XtoJSON(xml); | ||
var json = XMLtoJSON(xml); | ||
|
||
Turns child nodes with the same name into arrays so that lists are easier | ||
to work with. | ||
|
||
<body><item>1</item><item>2</item></body> | ||
|
||
body: {item: ["1", "2"]} | ||
`<body><item>1</item><item>2</item></body>` becomes `body: {item: ["1", "2"]}` | ||
|
||
Turns XML node attributes into object attributes, | ||
the children are placed inside a special attribute named "_": | ||
|
||
<body a="a">whatever</body> | ||
|
||
body: {_a: "a", _: "whatever"} | ||
`<body a="a">whatever</body>` becomes `body: {_a: "a", _: "whatever"}` | ||
|
||
For other options, take a look at test/all.js. | ||
For options, take a look at testOptions in `test/all.js.` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
{ | ||
"name": "ringo-easyxml", | ||
"version": "0.1.0", | ||
"description": "XML (E4X) to JSON converter", | ||
"description": "XML to JSON converter", | ||
"keywords": ["xml", "json"], | ||
"author": "Oleg Podsechin (http://github.com/olegp)" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters