xml-js
xml-js copied to clipboard
xml-js trims off the spaces in the text following each other
xml-js trims off the spaces in the text following each other
<some>some text </some>
converts to:
{type: "text", "text: "some text "} // where are my spaces??
OR
<some> <some>
converts to:
{type: "element", name: "some"} // And that's it. Where is my text with empty space?
@malikiz Are you set trim options? Your example works well in my computer (xml-js v1.6.11)
What about this example? How do I find out how many spaces are present in the text?
console.log(convert.xml2json('<some> </some>'))
{"elements":[{"type":"element","name":"some"}]}
I found the captureSpacesBetweenElements property in the sources, but I didn't find it in the documentation. I think this will work for me.