0

I used DOMParser to parse the xml data. But only in Edge after parseFromString, the order of attributes which node has changed. I seached so I know the order of attribute isn't significant. but I just wonder is there any way to maintain the order of attributes even if using DOMParser.

YOUNG
  • 1
  • 2

1 Answers1

1

There are lots of questions and answers about attribute order that tell you essentially the same thing, for example

Order of XML attributes after DOM processing

But I'm reluctant to close as a duplicate because your question is product-specific, and it's just possible there is some magic hidden switch in your chosen product that causes attribute order to be retained.

In general though, the answer is that attribute order in XML is not considered significant, and if your chosen XML tools preserve attribute order, then it's probably by happy accident rather than by design.

Michael Kay
  • 156,231
  • 11
  • 92
  • 164