How to extract information from a sentece

Hi to all!
I have some problems in extracting the information I need from a sentece. I'm reading an XML document, and I need some information.
Here is the problem:
<COMPONENT>
<RESOURCE REF="myFirstPicture.jpg" TYPE="<some preamble>/image/jpg" />
</COMPONENT>
I'm able to detect when a component appears, and after that, I would like to read the next sentence and extract the info I need.