-
-
Notifications
You must be signed in to change notification settings - Fork 23
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
New Line After each tag #40
Comments
Hi, good question. I think there may be a small bug in the library right now, this seems like it should output with line breaks when you use the toXML([
{a: "A Value"},
{b: "B Value"}
], {indent: ' '}); Results in <a>A Value</a><b>B Value</b> But seems like it should result in this? (I'll take a look and see if I can tweak this) <a>A Value</a>
<b>B Value</b> You can get line breaks when you nest the value with indenting, e.g. toXML({
foo: [
{a: "A Value"},
{b: "B Value"}
]
}, {indent: ' '}); Which results in this: <foo>
<a>A Value</a>
<b>B Value</b>
</foo> Note that you can also force line breaks between tags with this: toXML([
{a: "A Value"},
'\n',
{b: "B Value"}
]); Which results in this: <a>A Value</a>
<b>B Value</b> |
Thanks for replying. I did find a workaround for it when showing the XML file content on the screen, which were entering this line of code into App.css. |
@PhuocHoangMinhNguyen Yep, if you see the new lines with that CSS, then the new line characters should be in the XML file output when you download it as well. Just a heads up that I added a fix for the original issue. This code: toXML([
{a: "A Value"},
{b: "B Value"}
], {indent: ' '}); or this code: toXML({
a: "A Value",
b: "B Value"
}, {indent: ' '}); Will now result in this: <a>A Value</a>
<b>B Value</b> |
How can I make new line after each tag? For example:
<a>A Value</a>
<b>B Value</b>
Instead of: <a>A Value</a><b>B Value</b>
I'm using "jstoxml": "^1.6.8"
The text was updated successfully, but these errors were encountered: