well with php xpath, You can get the data by using :
$xpath=3D new XPath("file.xml");
$nodedata =3D $xpath->getData("/ws/result");
#this would/should return true, but if you didn't know if there was a=20
result you would have to do something like.
$nodes=3D $xpath->match("/ws");
foreach ($nodes as $node){
echo $node."<br>";
#would return result
$nodedata =3D $xpath->getData($node);
#would return true
}
Now with child nodes that have children, you are in a whole different=20
ballgame, and really the documentation covers that, but basically you=20
would have to test to see if the child that returns in the loop has=20
children, and if so, dig, or make it a link, and change your node path=20=
when you follow the link. Hope this helps.
--James
On Jul 13, 2004, at 6:52 AM, BeDii KaYa wrote:
> Hi. I have an xml document which is generated with NuSOAP. I would=20
> like to parse the result of NuSOAP (xml string) with xpath and want to=20=
> use it php.
> =A0
> NuSOAP generates something like :
> =A0
> <ws>
> <result>true</result>
> <login>
> <session_id>XXXXX</session_id>
> </login>
> </ws>
> =A0
> How can i parse this string and use it with php via XPATH? I have=20
> tried GetDATA, importstring, etc but failed. Please suggest me a=20
> solution for parsing the data with an example.
> =A0
> Thanks for your comprehension.
>
> Do you Yahoo!?
> New and Improved Yahoo! Mail - 100MB free storage!
--James Hughbanks
Mikro-Data Engineering Dept.
su...@mi...
1-866-457-6287
http://www.mikro-data.net
|