string parsing issue

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
User avatar
itsmani1
Forum Regular
Posts: 791
Joined: Mon Sep 29, 2003 2:26 am
Location: Islamabad Pakistan
Contact:

string parsing issue

Post by itsmani1 »

Code: Select all

HTTP/1.1 200 OK 
Connection: keep-alive Date: Tue, 31 Oct 2006 07:26:51 
<?xml version="1.0" encoding="utf-8"?>
<ROOT>
	<DATA xmlns:sql="urn:schemas-microsoft-com:xml-sql">
		<row THISID="1987" THISNAME="Alliance Theatre" ST="GA" />
		<row THISID="2963" THISNAME="Walnut Street Theatre" ST="PA" />
	</DATA>
</ROOT>
Assume the above text is in a string and i wanted to fetch text between "<?xml version="1.0" encoding="utf-8"?>" and "</ROOT>", who can i do so?

any php function?
User avatar
CoderGoblin
DevNet Resident
Posts: 1425
Joined: Tue Mar 16, 2004 10:03 am
Location: Aachen, Germany

Post by CoderGoblin »

Suggest looking through working with regex/RegExp/regular expressions and explanations of how they work:
http://forums.devnetwork.net/viewtopic.php?t=29292
http://forums.devnetwork.net/viewtopic.php?t=29115
http://forums.devnetwork.net/viewtopic.php?t=29318
http://forums.devnetwork.net/viewtopic.php?t=29010
http://forums.devnetwork.net/viewtopic.php?t=25714

Or you could try the XML facilities within PHP if you know the data is well formed... XML Parser Functions
Post Reply