Desdinova has asked for the wisdom of the Perl Monks concerning the following question:
For the the first in almost a year of being here I am posting a question.. that says alot about much info is already here.. but anyway
I have a "XML like" file in this format:
What I would like to be able to do is read in the first "post" and assign the content to a hash with the elements as keys so that i can access the data like
print "City: $hash{location} \n";
Then go on to the next "post" and repeat the proccessing of the data inside it. I have looked at the man pages for XML::Parser and XML::Simple but I can't figure out how to go through one post at a time. I figure there is something simple about all this that I am just missing and would appreciate if some helpful monk could point my brain in the right direction.
Thanks
I have a "XML like" file in this format:
And so on<post> <jobnumber>1234</jobnumber> <location> somecity NJ <location> </post> <post> <jobnumber>87922</jobnumber> <location> Othercity, AK <location> </post>
What I would like to be able to do is read in the first "post" and assign the content to a hash with the elements as keys so that i can access the data like
print "City: $hash{location} \n";
Then go on to the next "post" and repeat the proccessing of the data inside it. I have looked at the man pages for XML::Parser and XML::Simple but I can't figure out how to go through one post at a time. I figure there is something simple about all this that I am just missing and would appreciate if some helpful monk could point my brain in the right direction.
Thanks
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Pasring XML into a simple hash
by Kanji (Parson) on Jun 21, 2001 at 09:38 UTC | |
Re: Parsing XML into a simple hash
by bikeNomad (Priest) on Jun 21, 2001 at 10:03 UTC | |
Re: Parsing XML into a simple hash
by mirod (Canon) on Jun 21, 2001 at 16:00 UTC | |
Re: Pasring XML into a simple hash
by strredwolf (Chaplain) on Jun 21, 2001 at 10:45 UTC | |
Re: Parsing XML into a simple hash
by mattr (Curate) on Jun 21, 2001 at 11:15 UTC | |
by Ovid (Cardinal) on Jun 21, 2001 at 22:19 UTC | |
by mattr (Curate) on Jun 22, 2001 at 14:05 UTC | |
andye Re: Pasring XML into a simple hash
by andye (Curate) on Jun 21, 2001 at 15:47 UTC | |
Re: Pasring XML into a simple hash
by Desdinova (Friar) on Jun 22, 2001 at 07:28 UTC |
Back to
Seekers of Perl Wisdom