wood burning stoves 2.0*
The moose likes XML and Related Technologies and the fly likes comparing 2 xml files Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "comparing 2 xml files" Watch "comparing 2 xml files" New topic
Author

comparing 2 xml files

kesava chaitanya
Ranch Hand

Joined: Aug 15, 2001
Posts: 140
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 ]
 
jQuery in Action, 2nd edition
 
subject: comparing 2 xml files
 
Similar Threads
Regarding Hibernate Query
Urgent : help needed is XSLT
hibernate 1-many insertion
error in my struts application no getter methods
Spring Property file configuration Problem