2014-10-10 131 views
0

Hy 我试图找出一个XML文件后的数据库结构。我相对于这种复杂性来说是新的。创建mysql数据库和导入XML

创建完成后我需要导入它。问题是我认为它是使用连接创建的xml。你能给我一些建议如何处理这个问题。在我的XML一行看起来somethinh这样的:

<listing> 
<id>GS0147</id> 
<date_added>2014-10-9</date_added> 
<property_type>residential</property_type> 
<property_subtype>appartment</property_subtype> 
<listing_type>rent</listing_type> 
<geo_location> 
<lat>00000</lat> 
<lon>26.13860</lon> 
</geo_location> 
<address> 
<county>Bucuresti Ilfov</county> 
<city>Bucuresti</city> 
<neighbourhood>Berceni</neighbourhood> 
<street>Ion Iriceanu</street> 
<street_number/> 
</address> 
<price> 
<price>1100</price> 
<currency>EUR</currency> 
<price_type>full</price_type> 
<price_eur>1100</price_eur> 
<rent_period/> 
</price> 
<area>35</area> 
<land_area/> 
<title> 
<![CDATA[ Inchiriere garsoniera Berceni,Oltenitei,Iriceanu ]]> 
</title> 
<description> 
<![CDATA[ 
&lt;p&gt;&lt;span style=&quot;font-size: medium;&quot;&gt;&lt;span style=&quot;font-family: Verdana;&quot;&gt;&lt;strong&gt;&amp;nbsp;Va ofer spre inchiriere o garsoniera in zona&amp;nbsp;&lt;span style=&quot;line-height: 115%;&quot;&gt;BERCENI,&amp;nbsp; Oltenitei, vila, confort, contorizata total, aer conditionat, catv, LCD, receiver, internet, balcon, foisor curte, strada necirculata, parcare, termen lung.Investitia lunara este de 1100 ron.&lt;/span&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; 
]]> 
</description> 
<images> 
<image> 
http://soft.echiparenet.ro/images/propertiessite/img_1240_15230.jpg 
</image> 
<image> 
http://soft.echiparenet.ro/images/propertiessite/img_1240_15231.jpg 
</image> 
<image> 
http://soft.echiparenet.ro/images/propertiessite/img_1240_15232.jpg 
</image> 
<image> 
http://soft.echiparenet.ro/images/propertiessite/img_1240_15233.jpg 
</image> 
<image> 
http://soft.echiparenet.ro/images/propertiessite/img_1240_15234.jpg 
</image> 
<image> 
http://soft.echiparenet.ro/images/propertiessite/img_1240_15235.jpg 
</image> 
<image> 
http://soft.echiparenet.ro/images/propertiessite/img_1240_15236.jpg 
</image> 
<image> 
http://soft.echiparenet.ro/images/propertiessite/img_1240_15237.jpg 
</image> 
<image> 
http://soft.echiparenet.ro/images/propertiessite/img_1240_15238.jpg 
</image> 
</images> 
<url> 
http://www.gabrielstefan.ro/garsoniera-de-inchiriat-berceni-bucuresti-1236.html 
</url> 
<rooms>1</rooms> 
<bathrooms>1</bathrooms> 
<kitchens>0</kitchens> 
<balconies>0</balconies> 
<appartment_type>3</appartment_type> 
<floor>2</floor> 
<building_floors>2</building_floors> 
<air_conditionning>0</air_conditionning> 
<internet>0</internet> 
<television>0</television> 
<security>0</security> 
<phone>0</phone> 
<heatting_system/> 
<furnished/> 
<wather>0</wather> 
<gas>0</gas> 
<electricity>0</electricity> 
<street_front>0</street_front> 
<termopan>0</termopan> 
<wood_floors>0</wood_floors> 
<parking/> 
<garage/> 
<paperwork/> 
<build_year>2006</build_year> 
<build_materials/> 
</listing> 
+0

拉开xml。找出哪些标签/孩子可以重复 - 那些进入子表。其他任何东西都可以进入主表。 – 2014-10-10 19:12:38

+0

我做到了。我创建了表格,但是您知道如何同时导入表格。有没有办法在我的相关表中进行多重导入? – 2014-10-11 09:19:06

回答

0

我不知道你有多少数据,但如果是我,我会试图让有关各领域的变化计数。这可以帮助确定什么是常见的,什么是更独特的。计数越高,它就越有共同之处。

您可以通过导入它并获取每个字段的计数(假设它不太大以至于无法处理)来进行第一次传递。如果你不需要所有的字段,你可以导出你需要的字段,以减少你需要处理的数据的总体大小。

一旦你掌握了正在处理的内容,就可以开始真正设计模式。 希望这有助于。