Re: Urgent! Please help me! Getting data via XPATH!
Brought to you by:
bs_php,
nigelswinson
|
From: Peter R. <php...@pe...> - 2004-07-13 15:33:56
|
On Tuesday 13 Jul 2004 11:52, BeDii KaYa wrote:
> Hi. I have an xml document which is generated with NuSOAP. I would like=
to
> parse the result of NuSOAP (xml string) with xpath and want to use it p=
hp.
>
> NuSOAP generates something like :
>
> <ws>
> <result>true</result>
> <login>
> <session_id>XXXXX</session_id>
> </login>
> </ws>
>
> How can i parse this string and use it with php via XPATH? I have tried
> GetDATA, importstring, etc but failed. Please suggest me a solution for
> parsing the data with an example.
<?php
=A0 =A0include('XPath.class.php');
=A0 =A0$xml =3D new XPath();
$xmlstring =3D "<ws>
<result>true</result>
<login>
<session_id>XXXXX</session_id>
</login>
</ws>";
$xml->importFromString($xmlstring);
print $xml->getData('/ws[1]/result[1]');
print $xml->getData('/ws[1]/login[1]/session_id[1]');
?>
|