When writing an XML file using `N/xml` and `N/file...
# suitescript
k
When writing an XML file using
N/xml
and
N/file
is there a way to "pretty print" the resulting XML so humans can read it easier instead of all on one line?
Hmmm, now that I think of it, the problem may not be with
N/xml
but with my hand-rolled JSON to XML function.
Hmm is it possible to pass the xml document directly to file.create instead of parsing it to string first?
c
What would that solve? It won't get pretty printed
k
I don't know. I was just reaching for an easy answer. 😣
d
If you're just viewing XML files in the file cabinet, I would recommend a browser extension like XML Tree If you're instead displaying the XML in a text field, let me know if you find an answer, I want to know how too =P
k
The end users are downloading the XML file and viewing them in Notepad so I need to add whitespace based on the hierarchy of the XML document.
d
There's some js libraries floating around that you may be able to use Looks like some of them are just calling a bunch of regex replacements