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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Searching XML Dataset with PHP 4

Status
Not open for further replies.

overyde

Programmer
May 27, 2003
226
ZA
Hi,
Is it possible to search within an xml dataset using php 4.
I know PHP 5 has SOAP but I have not made the radical jump yet.

What I mean is as below:
Code:
<icecream>
  <type>
  Low Fat
    <flavour>
    Strawberry
    </flavour>
    <flavour>
    Vanilla
    </flavour>
  </type>
  <type>
  Full Cream
    <flavour>
    Strawberry
    </flavour>
    <flavour>
    Vanilla
    </flavour>
  </type>  
</icecream>

Then the php would be (not parsed correctly-only for theory)
Code:
$xmlresultset = "select * from icecream where type = fullcream"

while ($xmlresultset)
 {
   $flavour = $xmlresultset[flavour];
}


Reality is built on a foundation of dreams.
 
It would be a round about way of getting to it, but there is a function in php4 to handle xml. It's rather combersome, but I use it for some of my xml.


xml_parse_into_struct function will create an array out of the xml database and then you can run through the array for the values you need.

***************************************
J. Jacobs
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top