Jump to content

XML View


tvks

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.