Web Design and Development Forums

xpath problem

This is a discussion on "xpath problem" within the XML, RSS & Atom section. This forum, and the thread "xpath problem are both part of the Program Your Website category.

Old Apr 8th, 2008, 10:01   #1 (permalink)
Reputable Member
 
Join Date: Dec 2005
Location: scotland
Age: 26
Posts: 135
xpath problem

i have a xml doc like this
Code: Select all
<?xml version="1.0" encoding="ISO-8859-1" standalone="yes"?>
<root>
    
    <property>
        <id>535054</id>
        <date>2008-03-02 21:33:19</date>
        <ref>ln233-3</ref>
        <price>228000</price>
        <price_freq>sale</price_freq>
        <type>
            <en>Villa</en>
            <es>Chalet</es>
            <de>Villa</de>
            <fr>Villa</fr>
        </type>
        <town>Alcazares, Los</town>
        <province>Murcia</province>
        <location_detail>30710 Tercia, La</location_detail>
        <beds>3</beds>
        <baths>2</baths>
        <pool>1</pool>
        <desc>
        <en>Excellent value for money and investment opportunity. very favourable payment terms; only 10% initial staged payment. 

Villa mirian is  a 3 bed of 76,20m2 build la tercia real is ideally located at the foot of the &quot;sierra de columbares&quot; natural park, 15 mins from the shores of the mar menor and san javier airport and also close to murcia city and the new murcia international airport at corbera, due to open 2008/2009. there a number of golf resorts in the surrounding area, including 1 walking distance. la tercia real is situated in a beautiful, peaceful rural setting and yet so close to all the amenities, and is ideal for permanent or winter residence. within the resort are vast green areas, wide avenues and tree-lined streets, and communal gardens and swimming pools. the original hacienda, a listed building, will remain in the heart of the community and be refurbished to provide a focal point for social activities and &quot;the village&quot;, spanish pueblo will house restaurants, bars and shops and amenities. 

Also available on a 308m2 plot at 242,500 larger plots available price on application


Also available as a 2bed property from 193,000 
 

availability: for sale  
    
 type:   new  
 style:   villa  
 bed:   3  
 bath:   2  
 pool:   communal pool, private pool option  
 garden:    private plot &amp; garden  
 parking:   parking off-road  
 size:   plot min 250m2 
 build:  76,20m2</en>
        <es></es>
        <de></de>
        <fr></fr>
        </desc>
        <images>
            <image id="1">
                <url>http://images.com/images/property/535/535054/1_large.jpg</url>
                <title>
        <en>Image 1</en>
                </title>
            </image>
            <image id="2">
                <url>http://images.com/images/property/535/535054/2_large.jpg</url>
                <title>
        <en>Image 2</en>
                </title>
            </image>
            
        </images>
    </property>
    <property>
        <id>535055</id>
        <date>2008-02-17 00:53:32</date>
        <ref>ln233</ref>
        <price>193000</price>
        <price_freq>sale</price_freq>
        <type>
            <en>Villa</en>
            <es>Chalet</es>
            <de>Villa</de>
            <fr>Villa</fr>
        </type>
        <town>Alcazares, Los</town>
        <province>Murcia</province>
        <location_detail>30710 Tercia, La</location_detail>
        <beds>2</beds>
        <baths>2</baths>
        <pool>1</pool>
        <desc>
        <en>Excellent value for money and investment opportunity. very favourable payment terms; only 10% initial staged payment. 

Villa Mirian is 2 bed, 2 bath on min plot 250m2 &amp; build 62,11m2.  
La Tercia Real is ideally located at the foot of the &quot;sierra de columbares&quot; natural park, 15 mins from the shores of the mar menor and San Javier airport and also close to Murcia city and the new Murcia international airport at Corvera, due to open 2008/2009. there a number of golf resorts in the surrounding area, including 1 walking distance. la tercia real is situated in a beautiful, peaceful rural setting and yet so close to all the amenities, and is ideal for permanent or winter residence. within the resort are vast green areas, wide avenues and tree-lined streets, and communal gardens and swimming pools. the original hacienda, a listed building, will remain in the heart of the community and be refurbished to provide a focal point for social activities and &quot;the village&quot;, spanish pueblo will house restaurants, bars and shops and amenities. 

Also available on a plot of 300m2 priced at 211,000 also available on larger plots price on application

Or a 3 bed Mirrian from 228,000 



availability: for sale  
    
 type:   new  
 style:   villa  
 bed:   2   
 bath:   2  
 pool:   communal pool, private pool option  
 garden:    private plot &amp; garden  
 parking:   parking off-road  
 size:   plot min 250m2  
 build:62,11m2 </en>
        <es></es>
        <de></de>
        <fr></fr>
        </desc>
        <images>
            <image id="1">
                <url>http://images.com/images/property/535/535055/4_large.jpg</url>
                <title>
        <en>Image 4</en>
                </title>
            </image>
            <image id="2">
                <url>http://images.com/images/property/535/535055/5_large.jpg</url>
                <title>
        <en>Entrance and shopping avenue</en>
                </title>
            </image>
            <image id="3">
                <url>http://images.com/images/property/535/535055/6_large.jpg</url>
                <primary>1</primary>
                <title>
        <en>Showhouse of Mirrian</en>
                </title>
            </image>

.........
I'm looking to only show the properties in Alicante, so i have this
PHP: Select all

foreach ($xml->xpath('//property[province="Alicante"]') as $alicante) {

//do something....


this is not working, can someone tell me why? it only loops the 1st property?

Also I would like to split the results onto different pages. What is the best way to do this?

ta
__________________

Last edited by karloff; Apr 8th, 2008 at 12:43.
karloff is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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 On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
First image problem and inline list problem konnor5092 CSS Forum 8 Dec 1st, 2007 09:08
Need help on xsl and xpath emeakashah XML, RSS & Atom 13 Dec 13th, 2006 11:53
xpath node names Don Logan XML, RSS & Atom 0 Mar 23rd, 2006 14:19



Latest Updates

All Points SEO Security Advisory - CHECK YOUR SITE NOW!

Creative Coding :: February 2008

Webforumz is sponsored by: WESH UK Web Hosting
All times are GMT. The time now is 23:02.

Sleep Study Scoring :: Free Bet :: Website Templates :: Online Betting :: Bookmakers :: Funny Quotes :: Internet Recruitment Software :: Microsoft CRM Experts :: Online Casino :: Decorated Christmas Trees :: Midwife Forums :: Football Betting :: Ecommerce Software :: Web Hosting :: Football Stats :: Dry Cleaning Collection :: xtreme wales - extreme clothing :: Apuestas :: Sharepoint Consultants :: Website Optimisation :: Office Clearance London :: Sharepoint Experts :: Sports Betting :: Casino :: Website Templates :: Web Design Development India :: Online Gambling

Powered by: vBulletin Version 3.7, Copyright ©2000 - 2008, Jelsoft Enterprises Limited.
© 2003-2008 Webforumz.com : All Rights Reserved
Search Engine Friendly URLs by vBSEO 3.2.0 RC6


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59