LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 06-29-2004, 01:59 PM   #1
logicdisaster
Member
 
Registered: Jun 2004
Posts: 41

Rep: Reputation: 15
Php & Xml


okay im passing xml data in a form so i have

$data = $_POST['xmlField'];
$xml_parser = xml_parser_create();

xml_parser_set_option($xml_parser, XML_OPTION_CASE_FOLDING, false);
//xml_set_object($xml_parser, $this);
xml_set_element_handler($xml_parser, "tag_open", "tag_close");
xml_set_character_data_handler($xml_parser, "cdata");


// Parse the XML
//$parse_results = xml_parse($xml_parser, $data);
xml_parse_into_struct($xml_parser, $data, $structure, $index);

// Clean up
xml_parser_free($xml_parser);


//$xmlObj = simplexml_load_string($xmlContent);
foreach($structure as $s)
{
if(!isset($s['value']))
{
$s['value'] = "";
}
print("{$s['tag']}, {$s['type']}, {$s['level']}, {$s['value']}<br>");
}

but that doesn out put anything the post data is <?xml version='1.0' ?><game><score>1789</score><time>115</time></game>

ive just echoed the data so i know its being received but how do i use it as xml data? How do i parse through it?
 
Old 06-29-2004, 04:05 PM   #2
coolman0stress
Member
 
Registered: Jun 2003
Location: Toronto, Ontario, Canada
Posts: 288

Rep: Reputation: 30
Did you define the "tag_open", "tag_close" and "cdata" functions btw?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
XML in PHP Vort3x Linux - Software 1 12-20-2004 09:12 PM
php & xml install question benjam Linux - Newbie 2 07-08-2004 12:41 PM
PHP w/ XML ridertech Linux - Software 0 05-05-2004 02:50 AM
Php Vs. Xml zetsui Programming 4 02-18-2004 12:57 PM
PHP and XML Bill Barrington Linux - Software 0 06-22-2003 08:08 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 08:45 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration