I Like XML

I did a presentation on why you should use xml for your api for my local Linux User’s Group this week.

tl;dr

  1. Your api has data restrictions - an XML Schema or Relax NG specification allows you to precisely define those restrictions and automatically verify inputs.
  2. Api’s are like potato chips - one is not enough. Namespaces allow you to safely combine elements from different domains.
  3. Your input and output documents are semi-structured data - XPath allows you to identify nodes and nodes sets in those documents.
  4. 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.
  5. Your API documents are not one time events - XQuery allows you to treat your documents sets as a document based NoSQL database.