adamjblakey Posted October 11, 2007 Share Posted October 11, 2007 Hi, I have been working on a site which uses a large XML database (70meg) and have decided against using SimpleXML to work with this and am going to convert the XML database to SQL so it is easier to work with. The database however with be changed once a month as it contains properties. So the database will be completely changed. How would i go about converting the database to SQL? Cheers, Adam Quote Link to comment https://forums.phpfreaks.com/topic/72765-how-to-convert-an-xml-database/ Share on other sites More sharing options...
otuatail Posted October 11, 2007 Share Posted October 11, 2007 what do you me by to SQL. SQL is a language do you mean Microsoft SQLserver. And what is this XML Database XML is a format not a database. Quote Link to comment https://forums.phpfreaks.com/topic/72765-how-to-convert-an-xml-database/#findComment-366982 Share on other sites More sharing options...
otuatail Posted October 11, 2007 Share Posted October 11, 2007 Also this should be in the database forum. Quote Link to comment https://forums.phpfreaks.com/topic/72765-how-to-convert-an-xml-database/#findComment-366984 Share on other sites More sharing options...
adamjblakey Posted October 11, 2007 Author Share Posted October 11, 2007 Sorry i meant MySQL to use PHP to work with it. Quote Link to comment https://forums.phpfreaks.com/topic/72765-how-to-convert-an-xml-database/#findComment-366991 Share on other sites More sharing options...
otuatail Posted October 11, 2007 Share Posted October 11, 2007 This is very confusing when read with original problem. You need to state what it is. you don't simply want to read a database with a PHP webpage ? Quote Link to comment https://forums.phpfreaks.com/topic/72765-how-to-convert-an-xml-database/#findComment-367040 Share on other sites More sharing options...
adamjblakey Posted October 11, 2007 Author Share Posted October 11, 2007 Sorry i will try and explain better. I have a XML database which is 70meg the database contains property's abroad. The site needs to connect to the database and run search like e.g. how many bedrooms, bathrooms etc. I don't want to connect directly to the XML DB so i need to transfer all the data in the XML database to a MySQL database so i can work with it using phpmyadmin and php. Hope that makes more sense. Cheers, Adam Quote Link to comment https://forums.phpfreaks.com/topic/72765-how-to-convert-an-xml-database/#findComment-367051 Share on other sites More sharing options...
MadTechie Posted October 11, 2007 Share Posted October 11, 2007 so you want to import an XML file into MySQL.. is this a one off or an on going action.. in other words is it something your be doing over and over ? Quote Link to comment https://forums.phpfreaks.com/topic/72765-how-to-convert-an-xml-database/#findComment-367056 Share on other sites More sharing options...
adamjblakey Posted October 11, 2007 Author Share Posted October 11, 2007 Yes this is going to be done once a month as there will be new properties so i will need to drop the existing entries and the import again. Quote Link to comment https://forums.phpfreaks.com/topic/72765-how-to-convert-an-xml-database/#findComment-367060 Share on other sites More sharing options...
trq Posted October 11, 2007 Share Posted October 11, 2007 What if instead of having the properties added to an xml file you provided a method of adding them directly to the database? This would eliminate the need for the xml file all together, make this process easier, and make adding new properties much simpler. Quote Link to comment https://forums.phpfreaks.com/topic/72765-how-to-convert-an-xml-database/#findComment-367065 Share on other sites More sharing options...
MadTechie Posted October 11, 2007 Share Posted October 11, 2007 either that, or your need to write an XML extracter and create the table(s) from that, theirs no one line solution i can think of.. PHP & XML Quote Link to comment https://forums.phpfreaks.com/topic/72765-how-to-convert-an-xml-database/#findComment-367071 Share on other sites More sharing options...
adamjblakey Posted October 15, 2007 Author Share Posted October 15, 2007 Hi, I have just realised that i have got a problem here. After looking at the XML date it seems to have extra details which i don't know how to split up. <Property> <ID>319441</ID> <Partner_Id>346</Partner_Id> <Name><![CDATA[]]></Name> <Reference><![CDATA[CerrNov-WNCV1051]]></Reference> <Country>Portugal</Country> <Region><![CDATA[CentralAlgarve]]></Region> <Location1><![CDATA[Paderne]]></Location1> <Location2><![CDATA[]]></Location2> <Type>Villa</Type> <Investment>N</Investment> <Price>250000.00</Price> <Max_Price>0.00</Max_Price> <Currency>EUR</Currency> <Bedrooms>3</Bedrooms> <Short_Description><![CDATA[beautiful new 3 bedroom linked villa of an excellent design and high quality finishings. Fully equipped kitchen with Bosch electrical equipment (washing machine, dishwasher, cooker hob, oven, extractor, micro-wave and fridge/freezer) and many more extras.]]></Short_Description> <Long_Description><![CDATA[beautiful new 3 bedroom linked villa of an excellent design and high quality finishings. Fully equipped kitchen with Bosch electrical equipment (washing machine, dishwasher, cooker hob, oven, extractor, micro-wave and fridge/freezer) and many more extras.]]></Long_Description> <Small_Image_URL><![CDATA[http://www.fisksinternational.co.uk/international/uploaded_images/47062_thumb.jpg]]></Small_Image_URL> <Large_Image_URL><![CDATA[http://www.fisksinternational.co.uk/international/uploaded_images/47062.jpg]]></Large_Image_URL> <Extra_Images> <Extra_Image_URL><![CDATA[http://www.fisksinternational.co.uk/international/uploaded_images/47063.jpg]]></Extra_Image_URL> <Extra_Image_URL><![CDATA[http://www.fisksinternational.co.uk/international/uploaded_images/47064.jpg]]></Extra_Image_URL><Extra_Image_URL><![CDATA[http://www.fisksinternational.co.uk/international/uploaded_images/47065.jpg]]></Extra_Image_URL></Extra_Images> <Currencies> <Currency> <Name>EUR</Name> <Price>250000.00</Price> </Currency> <Currency> <Name>GBP</Name> <Price>168900.00</Price> </Currency> <Currency> <Name>USD</Name> <Price>314994.41</Price> </Currency> </Currencies> </Property> Under <Extra_Images> there is 2 <Extra_Image_URL> and also under <Currencies> there are 3 different currency's. How would i go about adding these as they have the same field names and also i think that there could be only 1 extra image sometimes and also maybe more than 3 currency's. Quote Link to comment https://forums.phpfreaks.com/topic/72765-how-to-convert-an-xml-database/#findComment-369813 Share on other sites More sharing options...
MadTechie Posted October 15, 2007 Share Posted October 15, 2007 either extra records or extra fields or maybe serialize!!.. just an idea Quote Link to comment https://forums.phpfreaks.com/topic/72765-how-to-convert-an-xml-database/#findComment-369868 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.