Reply to Parsing - Reading data within a tag

Your name:

Reply:


Posted by Steve on 10/11/05 23:35

Hi,

I am new to XML and PHP and have a question that I hope someone could
answer.

Some background on my problem.
I am receiving an XML message over TCP/IP and need to access data
within the tags of the message.

Message example:
<message title="begin"
no="1"><description>Start</description></message>


Now I know I can get the data from the description tag by:

$xmlstr =<<<EOT
<message title="begin"
no="1"><description>Start</description></message>
EOT;

$xml = simplexml_load_string($xmlstr);
echo ($xml->description[0]);


My question is, how do I access 'title' or 'no' ?
Is it possible?

I cannot change the format of the data sent to me.
I am using PHP 5.0.5

Any help is appreciated.

Also, is this the best way of parsing the XML message?

Thank you

Steve

[Back to original 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

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