Jump to content

Recommended Posts

I have some html being parsed where the particular tag and values show up two times in the html. I wish to ignore it in the first section but parse it in the next. The first instance occurs in a list.

<ul>
		<li class="prog_1046598 clearfix">
			<span class="prog_name">SHOW NAME</span>
			<span class="prog_info">SHOW INFOspan>
						
					</li>

The second occurs within a class.  Basically the only  thing that is identical is the prog_name but my code still grabs this.

<div class="prog_cols">
												<span class="prog_name">SHOW1</span>
	<div class="prog_time">SHOW TIME</div>
	<div class="prog_desc">SHOW INFO.<br/>
																							</div>

My code is the following. Even though I am using the div class="col th" to parse thru, I still get the prog_name in the span class from the above section. Is there a way to keep this from happening?

$cols=$xpath->query('//div[@class="col th"]');
$aclasses=$xpath->query('//a[@class="channel_sched_link"]');
$progname=$xpath->query('//span[@class="prog_name"]');
$progtime=$xpath->query('//div[@class="prog_time"]');
$progdesc=$xpath->query('//div[@class="prog_desc"]');

  
    
    
foreach ($cols as $col){
				$xcid=$col->getElementsByTagName('a');
				foreach($xcid as $cids){
				$cid[]=$cids->getAttribute('data-channelid');		
						for($x=0; $x<count($cid); $x++){
		foreach ($progname as $name){
			$show[]=$name->nodeValue;
			}
			$scid[]=$cids->getAttribute('data-channelid');
				}
				}		
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.