ReadXml() public méthode

Read the state of this symbol from XML. The xmlinput must be on a symbol node.
public ReadXml ( XmlInput xmlinput ) : void
xmlinput XmlInput
Résultat void
Exemple #1
0
        private void ReadSymbolFile(string filename)
        {
            int sortOrder = 1;

            using (XmlInput xmlinput = new XmlInput(filename)) {
                xmlinput.CheckElement("symbols");

                bool first = true;
                while (xmlinput.FindSubElement(first, new string[] { "symbol", "language" }))
                {
                    if (xmlinput.Name == "symbol")
                    {
                        Symbol symbol = new Symbol(this, sortOrder);
                        ++sortOrder;

                        symbol.ReadXml(xmlinput);

                        if (symbols.ContainsKey(symbol.Id))
                        {
                            symbols[symbol.Id].Add(symbol);
                        }
                        else
                        {
                            symbols[symbol.Id] = new List <Symbol>()
                            {
                                symbol
                            };
                        }
                    }
                    else if (xmlinput.Name == "language")
                    {
                        SymbolLanguage language = new SymbolLanguage();

                        language.ReadXml(xmlinput);
                        languages.Add(language.LangId, language);
                    }

                    first = false;
                }
            }
        }
Exemple #2
0
        private void ReadSymbolFile(string filename)
        {
            using (XmlInput xmlinput = new XmlInput(filename)) {
                xmlinput.CheckElement("symbols");

                bool first = true;
                while (xmlinput.FindSubElement(first, new string[] { "symbol", "language" })) {
                    if (xmlinput.Name == "symbol") {
                        Symbol symbol = new Symbol(this);

                        symbol.ReadXml(xmlinput);

                        symbols.Add(symbol.Id, symbol);
                    }
                    else if (xmlinput.Name == "language") {
                        SymbolLanguage language = new SymbolLanguage();

                        language.ReadXml(xmlinput);
                        languages.Add(language.LangId, language);
                    }

                    first = false;
                }
            }
        }