tvks Posted November 24, 2006 Share Posted November 24, 2006 Dear all,I have an XML file. I seek to design a function which reads the contents of a XML file and fetches only the particular tag and its child nodes which were passed to it. For example, assuming this is my XML file.[color=green]<?xml version="1.0" encoding="ISO-8859-1"?> <contacts> <entry uri="sip:[email protected]"> <name>Vinay</name> <sip> sip:[email protected] </sip> <Number> 9885821530 </Number> </entry> <entry uri="sip:[email protected]"> <name>Vivek</name> <sip> sip:[email protected] </sip> <Number> 9885821530 </Number> </entry> <entry uri="sip:[email protected]"> <name>Vinod</name> <sip> sip:[email protected] </sip> <Number> 9885821530 </Number> </entry> </contacts>[/color]and the function should be like this[color=green] function fetch($filename, $tagname)[/color]and when I call this fetch function like this [color=green] fetch("abc.xml","sip:[email protected]")[/color]it must return to me[color=green] <name>Vinay</name> <sip> sip:[email protected] </sip> <Number> 9885821530 </Number>[/color]Thanx in advance for any help,With regards Link to comment https://forums.phpfreaks.com/topic/28311-xml-view/ Share on other sites More sharing options...
CheesierAngel Posted November 24, 2006 Share Posted November 24, 2006 You can always use a PEAR packages that does this all for you ...- [url=http://pear.php.net/search.php?q=XML&in=packages&x=0&y=0]http://pear.php.net/search.php?q=XML&in=packages&x=0&y=0[/url] Link to comment https://forums.phpfreaks.com/topic/28311-xml-view/#findComment-129574 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.