0

We are starting a new data hub project and can freely choose between XML and JSON. What would you prefer?

We are ingesting documents into the data hub from SQL databases and CSV files using Nifi. We use the Quickstart application.

We have XML and JSON know-how. When working with MarkLogic so far, we have often used XML because of the ability to separate domains using namespaces. Would you say that namespaces are an argument for XML?

Andreas H
  • 77
  • 7

1 Answers1

3

Namespaces are an argument for XML, though arguably thoughtful naming of JSON properties can avoid the need for namespaces.

When it's a toss up between XML and JSON, I think the decision boils down to whether your developers that will be programming within MarkLogic are more comfortable with JavaScript or XQuery. Most of the time, JavaScript will be the preference, and thus JSON makes sense as the data format.

rjrudin
  • 2,108
  • 9
  • 7
  • 2
    Another consideration: if your data is mostly scalar values, that suggests JSON. If it has a lot of text, especially if you'd like to do inline markup, XML makes that very natural. – Dave Cassel Mar 12 '20 at 11:16
  • 1
    Also, the preference of your downstream application developers is another factor, especially if they need to support data update by end users. – Fan Li Mar 12 '20 at 15:51
  • After some experience with JSON we are feeling one disadvantage. Null values in JSON are not supported by the builtin (xpath) mapping functions out of the box. Two examples: empty(x) does not return true if x is null and concat(x,y) does not work if x or y is null. Our workaround so far is that we've implemented custom mapping functions like isNull(.) and nullToEmpty(.). Anybody aware of a better solution? – Andreas H Nov 06 '20 at 19:51