Beispiel #1
0
        new public string ToXML()
        {
            string s = xmlStartTag;

            foreach (string key in attributes.Keys)
            {
                s += "<Attribute>";

                s += "<Name>" + key + "</Name>";
                s += "<Value>" + DataValueFactory.XMLSerialize(attributes[key]) + "</Value>";

                s += "</Attribute>";
            }
            s += xmlEndTag;
            return(s);
        }
Beispiel #2
0
        new public void FromXML(string xml)
        {
            Match m = regex.Match(xml);

            if (m.Success)
            {
                string s = m.Groups[1].Value;
                foreach (Match m2 in attregex.Matches(s))
                {
                    string name = m2.Groups[1].Value;
                    string val  = m2.Groups[2].Value;
                    attributes[name] = DataValueFactory.XMLDeserialize(val);
                }
            }
            else
            {
                throw new Exception("Invalid XML string");
            }
        }