David Hsu wrote:
> I only want the name in last <Name> tag and the <Jobtitle>
> (i.e. Susan Miers President)
You may want to look into XPath. Here's a sample:
use XML::XPath;
my $xml = qq(
<sample>
<Name><FN>John</FN> <LN>Smith</LN></Name>,
<Name><FN>Susan</FN> <LN>Miers</LN></Name>
<JobTitle>President</JobTitle>
</sample>
);
my $x = XML::XPath->new(xml=>$xml);
my $name = $x->findvalue('normalize-space(//Name[position()=last()])');
my $title = $x->findvalue('//JobTitle');
print "$name $title\n"; #prints "Susan Miers President"
--
Mark Thomas
Internet Systems Architect
_______________________________________
BAE SYSTEMS Information Technology
2525 Network Place
Herndon, VA 20171 USA
_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs