xpath problem

This is a discussion on "xpath problem" within the Other Programming Languages section. This forum, and the thread "xpath problem are both part of the Program Your Website category.


 Subscribe in a reader

Go Back   Webforumz.com > Main Forums > Program Your Website > Other Programming Languages

Notices




Reply
 
LinkBack Thread Tools
  #1  
Old Apr 8th, 2008, 10:01
Reputable Member
Join Date: Dec 2005
Location: scotland
Age: 27
Posts: 160
Thanks: 1
Thanked 0 Times in 0 Posts
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.
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

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 Web Page Design 8 Dec 1st, 2007 09:08
Need help on xsl and xpath emeakashah Other Programming Languages 13 Dec 13th, 2006 11:53
xpath node names Don Logan Other Programming Languages 0 Mar 23rd, 2006 14:19


All times are GMT. The time now is 02:32.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

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