javascript - How do I prevent Firefox XMLSerializer from capitalizing nodes -
i'm creating xml document in javascript on client side, , transforming string send server. mozilla has handy method accomplish this: xmlserializer().serializetostring()
, i'm using. however, there seems bug in method: returns node names in uppercase , attribute names in lowercase(regardless of capitalization used create node).
is there way circumvent behavior , xml string original capitalization? more generally, there way create xml document in mozilla , return string without having capitalization overridden?
it looks working html document. try operating on xml document instead.
var odocument = new domparser().parsefromstring("<root />", "text/xml"); odocument.documentelement.appendchild(odocument.createelementns("http://myns", "x:test")); alert(new xmlserializer().serializetostring(odocument));
or
var odocument = document.implementation.createdocument("", "", null); odocument.appendchild(odocument.createelementns("http://myns", "x:test")); alert(new xmlserializer().serializetostring(odocument));
regards
Comments
Post a Comment