1 <html xmlns="http://www.w3.org/1999/xhtml">
3 <title>OpenLayers GML Parser</title>
4 <link rel="stylesheet" href="../theme/default/style.css" type="text/css" />
5 <link rel="stylesheet" href="style.css" type="text/css" />
6 <script src="../lib/OpenLayers.js"></script>
7 <script type="text/javascript">
8 function parseData(req) {
9 g = new OpenLayers.Format.GML();
11 features = g.read(req.responseText);
12 for(var feat in features) {
13 html += "Feature: Geometry: "+ features[feat].geometry+",";
15 for (var j in features[feat].attributes) {
16 html += "<li>"+j+":"+features[feat].attributes[j]+"</li>";
20 document.getElementById('output').innerHTML = html;
23 OpenLayers.loadURL("gml/owls.xml", "", null, parseData);
27 <body onload="load()">
28 <h1 id="title">GML Parser Example</h1>
33 Demonstrate the operation of the GML parser.
36 <div id="output"></div>
39 This script reads data from a GML file and parses out the coordinates, appending them to a HTML string with markup tags.
40 This markup is dumped to an element in the page.