Jump to content

Working with XML?


adamjblakey

Recommended Posts

Hi,

 

I need to be able to search an XML database but unsure on how to do so.

 

Example data from the database is:

 

- <Property>
  <ID>14209</ID> 
  <Partner_Id>15</Partner_Id> 
- <Name>
- <![CDATA[ 
  ]]> 
  </Name>
- <Reference>
- <![CDATA[ NOBR15
  ]]> 
  </Reference>
  <Country>Portugal</Country> 
- <Region>
- <![CDATA[ Madeira
  ]]> 
  </Region>
- <Location1>
- <![CDATA[ Funchal
  ]]> 
  </Location1>
- <Location2>
- <![CDATA[ 
  ]]> 
  </Location2>
  <Type>Villa</Type> 
  <New_Development>0</New_Development> 
  <Leaseback>0</Leaseback> 
  <Investment>N</Investment> 
  <Price>404750.00</Price> 
  <Currency>GBP</Currency> 
  <Bedrooms>5</Bedrooms> 
  <Delivery_Date /> 
- <Short_Description>
- <![CDATA[ 
  ]]> 
  </Short_Description>
- <Long_Description>
- <![CDATA[ A TRUE RURAL RETREAT   IN A TRANQUIL SETTING AMONGST LUSH VEGETATION !   Split level Quinta /Vila - on the Funchal Border - only 12km away from Funchal and 600m above sea level with breathtaking sea and mountainviews !   Only 4 years old !   Large 7070 m2 grounds   Building rights for at least another dwelling to be built on the land - eg. granny cottage or another residential home.     Type: Residential Style: 2 Story Split "Modern Upmarket Vila Design" Bedrooms: 4 "WITH BUILT IN CUPBOARDS" Bathrooms: 3 "MAIN EN-SUITE" Garage: Triple "LOADS OF EXTRA PARKING" Basement: No Size: 495 m² Lot Type: Rectangular Lot Size: 7070 m² n/a "WITH PERMISSION FOR BUILDING ANOTHER HOME ON STAND" Has Suite: Yes Year Built: 2000 "AS NEW" Taxes: €0.00 EUR Condo Fees: €0.00 EUR
  ]]> 
  </Long_Description>
- <Small_Image_URL>
- <![CDATA[ http://www.nobregarealty.com/Shared/Cache/Listing/114108/Photo/7-Gallery.img?_Version=632208272672200000
  ]]> 
  </Small_Image_URL>
- <Large_Image_URL>
- <![CDATA[ http://www.nobregarealty.com/Shared/Cache/Listing/114108/Photo/7-Gallery.img?_Version=632208272672200000
  ]]> 
  </Large_Image_URL>
  <Extra_Images /> 
- <Currencies>
- <Currency>
  <Name>EUR</Name> 
  <Price>599097.10</Price> 
  </Currency>
- <Currency>
  <Name>GBP</Name> 
  <Price>404750.00</Price> 
  </Currency>
- <Currency>
  <Name>USD</Name> 
  <Price>754848.94</Price> 
  </Currency>
  </Currencies>
  </Property>

 

So what i need to do is be able to search each field like an advanced search.

 

I have only ever worked with SQL before so unsure on how to do this?

 

Adam

Link to comment
Share on other sites

I have found a class that i can work with here: http://www.shop24-7.info/32-0-simplexml-alternative-php4.html

 

But what i need to know is how to work with this bit here:

 

    $xml_parser = new sxml;
        $src=implode ('', file ($url));
        $xml_parser->parse($src);
        $xml=$xml_parser->data;

        print_r($xml);

 

I need to know how to add a condition to this e.g. print $XML where $_POST[country] = country

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.