Thread: XML queries

    #1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2001
    Posts
    3
    Rep Power
    0

    XML queries


    Tough questions.

    Say I have the following xml script :

    <DATA>
    <STOCK NAME="Microsoft" INDUSTRY="Software" />
    <QUOTES COMPANY_NAME="Microsoft">
    <TRADE PRICE="56" HIGH="80" />
    <TRADE PRICE="66" HIGH="85" />
    <TRADE PRICE="58" HIGH="79" />
    </QUOTES>

    <STOCK NAME="Intel" INDUSTRY="Hardware" />
    <QUOTES COMPANY_NAME="Intel">
    <TRADE PRICE="42" HIGH="60" />
    <TRADE PRICE="32" HIGH="75" />
    <TRADE PRICE="38" HIGH="62" />
    </QUOTES>
    </DATA>


    How can I parse the code(i'm using PHP) to show only trade data(eg. price) for only Microsoft?
    Does XML have a whereas function or something similar??

    thanx
  2. #2
  3. No Profile Picture
    Python Prophet
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2001
    Location
    Amersfoort, The Netherlands
    Posts
    45
    Rep Power
    13
    Use XSLT, good articles can be found on Devshed:

    http://www.devshed.com/Server_Side/X...cs/XSLBasics1/
    Some people, when confronted with a problem, think I know, I'll use regular expressions. Now they have two problems. - Jamie Zawinski, in comp.lang.emacs

IMN logo majestic logo threadwatch logo seochat tools logo