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

Feature proposal : line breaks and indentation #167

Open

Description

@ggrimbert

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 ?

Activity

  1. JuliaLid commented on Feb 5, 2019

    @JuliaLid

    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?

  2. ggrimbert commented on Mar 8, 2019

    @ggrimbert
    Author

    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 join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions