Reply
Old 05-01-2008, 02:32 AM Php Xml
dlaroche22's Avatar
Skilled Talker

Posts: 81
Name: Dustin Laroche
I'm having a very difficult time parsing XML with PHP. Is there any toolkits or frameworks that would make working with XML easier? The XML file that I am working with is full of data for betting lines. I need to pull this data in and make a well formed grid of the odds, times of games, etc. If there was a way to pull in each xml element as a variable or maybe even an array with named key values that would help out alot. Thanks in advance.
__________________
Under Construction, But A Work In Progress
Webhosting isn't cheap, sponsors are important
http://www.gurucomputerhelp.com
dlaroche22 is offline
Reply With Quote
View Public Profile
 
When You Register, These Ads Go Away!
Old 05-01-2008, 04:37 AM Re: Php Xml
Junior Talker

Posts: 3
PHP has being used by many people by the time of it's creation in and was named as PHP/FI which went all the way to it's 2nd stage, and then it was succeeded by PHP 3.0. Now people use the more modern PHP 5 with much more functions than the previous stages of PHP. Read the History of PHP To find out more of the history of PHP.
panther786 is offline
Reply With Quote
View Public Profile
 
Old 05-01-2008, 06:41 AM Re: Php Xml
tripy's Avatar
Fetchez la vache!

Posts: 2,055
Name: Thierry
Location: In the void
Quote:
Originally Posted by panther786 View Post
PHP has being used by many people by the time of it's creation in and was named as PHP/FI which went all the way to it's 2nd stage, and then it was succeeded by PHP 3.0. Now people use the more modern PHP 5 with much more functions than the previous stages of PHP. Read the History of PHP To find out more of the history of PHP.
And in which way does this relate to the question ???

Dlaroche, I've mostly worked to output XML with PHP, but explain a bit more what you need to do, and how you do it until now and I'll try my best.

By the way, if you are using PHP4, stop...
PHP5 introduced new extensions for handling XML reading and writing, and as PHP4 is dead you better work on an PHP5 version.
__________________
Listen to the ducky: "This is awesome!!!"

tripy is offline
Reply With Quote
View Public Profile
 
Old 05-02-2008, 04:21 AM Re: Php Xml
Novice Talker

Posts: 14
I've mostly worked to output XML with PHP
king0910 is offline
Reply With Quote
View Public Profile
 
Old 05-02-2008, 10:24 AM Re: Php Xml
Plugin-Developer's Avatar
Weightlifting CS Student

Posts: 505
Name: Nick Ohrn
OP - If you're using PHP5, I absolutely recommend the DomDocument class for parsing XML. If you're not using PHP5, you'll have to basically write your own SAX parser, which is a pain in the butt, to be completely honest.

For a great introduction to parsing in PHP5, see this site. If you really need to go the PHP4 route, I guess this is a good place to start.
__________________
Plugin-Developer.com - Custom plugin development to fit your needs. Plugins available for WordPress and Drupal, among others.
Plugin-Developer is offline
Reply With Quote
View Public Profile Visit Plugin-Developer's homepage!
 
Old 05-02-2008, 10:34 AM Re: Php Xml
Inet411's Avatar
Skilled Talker

Posts: 82
Name: programmer
Location: internet
I use phps simple xml




If you have :
Category -
Title -

Category -
Title -

etc....

PHP Code:
$xml_file file_get_contents("http://yoursite.com/file.xml");
$xml = new SimpleXMLElement($xml_file);
foreach (
$xml->Category as $cat) {
     
$title $cat->Title;
echo 
"The category for $title is $cat";

Thats a very small and simplified example but if you lookup simple xml on the php.net website you'll find more detailed uses and many user submitted comments which are very helpful.
Inet411 is offline
Reply With Quote
View Public Profile Visit Inet411's homepage!
 
Reply     « Reply to Php Xml
 

Thread Tools

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

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




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.13935 seconds with 12 queries