Example of parsing a WMTS Capabilities document.
See the wmts-capabilities.js source to see how this is done.