/// <summary> /// /// </summary> /// <param name="optionsRoot">The options root object</param> /// <param name="context">The file name for XML Document</param> void IVisitorWithContext.Visit(UIOptionRootType optionsRoot, object context) { XmlDocument xmlDoc = new XmlDocument(); Stream stream = context as Stream; if (stream == null) { xmlDoc.Load((string) context); } else { xmlDoc.Load(stream); } XmlNamespaceManager nsmgr = new XmlNamespaceManager(xmlDoc.NameTable); nsmgr.AddNamespace("ws", "http://schemas.workshare.com/Workshare.OptionMap.xsd"); string xpath = "ws:OptionMap/ws:Category"; XmlNodeList categories = xmlDoc.SelectNodes(xpath, nsmgr); foreach (XmlNode node in categories) { UIOptionCategoryType category = new UIOptionCategoryType(); optionsRoot.Categories.Add(category); category.Accept(this, node); } }
/// <summary> /// /// </summary> /// <param name="optionsRoot">The options root object</param> /// <param name="context">The file name for XML Document</param> void IVisitorWithContext.Visit(UIOptionRootType optionsRoot, object context) { XmlDocument xmlDoc = new XmlDocument(); xmlDoc.Load((string) context); XmlNode rootNode = xmlDoc.SelectSingleNode("OptionsRoot"); foreach (XmlNode node in rootNode.ChildNodes) { UIOptionCategoryType category = new UIOptionCategoryType(); optionsRoot.Categories.Add(category); category.Accept(this, node); } }