Hi Trond, thanks for your work! read_wmc_LatLonBoundingBox can safely be removed. For the *URL nodes, I would prefer a common method. If you look at the WMC schema (http://schemas.opengis.net/context/1.1.0/context.xsd), you will see that there is a URLType. All URLType nodes could use the same reader function, and since runChildNodes adds some overhead, I would prefer this function like e.g. read_wmc_LegendType.
So we would have something like: readURLType: function(node) { var obj = { width: node.getAttribute('width'), height: node.getAttribute('height') } var links = node.getElementsByTagName("OnlineResource"); if(links.length > 0) { this.read_wmc_OnlineResource(obj, links[0]); } return obj; }, read_wmc_LegendURL: function(style, node) { var legend = readURLType(node); style.legend = legend; }, Regards, Andreas. Trond Michelsen wrote: > I'm currently working on adding parsing and writing of the remaining > elements of Web Map Context documents, and there's something here that > caught my eye. > > In read_wmc_MetaDataURL and read_wmc_LegendURL, the content of the > OnlineResource element is read like this: > > var links = node.getElementsByTagName("OnlineResource"); > if(links.length > 0) { > this.read_wmc_OnlineResource(legend, links[0]); > } > > But afaict, this.runChildNodes(legend, node); should do the same. The > only difference would be if there are more than one OnlineResource > elements within the LegendURL og MetaDataURL elements, and there > shouldn't be. > > Are there any particular reasons why these methods don't just call > runChildNodes()? Should the methods for LogoURL, DescriptionURL and > DataURL read the OnlineResource the same way, or is it OK that I use > runChildNodes() in all methods? > > > Also, there's a read_wmc_LatLonBoundingBox() method, but I can't find > any LatLonBoundingBox element in the WMC standard. If it's OK, I'll > just delete this method. > > -- Andreas Hocevar OpenGeo - http://opengeo.org/ Expert service straight from the developers. _______________________________________________ Dev mailing list Dev@openlayers.org http://openlayers.org/mailman/listinfo/dev