Extracting value from data within an element.

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

Hello forum.

I have written a perl script that will parse XML files and extract
certain elements and put them into a comma delimited file. This works
no problem. What I have encountered however, is that in one of my XML
files, there is a piece of information that I would like to extract
that is emebedded in the data. I am not sure if any of the options in
XML::Parser or XML::Simple modules will allow me to do this. The
element name and data of the XML file is shown below. What I would like
to do is extract the number from this data.

<desc>Sun(sm) Alert Notification 45707: Buffer overflow in

next element:

<desc>Sun(sm) Alert Notification 45240: he "/proc/[pid]/sigact" File
May Contain Sensitive Data</desc>

Anyone have any ways to do this?

Re: Extracting value from data within an element.


Quoted text here. Click to load it

That is not a function of XML parsing; that is a pattern-matching problem.  
Extract the <desc> contents into a string, then use a regex on it.


Site Timeline