Re: Extracting value from data within an element.



"anthony" <anthony@xxxxxxxxxxxxxxxxx> 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.
>
> <desc>Sun(sm) Alert Notification 45707: Buffer overflow in
> vold(1M)</desc>
>
> 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?

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.

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



Relevant Pages

  • Re: Effective/Proper use of "regular expressions"
    ... My project is to extract some data from openstreetmap.org OSM files. ... Since I have even less background in XML than TCL, that doesn't seem to gain me anything. ...
    (comp.lang.tcl)
  • Location (on page) based Text Data Extract
    ... I am trying to obtain some software that will allow me to extract text ... from a PDF and eventually import into a database (probably via XML). ... I would envisage some sort of mapping application that lets me identify ...
    (comp.text.pdf)
  • Re: XML , schema
    ... The latest version of SQLXML ... You can extract relational data as XML using the Annotated XSD as ... Graeme described and you can also use the AXSD to insert data using Xml ... > 'Create Stream object for results. ...
    (microsoft.public.sqlserver.xml)
  • Re: Extracting XML in VB
    ... extract a single element by it's tag using GetElementsByTagName. ... If you know the structure of the xml in advance, ... There are no advanced students in Aikido - there are only ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Store range of Excel cells in DB/XML
    ... The resulting XML had values and formating info. ... I was able to store in DB, ... Extract from an Excel file a range of cells specified by a name (a ...
    (microsoft.public.vsnet.vstools.office)