isn't it easier to parse xmls using xsltproc?