Go to Post Success is inspiring high schoolers to get real world experiance through internships with their sponsors. - Pamela [more]
Home
Go Back   Chief Delphi > Technical > IT / Communications > Website Design/Showcase
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Spotlight this post!  
Unread 25-03-2003, 23:28
Trashed20's Avatar
Trashed20 Trashed20 is offline
Boom, Shawalala Boom!
#0862 (PCEP Lighting)
 
Join Date: Jan 2002
Location: Canton, MI
Posts: 528
Trashed20 will become famous soon enough
Send a message via AIM to Trashed20
Listen-to xml parsing example thingie

well, i got bored one day and tried some xml parsing based on some examples i found on the web for Listen-to. don't know if anyone is interested. Prolly not very efficient but hey. I basically just made it output an image (which you can already do) but you could do anything you want with the data. comments are good

PHP Code:
<?php
$file
"http://www.listen-to.com/xml.php/trashed20";
$depth = array();
$data1=array();


function 
startElement($parser$name$attrs) {
global 
$name;
    global 
$depth;
    for (
$i 0$i $depth[$parser]; $i++) {}
    
$depth[$parser]++;
}

function 
endElement($parser$name) {
    global 
$depth;
    
$depth[$parser]--;
}

function 
characterData($parser$data) {
global 
$data1;
if (
$data!="    "){$data1[] =$data;}}

$xml_parser xml_parser_create();
xml_set_element_handler($xml_parser"startElement""endElement");
xml_set_character_data_handler($xml_parser"characterData");
if (!(
$fp fopen($file"r"))) {
    die(
"could not open XML input");
}

while (
$data fread($fp4096)) {
    if (!
xml_parse($xml_parser$datafeof($fp))) {
        die(
sprintf("XML error: %s at line %d",
                    
xml_error_string(xml_get_error_code($xml_parser)),
                    
xml_get_current_line_number($xml_parser)));
    }
}
xml_parser_free($xml_parser);

header ("Content-type: image/jpeg");
$im = @imagecreatefromjpeg ("temp2.jpg"); 
$tc  imagecolorallocate ($im255255255);
$time=date("m/d/y g:i a",$data1[11]);
$track=$data1[7];
$group=$data1[3];
imagestring ($im32307$timeblack);
imagestring ($im312631$groupblack);
imagestring ($im313652$trackblack);
imagejpeg ($im,"",85);
?>
__________________
Where has all the fun gone?

Last edited by Trashed20 : 26-03-2003 at 06:58.
 


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

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
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
XML Parsing Jack FIRST Scouting Network 1 12-10-2003 13:36
XML And Link Raven_Writer Website Design/Showcase 13 26-09-2003 17:24
xml Jack FIRST Scouting Network 0 01-09-2003 16:23
[Tech] - XML Parsing Jack FIRST Scouting Network 3 20-05-2003 16:42
Does FIRST listen to teams? archiver 2001 5 24-06-2002 04:01


All times are GMT -5. The time now is 15:37.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi