Skip to content
This repository has been archived by the owner on Jan 7, 2021. It is now read-only.

Feature proposal : line breaks and indentation #167

Open
ggrimbert opened this issue Aug 23, 2018 · 2 comments
Open

Feature proposal : line breaks and indentation #167

ggrimbert opened this issue Aug 23, 2018 · 2 comments

Comments

@ggrimbert
Copy link

Hi,

I use your lib for parsing XML and writing JSON into XML and it's very cool and easy to use :)

But the xml generated is on one line, and I find it pretty hard to read.
So I modified your code on my computer to generate the xml with line breaks and indent.

Does this feature interests you, in which case i create a PR ?

@JuliaLid
Copy link

JuliaLid commented Feb 5, 2019

I second this request! Otherwise, it's by far the best library I've found for reversible XML to JSON conversions.

@ggrimbert , how did you format the XML output of the parser.toXML() method to have line breaks and indent?

@ggrimbert
Copy link
Author

ggrimbert commented Mar 8, 2019

Sorry for the late response. I don't have access anymore at the code I've changed...

If I remember, you have to modify the functions openTag and closeTag in xml2json.js to add the line breaks (\n) and the tabs (\t)
add somes checks to control the depth and it's done

EDIT :
You can have access to my version with line breaks and indent in this version https://github.com/konnecteam/node-xml2json

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

No branches or pull requests

2 participants