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
Post a Comment