spacer

Webref WebRef   Sitemap · Experts · Tools · Services · Newsletters · About i.com

home / programming / php / php4xml / chap10 / 3 To page 1To page 2current pageTo page 4To page 5To page 6To page 7
[previous] [next]

Professional PHP4 XML, Chapter 10: Putting It Together

Developer News
News Flash: Adobe Has iPhone Workaround
Adobe's Flash 10.1 Goes Mobile (Minus iPhone)
A Salute to Visionary CEOs

Querying XML

If our data model is based on XML we'll be querying documents very often. Some examples of the need to query XML are:

Querying an XML document means that we should traverse the XML document looking for particular information; what we do with the information once it is found is beyond the scope of the problem.

Example

Here we'll present a simple example to check how to solve the same problem using different approaches. In this case our example will show an XML file describing cars. This is the XML document:

<cars>
  <car>
    <type>F1</type>
    <brand>Ferrari</brand>
    <model>X1</model>
    <maxspeed>305</maxspeed>
    <hp>800</hp>
  </car>

  <car>
    <type>F1</type>
    <brand>Williams</brand>
    <model>W89</model>
    <maxspeed>298</maxspeed>
    <hp>1000</hp>
  </car>

  <car>
    <type>F1</type>
    <brand>Brabham</brand>
    <model>B01</model>
    <maxspeed>311</maxspeed>
    <hp>1020</hp>
  </car>
</cars>

And the query will be: "Find brand and model of F1 cars that can run at more than 300 kmh".

We have the following options to query an XML document:


home / programming / php / php4xml / chap10 / 3 To page 1To page 2current pageTo page 4To page 5To page 6To page 7
[previous] [next]

internet.commediabistro.comJusttechjobs.comGraphics.com

Search:

WebMediaBrands Corporate Info

Legal Notices, Licensing, Reprints, Permissions, Privacy Policy.
Advertise | Newsletters | Shopping | E-mail Offers | Freelance Jobs

webref The latest from WebReference.com Browse >
Building a Banking Application Home Page with OOP · Mixing Scripting Languages · Review: phpFox, a Social Networking CMS with all the Bells and Whistles
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
Enterprise 2.0: Social Networking in the Cloud · BroadSoft Marketplace Hastens Pace of Telephony Innovation · Review: HTC Hero for Sprint

Created: August 26, 2002
Revised: August 26, 2002

URL: http://webreference.com/programming/php/php4xml/chap10/3/3.html