示例#1
0
		public DocumentNode(String path, String fileName, XmlDocument doc, DocumentMeta meta)
		{
			this.path = path;
			this.fileName = fileName;
			this.meta = meta;
			
			xmldoc = doc;
			
			if (fileName.ToLower() == "navigation.xml")
			{
				nodeType = NodeType.Navigation;
			}
			else if (fileName.ToLower() == "index.xml")
			{
				nodeType = NodeType.Index;
			}
			else
			{
				nodeType = NodeType.Ordinary;
			}
		}
示例#2
0
		private DocumentMeta CreateMeta(XmlDocument xmlDocument)
		{
			DocumentMeta meta = new DocumentMeta();

			XmlNode order = xmlDocument.SelectSingleNode("document/@order");

			if (order != null)
			{
				meta.Order = Convert.ToInt32(order.Value);
			}
			else
			{
				meta.Order = orderCount++;
			}

			XmlNode properties = xmlDocument.SelectSingleNode("document/properties");

			if (properties != null)
			{
				foreach(XmlNode child in properties.ChildNodes)
				{
					if (child.NodeType != XmlNodeType.Element) continue;

					if (child.Name == "title")
					{
						meta.Title = child.ChildNodes[0].Value;
					}
					else if (child.Name == "categories")
					{
						ArrayList categories = new ArrayList();

						foreach(XmlNode cat in child.SelectNodes("category"))
						{
							categories.Add(cat.ChildNodes[0].Value);
						}

						meta.Categories = (String[]) categories.ToArray(typeof(String));
					}
					else if (child.Name == "audience")
					{
						meta.Audience = child.ChildNodes[0].Value;
					}
				}
			}

			return meta;
		}