holygrail has asked for the wisdom of the Perl Monks concerning the following question:

When I parse an XML file that looks like this:
<?xml version="1.0"?> <document name="Testdocument"> <p> This is some text <img src="me.gif" /> And this is some other </p> </document>
I want to preserve the location of the img-tag. That means I want to know the text in the p-element until the first tag that comes within it.

How do I achieve this using XML::XPath (or if it's possible with another module, what should I use)?

--HolyGrail