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

XML-JS Empty xml files being made after conversion from .json file #201

Open
elnot117 opened this issue Jun 27, 2023 · 1 comment
Open

Comments

@elnot117
Copy link

I'm currently using "yarn" to issue my command instead of npm.
After using xml-js to convert my files, it makes the xml file but does not retain the information within the .json file.
Command Prompt Line used:

yarn xml-js C:\Users\Solis_a\Selenium-Tests\results-2023-06-27T13-31-20.567Z.json --spaces 4 --out C:\Users\Solis_a\Selenium-Tests\results-2023-06-27T13-31-20.567Z.xml

Am I entering the line improperly or is it a file issue?

@matthew-ia
Copy link

matthew-ia commented Aug 20, 2023

I had the same issue: no output from a JSON->XML run, and no errors logged. Although, I'm not sure that is necessarily a problem with this package (although, an error or hint of some kind would be nice, when there is empty output).

I figured out my issue, which was that my input JSON was incorrectly structured. I used the CLI to validate manually by giving it good, expected XML, and got JSON out. I then compared the good JSON (expected) to my JSON (actual) and was able to find my structural errors. Specifically, my issue was that I mixed compact and non-compact in my JSON, which caused the empty output without errors—it seems that there are allowed/expected keys in non-compact that will just cause the parsing to break (understandably).

It would be cool if this package offered validation tooling, but I can see how that might fall out of scope for this package, especially if the "non-compact" and "compact" structures are standards. (I'm a bit unfamiliar with the XML <-> JS tooling, but after reading the README I expect those structures are sort of common or standards across similar APIs/tools?)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants