开发者

XML to MySQL Table Structure

<product>
  <modelNumber></modelNumber>
  <categoryPath>
    <category>
      <id></id>
      <name></name>
    </category>
    <category>
      <id></id>
      <name></name>
    &l开发者_如何学Got;/category>
    <category>
      <id></id>
      <name></name>
    </category>
    <category>
      <id></id>
      <name></name>
    </category>
    <category>
      <id></id>
      <name></name>
    </category>
  </categoryPath>
</product>

This is my XML structure. Now, is it possible to create a MySQL table based on this structure? Or would I have to manipulate the XML data?


You would be able to read the XML (if it had any values of course), but you would really need to explain the system the meaning of each value. For instance the is a many-to-one relationship with a product, so the script has to know that it has to execute multiple inserts instead of trying to save it in one field.

I'm not 100% sure, but using this to create a structure automatically is not gonna happen unless you explain the system/script what to do.. it'd be faster to create the tables yourself. Since there are no details of a field either (primary key, unique fields, auto_increment fields, varchar/char/int, etc..)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜