How to parse a string in 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
PHP_UPS
Forum Newbie
Posts: 2
Joined: Fri Aug 11, 2006 10:55 am

How to parse a string in xml?

Post by PHP_UPS »

Hi all,

In PHP, xml_parser() function works only for xml documents. But I have a string containing XML tags. And xml_parser() is not working for that. So plz someone show me a way to parse an XML string in PHP.

Thanking you.
User avatar
Uranium-235
Forum Newbie
Posts: 13
Joined: Tue Aug 08, 2006 3:57 pm

Post by Uranium-235 »

as far as I know it should work. PHP's XML parser takes a string of XML data as the second argument.
User avatar
Ambush Commander
DevNet Master
Posts: 3698
Joined: Mon Oct 25, 2004 9:29 pm
Location: New Jersey, US

Post by Ambush Commander »

If you want to do it quick-n-dirty, just wrap the text in a top-level tag like <all> or something. Then parsing should work.
Post Reply