title: How to delete LF in XML-Files to receive one line xml file?
body: <p>I have a file theme.xml that contains no "LF" see <a href="https://en.wikipedia.org/wiki/Newline" rel="nofollow noreferrer">https://en.wikipedia.org/wiki/Newline</a>. But after converting to js and return to xml my result contains "LF" line breaker. Is is a problem, because adobe acrobat 8 standard requires the xml file in one line as a header template file. hear an example:</p>
  
  <pre><code>&lt;?xml version = "1.0" encoding = "UTF-8" ?&gt;&lt;HeaderFooterSettings version = "8.0"&gt;&lt;Font name="Arial" size="11.0"/&gt;&lt;Color b="0.0" r="0.0" g="0.0"/&gt;&lt;Margin top="34.0159" left="72.0002" right="72.0002" bottom="36.0001"/&gt;&lt;Appearance shrink="1" fixedprint="0"/&gt;&lt;PageRange end="-1" start="-1" even="1" odd="1"/&gt;&lt;Page offset = "0"&gt;&lt;PageIndex format="1"/&gt;&lt;/Page&gt;&lt;Date&gt;&lt;Month format="1"/&gt;/&lt;Day format="1"/&gt;&lt;Year format="0"/&gt;&lt;/Date&gt;&lt;Header&gt;&lt;Left&gt;hello&lt;/Left&gt;&lt;Center&gt;&lt;/Center&gt;&lt;Right&gt;world&lt;/Right&gt;&lt;/Header&gt;&lt;Footer&gt;&lt;Left&gt;&lt;/Left&gt;&lt;Center&gt;&lt;/Center&gt;&lt;Right&gt;&lt;/Right&gt;&lt;/Footer&gt;&lt;/HeaderFooterSettings&gt;
  
  
  
  
  
  
  var fs = require('fs');
  var path = require('path');
  var xml2js = require('xml2js');
  
  xmlFileToJs('theme.xml', function (err, obj) {
      if (err) throw (err);
      jsToXmlFile('theme2.xml', obj, function (err) {
          if (err) console.log(err);
      })
  });
  
  
  function xmlFileToJs(filename, cb) {
      var filepath = path.normalize(path.join(__dirname, filename));
      fs.readFile(filepath, 'utf8', function (err, xmlStr) {
          if (err) throw (err);
          xml2js.parseString(xmlStr, {}, cb);
      });    
  }
  
  function jsToXmlFile(filename, obj, cb) {
      var filepath = path.normalize(path.join(__dirname, filename));
      var builder = new xml2js.Builder();
      var xml = builder.buildObject(obj);
      fs.writeFile(filepath, xml, cb);
  }
  </code></pre>
  
  <p>and results unfortunatly with linebrakers "LF"</p>
  
  <pre><code> &lt;?xml version="1.0" encoding="UTF-8" standalone="yes"?&gt;
  &lt;HeaderFooterSettings version="8.0"&gt;
    &lt;Font name="Arial" size="11.0"/&gt;
    &lt;Color b="0.0" r="0.0" g="0.0"/&gt;
    &lt;Margin top="34.0159" left="72.0002" right="72.0002" bottom="36.0001"/&gt;
    &lt;Appearance shrink="1" fixedprint="0"/&gt;
    &lt;PageRange end="-1" start="-1" even="1" odd="1"/&gt;
    &lt;Page offset="0"&gt;
      &lt;PageIndex format="1"/&gt;
    &lt;/Page&gt;
    &lt;Date&gt;
      /
      &lt;Month format="1"/&gt;
      &lt;Day format="1"/&gt;
      &lt;Year format="0"/&gt;
    &lt;/Date&gt;
    &lt;Header&gt;
      &lt;Left&gt;hello&lt;/Left&gt;
      &lt;Center/&gt;
      &lt;Right&gt;world&lt;/Right&gt;
    &lt;/Header&gt;
    &lt;Footer&gt;
      &lt;Left/&gt;
      &lt;Center/&gt;
      &lt;Right/&gt;
    &lt;/Footer&gt;
  &lt;/HeaderFooterSettings&gt;
  </code></pre>
  
  <p>I tried a lot. for instant, but cannot find a solution by this commands:</p>
  
  <pre><code>const stringify = require('xml-stringify');
  var xmlc = require('xml');
  const trimNewlines = require('trim-newlines');
  xmlc(trimNewlines(JSON.stringify(obj)));
  </code></pre>
  
  <p>also I tried this: </p>
  
  <pre><code>var builder = new xml2js.Builder({'trim' : true, 'normalize' : true});
  </code></pre>
  
  <p>well no chance.</p>
  
  <p>I look forward for other ideas.</p>