in reply to XML::Parser question.
You should call $parser->parsefile('test.xml'); instead of parse, the parser tries to parse the text test.xml and does not find it well-formed.