Extracting value from data within an element.

Extracting value from data within an element.

am 30.11.2005 14:26:41 von anthony

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.

Sun(sm) Alert Notification 45707: Buffer overflow in
vold(1M)


next element:

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


Anyone have any ways to do this?

Re: Extracting value from data within an element.

am 01.12.2005 13:12:26 von sdn.girths00869

"anthony" wrote in news:1133357201.527867.31710
@g49g2000cwa.googlegroups.com:

[...]
> 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.
>
> Sun(sm) Alert Notification 45707: Buffer overflow in
> vold(1M)

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

>
> Anyone have any ways to do this?

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

--
Eric
`$=`;$_=\%!;($_)=/(.)/;$==++$|;($.,$/,$,,$\,$",$;,$^,$#,$~,$ *,$:,@%)=(
$!=~/(.)(.).(.)(.)(.)(.)..(.)(.)(.)..(.)......(.)/,$"),$=++; $.++;$.++;
$_++;$_++;($_,$\,$,)=($~.$"."$;$/$%[$?]$_$\$,$:$%[$?]",$"&$~ ,$#,);$,++
;$,++;$^|=$";`$_$\$,$/$:$;$~$*$%[$?]$.$~$*${#}$%[$?]$;$\$"$^ $~$*.>&$=`