boolean addNsPrefix = !layer.getNamespace().equals(Namespace.NO_NAMESPACE);
if (addNsPrefix) dummyNsPrefix = "x:";
XPath mdUrl = XPath.newInstance ("./" + dummyNsPrefix + "MetadataURL[@type='TC211' and " + dummyNsPrefix + "Format='text/xml']/" + dummyNsPrefix + "OnlineResource");
if (addNsPrefix) mdUrl.addNamespace("x", layer.getNamespace().getURI());
Element onLineSrc = (Element) mdUrl.selectSingleNode (layer);
// Check if metadataUrl in WMS 1.3.0 format
if (onLineSrc == null) {
mdUrl = XPath.newInstance ("./" + dummyNsPrefix + "MetadataURL[@type='ISO19115:2003' and " + dummyNsPrefix + "Format='text/xml']/" + dummyNsPrefix + "OnlineResource");
if (addNsPrefix) mdUrl.addNamespace("x", layer.getNamespace().getURI());