Example #1
0
		// 子要素を検索します。
		private List<HtmlItem> SearchChildren(string s){
			if(s == null) return new List<HtmlItem>();

			List<HtmlItem> items = new List<HtmlItem>();
			string test = s;
			for(;;){
				if(string.IsNullOrEmpty(test)) break;
				Match m = ContentRegex.Match(test);
				if(!m.Success){
					items.Add(new HtmlMisc(test));
					break;
				}
				// マッチした
				string before = test.Substring(0, m.Index);
				string inner = m.Value;
				string after = test.Substring(m.Index + m.Length);
				if(!string.IsNullOrEmpty(before)) items.Add(new HtmlMisc(before));

				HtmlItem item = null;
				if(inner.StartsWith("%")){
					// 要素グループを検索→見つからなかったら Misc
					item = GetElementGroupByName(inner);
				} else {
					// 要素を検索→データを検索→見つからなかったら Misc
					item = GetElement(inner);
					if(item == null) item = GetDataByName(inner);
				}
				if(item == null) item = new HtmlMisc(inner);
				items.Add(item);
				test = after;
			}
			return items;
		}
Example #2
0
		// 属性値を解析して格納します。
		// 親として関連づけます。
		private void SetChildren(HtmlAttribute ha){
			string valueStr = ha.XmlElement.GetInnerText(ValueElementName);
			HtmlItem item = GetDataByName(valueStr);
			if(item == null) item = new HtmlMisc(valueStr);
			item.AddParent(ha);
			ha.Value = item;
		}