Link to home
Create AccountLog in
Avatar of Shiva_Kumar
Shiva_Kumar

asked on

php script to compare yesterdays and todays node value of same xml file

hi,

I have a XML file whose one of the node value changes every day once.  Now i need to script which can compare yesterdays and todays node value of the same xml file.  if they found to be same then i would assume that it is not updated.

here's what i am doing:

1. parsing the xml file to get todays node value.
2. i am keeping a downloaded copy of the same xml file from yesterday and parsing this xml file to compare todays and yesterdays node value.

Is there any better way performing this task.

Thanks
Avatar of kevthedude
kevthedude
Flag of United States of America image

If these are not big XML files, then this is totally fine. However, if they are much larger files, it might be easier and space saving to store yesterday's value in a database engine such as MySQL and then parse the new one.

If you need a sample script can I get a copy of the XML file labeled with what data you want to compare from them? I just need it for reference on which arrays to call.
Avatar of Shiva_Kumar
Shiva_Kumar

ASKER

the xml file is very small.. this is how it looks


<Pkg xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <pkgId>abcdefgh=</pkgId> 
  <pkgValue>xyz-abc=</pkgValue> 
  </Pkg>

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of kevthedude
kevthedude
Flag of United States of America image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer