CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Advanced:
Parse XML file

 



apatil65
New User

Aug 27, 2014, 6:52 AM

Post #1 of 4 (5415 views)
Parse XML file Can't Post

Here is the sample XML:

<Sport Name=“Kabaddi” TimeStamp="10/09/14 04:53:58">
<EventGroup name="Royal" ID="20394662">
<Event Name="Warwickshire vs Durham" ID="-487050038">
<Market Name="To Win">
<Participant Name="Warwickshire" Adds="10/11" />
<Participant Name="Durham" Adds="10/11" />
</Market>
</Event>
</EventGroup>
<EventGroup name="Ireland v Scotland 2nd ODI " ID="20395014">
<Event Name="Ireland vs Scotland - 2nd ODI " ID="-1006438617">
<Market Name="To Win>
<Participant Name="Ireland" Adds="10/11" />
<Participant Name="Scotland" Adds="10/11"/>
<Participant Name="Durham" Adds="10/11" />
</Market>
</Event>
</EventGroup>
</Sport>

In this xml file, if the Market Name is "To Win", then i want to fetch all the "Participant Names". Please help me with this.

Code

In Reply To


(This post was edited by apatil65 on Sep 10, 2014, 2:22 AM)


Laurent_R
Veteran / Moderator

Aug 27, 2014, 12:01 PM

Post #2 of 4 (5410 views)
Re: [apatil65] Parse XML file [In reply to] Can't Post

Please provide an example. I fail to see how an XML file might have array references or hash references or both. It is probably a misunderstanding, but please explain and provide sample data.


apatil65
New User

Sep 10, 2014, 8:52 PM

Post #3 of 4 (3270 views)
Re: [Laurent_R] Parse XML file [In reply to] Can't Post

Here is the sample XML:

<Sport Name=“Kabaddi” TimeStamp="10/09/14 04:53:58">
<EventGroup name="Royal" ID="20394662">
<Event Name="Warwickshire vs Durham" ID="-487050038">
<Market Name="To Win">
<Participant Name="Warwickshire" Adds="10/11" />
<Participant Name="Durham" Adds="10/11" />
</Market>
</Event>
</EventGroup>
<EventGroup name="Ireland v Scotland 2nd ODI " ID="20395014">
<Event Name="Ireland vs Scotland - 2nd ODI " ID="-1006438617">
<Market Name="To Win>
<Participant Name="Ireland" Adds="10/11" />
<Participant Name="Scotland" Adds="10/11"/>
<Participant Name="Durham" Adds="10/11" />
</Market>
</Event>
</EventGroup>
</Sport>

In this xml file, if the Market Name is "To Win", then i want to fetch all the "Participant Names". Please help me with this.

Code

In Reply To


Laurent_R
Veteran / Moderator

Sep 11, 2014, 10:28 AM

Post #4 of 4 (3218 views)
Re: [apatil65] Parse XML file [In reply to] Can't Post

It is considered unfair to change a post after someone has answered to it without at least clearly indicating what you add, what you change and what you delete. Now my previous question looks stupid and off-topic, because it was answering to a totally different post in which there was no XML sample and in which you were speaking about an XML file having array references or hash references.

Please don't do that.

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives