If you have php5 you should use simplexml: http://be.php.net/manual/en/book.simplexml.php [1]
If your on php4 you can use the class simplexml44 which is a backport of the php5 simple xml class http://prdownloads.sourceforge.net/ister4framework/simplexml44-0_4_4.tar... [2]
Why use this?
It has all the functionality you ll need build in. So no need to try create your own parser.
Links
[1] http://be.php.net/manual/en/book.simplexml.php
[2] http://prdownloads.sourceforge.net/ister4framework/simplexml44-0_4_4.tar.gz?download