コード例 #1
0
        private void GenerateRouteStopXmlNode()
        {
            XmlElement routeStopXmlFileElement = ConfigDoc.CreateElement("RouteStopXmlFileLocation");
            XmlText    textField = ConfigDoc.CreateTextNode(string.Empty);

            routeStopXmlFileElement.AppendChild(textField);
            ConfigDoc.DocumentElement.AppendChild(routeStopXmlFileElement);
        }
コード例 #2
0
        private void GenerateBusRouteDetailsXmlNode()
        {
            XmlElement xmlELement = ConfigDoc.CreateElement("BusRouteDetailsXmlFileLocation");
            XmlText    textField  = ConfigDoc.CreateTextNode(string.Empty);

            xmlELement.AppendChild(textField);
            ConfigDoc.DocumentElement.AppendChild(xmlELement);
        }
コード例 #3
0
        private string ReadAndGenerateConfigTextNode(string nodeName)
        {
            if (ConfigDoc.DocumentElement[nodeName] == null)
            {
                XmlElement xmlELement = ConfigDoc.CreateElement(nodeName);
                XmlText    textField  = ConfigDoc.CreateTextNode(string.Empty);
                xmlELement.AppendChild(textField);
                ConfigDoc.DocumentElement.AppendChild(xmlELement);
            }

            return(ConfigDoc.DocumentElement[nodeName].InnerText);
        }
コード例 #4
0
        private void InitializeConfigFile()
        {
            // First add in the root node
            XmlElement rootNode = ConfigDoc.CreateElement("Configuration");

            ConfigDoc.AppendChild(rootNode);

            // Then prepare the XML declaration
            XmlDeclaration xmlDeclaration = ConfigDoc.CreateXmlDeclaration("1.0", "UTF-8", null);

            ConfigDoc.InsertBefore(xmlDeclaration, rootNode);

            // Now, the Polygon KML polygon file location
            XmlElement kmlFileElement = ConfigDoc.CreateElement("PolygonKmlFileLocation");
            XmlText    kmlFileField   = ConfigDoc.CreateTextNode(string.Empty);

            kmlFileElement.AppendChild(kmlFileField);
            rootNode.AppendChild(kmlFileElement);

            // The Bus Stop XML raw file
            XmlElement busXmlFileElement = ConfigDoc.CreateElement("BusStopXmlFileLocation");
            XmlText    busXmlFileField   = ConfigDoc.CreateTextNode(string.Empty);

            busXmlFileElement.AppendChild(busXmlFileField);
            rootNode.AppendChild(busXmlFileElement);

            // The Route-Stop XML raw file
            GenerateRouteStopXmlNode();

            // The bus route details XML raw file
            GenerateBusRouteDetailsXmlNode();

            // Everything should be ready.
            // Save the config first.
            ConfigDoc.Save("config.xml");
        }