Parsing XML

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
fishwolf
Forum Newbie
Posts: 1
Joined: Mon Apr 12, 2010 6:05 am

Parsing XML

Post by fishwolf »

Hi

I have a simple php code for parsing a simple xml.

i use the xml_parse functions with handler mode.

With php 4 work fine, with php 5 i lost some space.

"La Chiesaè avvocata della giustizia e dei povèri, precisamente perché non si identifica con gli interessi di partito."

help me, please

Thanks

<?php

function characterData($parser, $data)
{
echo "DATA=".$data."<br>";
}

$XML = '<?xml version="1.0" encoding="utf-8"?><MMDB Version="4.1"><UPDATEINDEX><IDIndex>696737</IDIndex><AREAS Records="1"><AREA><ID>9</ID><FIELDS Records="1"><FIELD><ID>41</ID><ITEMS Records="1"><ITEM><Value>La Chiesa è avvocata della giustizia e dei povèri, precisamente perché non si identifica con gli interessi di partito.</Value><Param></Param><Type></Type><Code></Code><ImageHex></ImageHex><ImageExt></ImageExt></ITEM></ITEMS></FIELD></FIELDS></AREA></AREAS></UPDATEINDEX></MMDB>';

$xml_parser = xml_parser_create();

xml_set_character_data_handler($xml_parser, "characterData");

xml_parse($xml_parser, $XML, true);

xml_parser_free($xml_parser);

?>
User avatar
AbraCadaver
DevNet Master
Posts: 2572
Joined: Mon Feb 24, 2003 10:12 am
Location: The Republic of Texas
Contact:

Re: Parsing XML

Post by AbraCadaver »

What do you mean "with php 5 i lost some space"?
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
Post Reply