WMS GetCapabilities parsing example

Example of parsing a WMS GetCapabilities response.

This example shows the contents of the result object from parsing a WMS capabilities response.

wms, capabilities, getcapabilities
<!DOCTYPE html>
<html>
<head>
<title>WMS GetCapabilities parsing example</title>
<script src="https://code.jquery.com/jquery-1.11.2.min.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="http://openlayers.org/en/v3.9.0/css/ol.css" type="text/css">
<script src="http://openlayers.org/en/v3.9.0/build/ol.js"></script>

<style>
.log-container {
  height: 400px;
  overflow: scroll;
}

</style>
</head>
<body>
<div class="container-fluid">

<div class="row-fluid">
  <div class="span12">
    <pre class="log-container"><code id="log"></code></pre>
  </div>
</div>

</div>
<script>
var parser = new ol.format.WMSCapabilities();

$.ajax('data/ogcsample.xml').then(function(response) {
  var result = parser.read(response);
  $('#log').html(window.JSON.stringify(result, null, 2));
});

</script>
</body>
</html>