Bluehost.com Web Hosting $6.95

XML DOM

This is a discussion on XML DOM within the PHP General forums, part of the PHP Programming Forums category; I have an XML document as a string $strXml, that looks a little like this: <recordset> <row&...


Go Back   Usenet Forums > PHP Programming Forums > PHP General

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 11-03-2003
Ian Williams
 
Posts: n/a
Default XML DOM

I have an XML document as a string $strXml, that looks a little like this:

<recordset>
<row>
<userid>1</userid>
<username>Bob</username>
<password>Rover</username>
</row>
<row>
<userid>2</userid>
<username>Fred</username>
<password>Fido</username>
</row>
</recordset>

What's the best way to grab a single value from this document? In the past
(in
VB), I have loaded the XML into a DOM Document, and used an XPath query to
select the data I want, and then bung the output into a string.

Any suggestions?

Thanks
Ian
Reply With Quote
  #2 (permalink)  
Old 11-03-2003
Burhan Khalid
 
Posts: n/a
Default Re: [PHP] XML DOM

Ian Williams wrote:
> I have an XML document as a string $strXml, that looks a little like this:
>
> <recordset>
> <row>
> <userid>1</userid>
> <username>Bob</username>
> <password>Rover</username>
> </row>
> <row>
> <userid>2</userid>
> <username>Fred</username>
> <password>Fido</username>
> </row>
> </recordset>
>
> What's the best way to grab a single value from this document? In the past
> (in
> VB), I have loaded the XML into a DOM Document, and used an XPath query to
> select the data I want, and then bung the output into a string.
>
> Any suggestions?


You can do the same bunging in PHP if your php setup has domxml enabled.
Or you can use the (faster, but batch-like) SAX parser.

More information : http://www.php.net/xml

--
Burhan Khalid
phplist[at]meidomus[dot]com
http://www.meidomus.com
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 02:16 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0