Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

comparing 2 xml files

 
kesava chaitanya
Ranch Hand
Posts: 140
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
old.xml
<EmployeeDetails>
<Employee recordNo="1">
<empNo>1</empNo>
<empName>Ch.Srinivas</empName>
<empDisig>Software Engineer</empDisig>
<empSal>1000.0</empSal>
</Employee>
<Employee recordNo="2">
<empNo>2</empNo>
<empName>sampath</empName>
<empDisig>se</empDisig>
<empSal>2222.0</empSal>
</Employee>
</EmployeeDetails>

new.xml
<EmployeeDetails>
<Employee recordNo="1">
<empNo>1</empNo>
<empName>Ch.Srinivas</empName>
<empDisig>Software Engineer</empDisig>
<empSal>1000.0</empSal>
</Employee>
<Employee recordNo="2">
<empName>sampath</empName>
<empDisig>se</empDisig>
<empSal>2222.0</empSal>
</Employee>
</EmployeeDetails>


in new.xml <empNo>2</empNo> of recordno="2" is not there;

i will compare all nodes in 2 xml files;whatever nodes r not there in new.xml those nodes will pick up from old.xml and should be placed exact position in new.xml;
in new.xml if record="1" node is not there whole node should be placed in new.xml before recordno="2" node ;

i am using XPATH API of xalan and DOM;
[ July 20, 2004: Message edited by: kesava chaitanya ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic