You are here: Re: renaming <tag?> « PHP Programming Language « IT news, forums, messages
Re: renaming <tag?>

Posted by newsreader on 11/09/48 11:47

TheTeapot wrote:
> This is PHP?? I don't think so. If you told us something like your
> name so we can talk to you, or what software you are using or something
> like that, then we might be able to help you.
>
> preg_replace might help, if I understand your problem correctly (but I
> can't be sure, so I haven't given a full example).
>
> TheTeapot

It's cool, I sort of hacked together a solution that did the job. It
might not be the best
code but it worked. I had to replace the first <field> with <un> and
the second <field>
with <description>.

$filename = "dg3.xml";
$handle = fopen($filename, "r");
$contents = fread($handle, filesize($filename));
$simple = $contents;
$p = xml_parser_create();
xml_parse_into_struct($p, $simple, $index);
xml_parser_free($p);
for ($i=0; $i <= count($index); $i++) {
if (is_numeric($index[$i]['value']) and (($index[$i]['level']) == 3))
{
echo "<un>".$index[$i]['value']."</un>";
} elseif (is_string($index[$i]['value']) and ($index[$i]['level'] ==
3)) {
echo "<description>".$index[$i]['value']."</description>";
}
}

Thanks for the suggestion.
regards.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация