dom - Javascript created xml document formatting of empty elements -


is possible control how xml document rendered xmlserializer when using own namespace? namely, when creating document this:

root = document.implementation.createdocument('hello-world', 'something', null); s = new xmlserializer(); console.log(s.serializetostring(root)); 

the resulting xml serializetostring is

<something xmlns="hello-world"/> 

is there way change formatting such output instead

<something xmlns="hello-world"></something> 

it worked me add empty text node:

root.documentelement.appendchild(root.createtextnode("")); 

with line included, output

<?xml version="1.0"?><something xmlns="hello-world"></something> 

Comments

Popular posts from this blog

user interface - Python attempting to create a simple gui, getting "AttributeError: 'MainMenu' object has no attribute 'intro_screen'" -

jquery - Common JavaScript snippet to share files on Google Drive, Dropbox, Box.net or SkyDrive -

Android Gson.fromJson error -