private static ConfigurationDocument LoadInternal(XmlDocument doc) { var mgr = new XmlNamespaceManager(doc.NameTable); mgr.AddNamespace("xs", XmlNamespaces.XS); //NOXLATE mgr.AddNamespace("xsi", XmlNamespaces.XSI); //NOXLATE mgr.AddNamespace("fdo", XmlNamespaces.FDO); //NOXLATE mgr.AddNamespace("gml", XmlNamespaces.GML); //NOXLATE mgr.AddNamespace("xlink", XmlNamespaces.XLINK); //NOXLATE mgr.AddNamespace("fds", XmlNamespaces.FDS); //NOXLATE ConfigurationDocument conf = null; var root = doc.DocumentElement; if (root == null || root.Name != "fdo:DataStore") //NOXLATE { return(null); } //Sample the first schema mapping node. Even if there are multiples //they will all be the same provider //NOTE: Why does the XPath query (commented out) fail? var map = root.LastChild; //root.SelectSingleNode("SchemaMapping"); if (map != null && map.Name == "SchemaMapping") //NOXLATE { var prov = map.Attributes["provider"]; //NOXLATE if (prov != null) { if (prov.Value.StartsWith("OSGeo.ODBC")) //NOXLATE { conf = new OdbcConfigurationDocument(); } else if (prov.Value.StartsWith("OSGeo.Gdal")) //NOXLATE { conf = new GdalConfigurationDocument(); } else if (prov.Value.StartsWith("OSGeo.WMS")) //NOXLATE { conf = new WmsConfigurationDocument(); } else { conf = new GenericConfigurationDocument(); } } } if (conf != null) { conf.ReadXml(doc.SelectSingleNode("fdo:DataStore", mgr), mgr); //NOXLATE return(conf); } return(null); }
internal void InitDefaults() { string xml = _fs.GetConfigurationContent(); if (!string.IsNullOrEmpty(xml)) { try { _conf = (GdalConfigurationDocument)ConfigurationDocument.LoadXml(xml); } catch { BuildDefaultDocument(); } lstView.Items.Clear(); List<string> files = new List<string>(); foreach (var loc in _conf.RasterLocations) { AddRasterItems(loc.Location, loc.Items); } } }
private void BuildDefaultDocument() { _conf = (GdalConfigurationDocument)ConfigurationDocument.LoadXml(string.Format(TEMPLATE_CFG, -10000000, -10000000, 10000000, 10000000)); }
private static GdalRasterLocationItem FindLocation(GdalConfigurationDocument conf, string directory) { foreach (var loc in conf.RasterLocations) { if (loc.Location == directory) return loc; } return null; }