Is it “bad” to store XML in a database?

后端 未结 7 1514
感动是毒
感动是毒 2021-02-02 11:06

I have heard from several sources that storing XML in a database is \"bad\", but I have never seen/heard an actual explanation of why that is. Is it true? If it is true, can y

7条回答
  •  自闭症患者
    2021-02-02 12:03

    It's neither bad or good to do store XML in a DB. You just have to consider your requirements and how the data is used.

    If your data is machine produced and consumed, and it is only in XML to transport between apps, then a DB makes sense. At this point, you may also want to look at JSON instead of XML because it is somewhat better (IMO) at encapsulated data transport between two applications.

    If your data is human-produced or document-centric, or may be subject to periodic schema change, or is consumed by being read as a document, then it may make more sense to keep in XML. You may also consider some sort of version control if the XML is sufficiently mission-critical or you need a record of changes.

提交回复
热议问题