Counting specific elements in a XML object
- From: davidlamontadams@xxxxxxxxx (Dave Adams)
- Date: Thu, 30 Mar 2006 14:12:49 -0500
If I have a xml file like the following:
<?xml version='1.0'?>
<employee>
<name>John Doe</name>
<age>43</age>
<sex>M</sex>
<department>Recieving</department>
</employee>
<employee>
<name>Bob Gordon</name>
<age>50</age>
<sex>M</sex>
<department>Shipping</department>
</employee>
Is there some perl module out there that can help me get the number of
employees or in other words, the number occurences of "<employee>"?
I guess I can get it conventionally by reading in the file and doing a count
every time the script encounters "<name>". But there must be an easier way..
Any ideas?
DA
- Follow-Ups:
- Re: Counting specific elements in a XML object
- From: Hans Meier
- Re: Counting specific elements in a XML object
- Prev by Date: Re: How to split a string read from the file?
- Next by Date: Re: Counting specific elements in a XML object
- Previous by thread: Win32::GUI Question
- Next by thread: Re: Counting specific elements in a XML object
- Index(es):
Relevant Pages
|