如何使用 php 执行基于 XML 的动态数据库创建


How to perform Dynamic database creation based on XML using php

示例 -

   <Properties>
<Property>
<Refnumber>…..
<Number>…
<Bulletpoints>
<BulletPoint>List of important items</BulletPoint> 
<BulletPoint>Up to 12 BulletPoint nodes</BulletPoint>
</Bulletpoints>
<Rooms>
<Room>
<Title>name of room 
</Room>
</Rooms>

<Amenity>
 <id> </id>
</Amenity>
</Property>
</Properties>
<Amenities>
<Amenity>
<id </id> 
<Types>
<Type> </Type>
</Types>
</Amenity>
</Amenities>

如何使用php执行基于XML的动态数据库创建,具有不同标签和具有子标签的标签。 是否必须关闭每个标签? 根据上面的XML代码,,一些标签没有关闭。

如果文件不是有效的 XML(缺少结束标记),您将无法正确解析它。

如果您有有效的 XML 文件,则可以使用 SimpleXML 或任何其他基于 PHP 的 XML 库来解析文档并创建专有表结构。