javascript - Node.js: How to create XML files -


Is there a good way to create XML files? For example, like the builder (or any other way) for the rail?

Thank you

It seems that the library can do this for you. If you have NPM installed, you can do npm install xmlbuilder .

This will let you do (taken from their example):

  var requires builder = 'xmlbuilder'); Var doc = builder.create (); ('For', 'node-js') .ele ('repo') .att ('type', 'git') .txt ('' for '' xmlbuilder '' .git: //github.com /oozcitak/xmlbuilder-js.git ') .up () .up () .ele (' test ') .txt (' absolute '); Console.log (doc.toString ({beautiful: true}));   

As a result:

  & lt; Root & gt; & Lt; Xmlbuilder for = "node-js" & gt; & Lt; Repo type = "git" & gt; Git: //github.com/oozcitak/xmlbuilder-js.git< / Repo & gt; & Lt; / Xmlbuilder & gt; & Lt; Test & gt; Full & lt; / Test & gt; & Lt; / Root & gt;    

Comments

Popular posts from this blog

mysql - BLOB/TEXT column 'value' used in key specification without a key length -

c# - Using Vici cool Storage with monodroid -

c# - Confused over DLL entry points (entry point not found exception) -