D
D
Dmitry Petrik2014-05-26 05:57:45
Database
Dmitry Petrik, 2014-05-26 05:57:45

Tree structure. json or xml?

I'm writing something like a hardware database. The following logic is planned: the RAM stick is in the motherboard; the motherboard is in the system unit; system unit at the workplace; workplace in such and such an audience, etc. Those. get a tree structure.
I think to store all the information in one line in the table, starting from the building number and ending with the components inside the system unit. The question is which format is better for this - JSON or xml? Is there any fundamental difference?
Perhaps, what on structure of a DB you will advise?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexey Kuleshov, 2014-05-26
@GingerbreadMSK

For your case, XML is better, as it is more readable. Let it take up much more space, for some reason, if you need to upload it to a file, you can always figure out what and where with the naked eye. It will also be possible to generate "excerpts" from the entire database, for example, an XML report on a separate building (it is desirable to add CSS for beauty).

B
Beholder, 2014-06-01
@Beholder

I would actually recommend an old fashioned format like S-expressions. :)

(workplace
  (computer
    (motherboard (:vendor "Foo Inc.")
      (memory (:size "8G"))
      (cpu (:name "P4")))))

It's just that it's unpopular, and libraries can be tense.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question