XML attributes order is changing after DOM processing using Java code -


i trying read xml , writing xml changing attribute values when processing xml means of standard dom, attribute order changing. here trying change 'id' attribute value of 'staff' element.

input xml:

<company  xyz="xyz" def="def">    <staff id="1"  def="def"  xyz="xyz" abc="abc">     <firstname>yong</firstname>     <lastname>mook kim</lastname>     <nickname>mkyong</nickname>     <salary>100000</salary>    </staff> </company> 

output xml:

<company  def="def" xyz="xyz">     <staff abc="abc" def="def" id="2" xyz="xyz">         <firstname>yong</firstname>         <lastname>mook kim</lastname>         <nickname>mkyong</nickname>         <salary>100000</salary>     </staff> </company> 

expecting output xml:

<company  xyz="xyz" def="def">    <staff id="2" def="def"  xyz="xyz" abc="abc">     <firstname>yong</firstname>     <lastname>mook kim</lastname>     <nickname>mkyong</nickname>     <salary>100000</salary>    </staff> </company> 

could please source code. waiting responses.


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -