Exemple #1
0
        /// <summary>
        /// Creates an XPathNamespaceList from the saved xml.
        /// </summary>
        public ICustomXmlSerializer ReadFrom(XmlReader reader)
        {
            XPathNamespaceList list = new XPathNamespaceList();
            bool finished           = false;

            while (reader.Read() && !finished)
            {
                switch (reader.NodeType)
                {
                case XmlNodeType.Element:
                    if (reader.Name == xpathNamespaceElementName)
                    {
                        XmlNamespace ns = XmlNamespace.FromString(reader.ReadElementString());
                        list.Add(ns.Prefix, ns.Uri);
                    }
                    break;

                case XmlNodeType.EndElement:
                    if (reader.Name != xpathNamespaceElementName)
                    {
                        finished = true;
                    }
                    break;
                }
            }
            return(list);
        }
		/// <summary>
		/// Creates an XPathNamespaceList from the saved xml.
		/// </summary>
		public ICustomXmlSerializer ReadFrom(XmlReader reader)
		{
			XPathNamespaceList list = new XPathNamespaceList();
			bool finished = false;
			while (reader.Read() && !finished) {
				switch (reader.NodeType) {
					case XmlNodeType.Element:
						if (reader.Name == xpathNamespaceElementName) {
							XmlNamespace ns = XmlNamespace.FromString(reader.ReadElementString());
							list.Add(ns.Prefix, ns.Uri);
						}
						break;
					case XmlNodeType.EndElement:
						if (reader.Name != xpathNamespaceElementName) {
							finished = true;
						}
						break;
				}
			}
			return list;
		}