-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- test that JSON files converted via PHP can be reconverted back to XML without loss of information other changes: - regenerate random files - validate random JSON files with PHP validator
- Loading branch information
Paolo Greppi
committed
Jul 3, 2018
1 parent
60680f1
commit c65a84c
Showing
42 changed files
with
3,410 additions
and
2,920 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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/bin/sh | ||
# | ||
# converts to JSON the sample XML invoice files from fatturapa.gov.it | ||
# using the javascript converter | ||
# | ||
# Copyright (c) 2018, Paolo Greppi <[email protected]> | ||
# License: BSD 3-Clause | ||
|
||
set -e | ||
|
||
for name in "samples/IT01234567890_FPA01" "samples/IT01234567890_FPA02" "samples/IT01234567890_FPA03" "samples/IT01234567890_FPR01" "samples/IT01234567890_FPR02" "samples/IT01234567890_FPR03" | ||
do | ||
echo "converting $name.xml" | ||
./bin/xml2json.js "$name.xml" > "$name-js.json" | ||
done |
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,6 +1,7 @@ | ||
#!/bin/sh | ||
# | ||
# converts to JSON the sample XML invoice files from fatturapa.gov.it | ||
# using the PHP converter | ||
# | ||
# Copyright (c) 2018, Paolo Greppi <[email protected]> | ||
# License: BSD 3-Clause | ||
|
@@ -10,5 +11,5 @@ set -e | |
for name in "samples/IT01234567890_FPA01" "samples/IT01234567890_FPA02" "samples/IT01234567890_FPA03" "samples/IT01234567890_FPR01" "samples/IT01234567890_FPR02" "samples/IT01234567890_FPR03" | ||
do | ||
echo "converting $name.xml" | ||
./bin/xml2json.js "$name.xml" > "$name.json" | ||
./bin/xml2json.php "$name.xml" > "$name-php.json" | ||
done |
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
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
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,6 +1,6 @@ | ||
#!/usr/bin/nodejs | ||
// | ||
// converts the supplied XML file to JSON | ||
// converts the supplied XML invoice file to JSON | ||
// | ||
// Copyright (c) 2018, Paolo Greppi <[email protected]> | ||
// License: BSD 3-Clause | ||
|
@@ -11,7 +11,7 @@ var parser = require('xml2json'); | |
var fs = require('fs'); | ||
|
||
if (process.argv.length <= 2) { | ||
console.log("Usage: xml2json file.json"); | ||
console.log("Usage: xml2json.js file.xml"); | ||
process.exit(-1); | ||
} | ||
|
||
|
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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/usr/bin/php | ||
<?php | ||
// converts the supplied XML invoice file to JSON | ||
// | ||
// Copyright (c) 2018, Paolo Greppi <[email protected]> | ||
// License: BSD 3-Clause | ||
|
||
declare(strict_types=1); | ||
|
||
require_once './vendor/autoload.php'; | ||
require("www/Xml2Json.php"); | ||
|
||
if (count($argv) <= 1) { | ||
echo "Usage: xml2json.php file.xml\n"; | ||
exit(-1); | ||
} | ||
|
||
$filename = $argv[1]; | ||
|
||
$obj = new Simevo\Xml2Json($filename); | ||
echo $obj->result(); |
Oops, something went wrong.