Results 1 to 3 of 3

Thread: begin to parse?

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Feb 2006
    Posts
    607

    begin to parse?

    Hi,
    I was actually wondering if one of you can EXPLAIN to me how I would parse the following:

    It is a schedule for 2008 soccer.

    http://web.mlsnet.com/mls/components...ason_print.jsp

    I looked at the source, and its relatively easy source, so this is what I want to do:

    I enter a loop to look for <strong> </strong> in between that is the date, so I make a variable for the date.

    I make another loop that reads the file until it reaches the next <strong>.

    But this is where I am having problems visualizing:

    <div class="sm">
    <strong>Saturday,
    March 29, 2008</strong>
    </div>
    <div class="xsm gameday">Toronto FC at Columbus Crew, 4:00 p.m.
    <span class="tv">DK, MLSLIVE.tv
    </span>
    <br>Chicago Fire at Real Salt Lake, 6:00 p.m.
    <span class="tv">DK, MLSLIVE.tv
    </span>
    <br>Houston Dynamo at New England Revolution, 7:30 p.m.
    <span class="tv">FSC, FSE
    </span>
    <br>D.C. United at Kansas City Wizards, 8:00 p.m.
    <span class="tv">DK, MLSLIVE.tv
    </span>
    <br>Los Angeles Galaxy at Colorado Rapids, 9:30 p.m.
    <span class="tv">FSC, FSE, HDNet
    </span>
    <br>
    </div>
    <div class="sm">
    <strong>Sunday,
    March 30, 2008</strong>
    </div>
    <div class="xsm gameday">Chivas USA at FC Dallas, 3:00 p.m.
    <span class="tv">TeleFutura
    </span>
    <br>
    </div>
    <div class="sm">
    <strong>Thursday,
    April 3, 2008</strong>
    </div>
    <div class="xsm gameday">New England Revolution at Chicago Fire, 8:30 p.m.
    <span class="tv">ESPN2, Deportes
    </span>
    <br>San Jose Earthquakes at Los Angeles Galaxy, 10:30 p.m.
    <span class="tv">ESPN2, Deportes
    </span>
    <br>
    </div>
    as you see the acutally [team] at [team] don't have any HTML tags marked around them so how would I get the information?

    By the way, I am just outputting into a CSV, or XML, any organzied manner which I can use later on for future projects.

  2. #2
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    40,109

    Re: begin to parse?

    I notice that the lines that have teams are the only ones that have <br> tags. In fact, those tags are only there in that example when they are followed either by the teams, or by nothing. If that pattern is consistent throughout the file, then you can use that tag to find the rows that have team data (look for the tag, and if there is anything after it, it's a team).
    My usual boring signature: Nothing

  3. #3
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: begin to parse?

    You'd probably need to use regular expressions here, for example, a set of words (including whitespace), containing "at" and followed by a comma and a time. You could come up with some sort of a regular expression for that and capture the information there.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width