Webmaster Forum

Go Back   Webmaster Forum > Web Development > Coding Forum

Coding Forum Problems with your code? Discuss coding issues, including JavaScript, PHP & MySQL, HTML & CSS, Flash & ActionScript, and more.


 
 
LinkBack Thread Tools Display Modes
Prev Previous Post   Next Post Next
Old 06-02-2009, 09:01 AM   #1 (permalink)
Contributing Member
 
Join Date: 07-16-08
Posts: 62
iTrader: 1 / 100%
Latest Blog:
None

flint is liked by many
Parsing Huge xml file with php

I am may have bitten off more then I chew but I am trying to parse an xml report from the noaa. The problem I am having is getting the attributes to pick up right in the parse. I may be going about this the complete wrong way. Please advise.

link of the xml file:
http://www.weather.gov/forecasts/xml...=rhm&pwwa=pwwa


Code for parsing the start and end times and the high and low temperature. This is not working, and I still have alot more to parse.
PHP Code:
$objDOM = new DOMDocument();
 
$objDOM->load("weather.xml"); //make sure path is correct


  
$note $objDOM->getElementsByTagName("time-layout");
  
$temp_max $objDOM->getElementsByTagName("temperature type=\"maximum\"");
  
$temp_min $objDOM->getElementsByTagName("temperature type=\"minimum\"");
  
// for each note tag, parse the document and get values for
// tasks and details tag.

while ($i 7) {

 foreach( 
$note as $value )
  {
   
$start_time $value->getElementsByTagName("start-valid-time");
   
$start_times  $start_time->item($i)->nodeValue;

  } 
  
   foreach( 
$note as $value )
  {
   
$end_time $value->getElementsByTagName("end-valid-time");
   
$end_times  $end_time->item($i)->nodeValue;

  } 
  
   foreach( 
$temp_max as $value )
  {
   
$temp_m $value->getElementsByTagName("value");
   
$temp_max  $temp_m->item($i)->nodeValue;

  } 
  
   foreach( 
$temp_min as $value )
  {
   
$temp_mi $value->getElementsByTagName("value");
   
$temp_mini  $temp_mi->item($i)->nodeValue;

  } 
flint is offline  
Add Post to del.icio.us
Reply With Quote
Go Back   Webmaster Forum > Web Development > Coding Forum

 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
ASP Parsing? padmaja SEO Forum 3 05-23-2006 11:19 PM
Parsing keywords John Scott Google Forum 2 04-03-2004 09:43 PM


Sponsor Links
Get exposure! Contextual Links V7N SEO Blog V7N Directory


All times are GMT -7. The time now is 08:26 AM.
© Copyright 2008 V7 Inc
Powered by vBulletin
Copyright © 2000-2009 Jelsoft Enterprises Limited.


Search Engine Optimization by vBSEO 3.3.0 ©2009, Crawlability, Inc.