private static string EncodedPath(ProfilePath path) { string[] paths = new string[path.Length]; for (int i = 0; i < path.Length; i++) { paths[i] = XmlNormalizer.TagEncode(path[i]); } return(string.Join("/", paths)); }
private void LoadXml(XmlElement element, ProfilePath path) { if (element.HasAttribute("value")) { string value = element.GetAttribute("value"); LoadValue(path, value); } foreach (XmlNode xmlnode in element.ChildNodes) { XmlElement child = xmlnode as XmlElement; if (child != null) { LoadXml(child, new ProfilePath(path, XmlNormalizer.TagDecode(child.LocalName))); } } }
public void AddValue(ProfilePath path, string value) { XmlNode rootnode = _document.DocumentElement; foreach (string name in path) { XmlNode node = null; string n = XmlNormalizer.TagEncode(name); node = rootnode.SelectSingleNode(n); if (node == null) { node = _document.CreateElement(n); rootnode.AppendChild(node); } rootnode = node; } XmlAttribute attrib = _document.CreateAttribute("value"); rootnode.Attributes.Append(attrib); attrib.Value = value; }