Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Retrieve XML content in PHP

Status
Not open for further replies.

JumpStarter

Programmer
Joined
Apr 26, 2003
Messages
7
Location
IN
Hi,

I have an xml document that looks like this :

<root>
<abstract id="001">
<heading>Welcome to XML</heading>
<p>This is a text</p>
<p>This is also a text</p>
</abstract>
</root>

I am using PHP 4 and want to fire a XPath eg: "/root/abstract" which has to return the complete abstract xml content. The output i want is :

<abstract id="001">
<heading>Welcome to XML</heading>
<p>This is a text</p>
<p>This is also a text</p>
</abstract>

Its something that MSXML gives with the .xml property. Could i have the PHP 4 code or web site references where i can get information on this.

P.S. This option is available in PHP 5 simple_xml library as the asXML() property.

Thanks for the help in advance.

Regards,

NewTerminator
 
check this out.

______________________________________________________________________
There's no present like the time, they say. - Henry's Cat.
 
Thanks for the link.

I have had a look at it. Actually i do not want the entire document returned as XML only a part of it. And the next major problem is i am not good at PHP. Worked all my life on MSXML XPATH & DOM ;). Still haven't found the answer :(.
 
if you just want to strip certain tags, look at preg_replace() or str_replace() , also fopen() and if you wish to re-write the file, fwrite() or fputs()
all can be found on www.php.net/manual/en/function.[function-name].php

______________________________________________________________________
There's no present like the time, they say. - Henry's Cat.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top