I did a presentation on why you should use xml for your api for my local Linux User’s Group this week.
tl;dr
- Your api has data restrictions - an XML Schema or Relax NG specification allows you to precisely define those restrictions and automatically verify inputs.
- Api’s are like potato chips - one is not enough. Namespaces allow you to safely combine elements from different domains.
- Your input and output documents are semi-structured data - XPath allows you to identify nodes and nodes sets in those documents.
- Sometimes you’re just moving data around - use XSL to map your data from one format to another. In addition, you can let the browser map XML to HTML via XSL for review and approval.
- Your API documents are not one time events - XQuery allows you to treat your documents sets as a document based NoSQL database.