duanqiang6501 2010-01-28 23:02
浏览 36
已采纳

XML作为数据库

I've been reading about XML, XSL, XPath, etc. I want to start this small script in PHP using XML as the database to create a simple CRUD app. I will be using SimpleXML but after reading some answers over stackoverflow it seems many people suggest DOMDocument (is there anything that benefits using DOMDocument more than SimpleXML?)

Anyway, what bothers me is how to put an ID on them? Should I just start with "1" and then when someone adds a node, increment it and so on?

There is also category, I want to put a have this kind of structure

Parent  
 - Children          
 - Children  
   - Subchildren  

I have an idea on how to put it in XML but the problem for me is parsing them.

Anyway, categories doesn't really bother me that much. I'm more interested to know if I should just keep an IDs counts saved in a XML and use that as "reference".

  • 写回答

5条回答 默认 最新

  • dpw30157 2010-01-28 23:18
    关注

    You said "XML as the database." XML is just a markup language, so what you really meant was "a file as the database" and that would be a mistake. You'll run into concurrency problem, possible corruption and a ton of other problems, let alone the abysmal performance of a big XML document.

    If what you need is a database, then just use that: a database. Not a file.

    SQLite is simple to use and fast enough for light loads, although it kind of lacks a good counterpart to phpMyAdmin. Otherwise, your webhost certainly offers a MySQL database.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(4条)

报告相同问题?

悬赏问题

  • ¥15 优质github账号直接兑换rmb,感兴趣伙伴可以私信
  • ¥15 错误(10048): “调用exui内部功能”库命令的参数“参数4”不能接受空数据。怎么解决啊
  • ¥15 安装svn网络有问题怎么办
  • ¥15 Python爬取指定微博话题下的内容,保存为txt
  • ¥15 vue2登录调用后端接口如何实现
  • ¥65 永磁型步进电机PID算法
  • ¥15 sqlite 附加(attach database)加密数据库时,返回26是什么原因呢?
  • ¥88 找成都本地经验丰富懂小程序开发的技术大咖
  • ¥15 如何处理复杂数据表格的除法运算
  • ¥15 如何用stc8h1k08的片子做485数据透传的功能?(关键词-串口)