public void ParseExample1_Text() { CAttributes attributes = CHtmlParser.ParseAttributes(HtmlExamples.HtmlExample1); Assert.IsTrue(attributes["Y00T00250.Y00A02883"].Value == "LIANA.SANTOS"); Assert.IsTrue(attributes["Y00T00250.Y00A02883"].Description == "Engineer"); }
public void ParseExample1_Selection() { CAttributes attributes = CHtmlParser.ParseAttributes(HtmlExamples.HtmlExample1); CAttribute attribute = attributes["Y00T00250.Y00A01088"]; Assert.IsTrue(attribute.Description == "Status"); Assert.IsTrue(string.Compare(@"For information", attribute.Value) == 0); Assert.IsTrue(attribute.Options.Where(x => x.Key == "").Count() == 1); Assert.IsTrue(attribute.Options.Where(x => x.Key == "N/A").Count() == 1); Assert.IsTrue(attribute.Options.Where(x => x.Key == "New").Count() == 1); Assert.IsTrue(attribute.Options.Where(x => x.Key == "For information").Count() == 1); Assert.IsTrue(attribute.Options.Where(x => x.Key == "Confirmed").Count() == 1); Assert.IsTrue(attribute.Options.Where(x => x.Key == "Suspended").Count() == 1); Assert.IsTrue(attribute.Options.Where(x => x.Key == "Completed").Count() == 1); Assert.IsTrue(attribute.Options.Where(x => x.Key == "Delegated").Count() == 1); Assert.IsTrue(attribute.Options.Where(x => x.Value == "").Count() == 1); Assert.IsTrue(attribute.Options.Where(x => x.Value == "N/A").Count() == 1); Assert.IsTrue(attribute.Options.Where(x => x.Value == "New").Count() == 1); Assert.IsTrue(attribute.Options.Where(x => x.Value == "For information").Count() == 1); Assert.IsTrue(attribute.Options.Where(x => x.Value == "Confirmed").Count() == 1); Assert.IsTrue(attribute.Options.Where(x => x.Value == "Suspended").Count() == 1); Assert.IsTrue(attribute.Options.Where(x => x.Value == "Completed").Count() == 1); Assert.IsTrue(attribute.Options.Where(x => x.Value == "Delegated").Count() == 1); }
public void Parse_HtmlExample_TextArea() { CAttributes attributes = CHtmlParser.ParseAttributes(HtmlExamples.HtmlExample_TextArea); CAttribute attribute = attributes["Y00T00156.Y00A00171"]; Assert.IsTrue(attribute.Description == "Binding norms and standards"); Assert.IsTrue(attribute.Value == ""); }
public void ParseExample1_CheckBox() { CAttributes attributes = CHtmlParser.ParseAttributes(HtmlExamples.HtmlExample1); Assert.IsTrue(attributes["Y00T00250.Y00A00726"].Value == "False"); Assert.IsTrue(attributes["Y00T00250.Y00A00726"].Description == "Canceled"); Assert.IsTrue(attributes["Y00T00250.Y00A02847"].Value == "True"); Assert.IsTrue(attributes["Y00T00250.Y00A02847"].Description == "Activate automatic notification"); }
/// <summary> /// 当前参数信息 /// </summary> /// <param name="p_Table"></param> public void ConvertToDisplay(CAttributes p_Table) { int key = p_Table.Add(-1, "单位工程结果参数"); //要添加的属性节点 foreach (DataRow row in this.ResultVarable.Rows) { p_Table.Add(key, row["Key"].ToString(), row["Value"]); } }
public void Parse_HtmlExample_OptionsDuplicate() { CAttributes attributes = CHtmlParser.ParseAttributes(HtmlExamples.HtmlExampleOptionsDuplicate); CAttribute attribute = attributes["Y00T00001.Y00A03066"]; Assert.IsTrue(attribute.Description == "Object class"); Assert.IsTrue(attribute.Value == "Boundary stream"); // Process stream is defined 2 times in this example of coos web. // Make sure it exists only once. Assert.IsTrue(attribute.Options.Where(x => x.Key == "Process stream").Count() == 1); Assert.IsTrue(attribute.Options["Process stream"] == "Process stream"); }
public static CAttributes ParseAttributes(string html) { var options = Configuration.Default.WithCss(); var parser = new HtmlParser(options); var doc = parser.Parse(html); CAttributes attributes = new CAttributes(); foreach (var elm in doc.Body.Children) { ParseAttributes(attributes, elm, 1); } return(attributes); }
/// <summary> /// 绑定数据 /// </summary> public void DataBind(IAttributes dAttributes) { //调用接口函数创建属性集合 this.m_IDataSource = null; this.bindingSource1.DataSource = null; this.treeList1.DataSource = null; this.m_IDataSource = dAttributes; CAttributes mAttribute = new CAttributes(); this.m_IDataSource.ConvertToDisplay(mAttribute); this.bindingSource1.DataSource = mAttribute; this.treeList1.DataSource = this.bindingSource1; this.treeList1.ExpandAll(); }
public void ParseExample2_TextWithUnits() { CAttributes attributes = CHtmlParser.ParseAttributes(HtmlExamples.HtmlExample2); CAttribute attribute = attributes["Y00T00235.Y00A02875"]; Assert.IsTrue(attribute.Description == "Units/time"); Assert.IsTrue(attribute.Value == ""); Assert.IsTrue(attribute.Options.Where(x => x.Key == "ppm").Count() == 1); Assert.IsTrue(attribute.Options.Where(x => x.Key == "1/1").Count() == 1); Assert.IsTrue(attribute.Options.Where(x => x.Key == "%").Count() == 1); Assert.IsTrue(attribute.Options.Where(x => x.Key == "‰").Count() == 1); Assert.IsTrue(attribute.Options["ppm"] == "F25.AA100"); Assert.IsTrue(attribute.Options["1/1"] == "F25.AA110"); Assert.IsTrue(attribute.Options["%"] == "F25.AA120"); Assert.IsTrue(attribute.Options["‰"] == "F25.AA130"); Assert.IsTrue(attribute.Unit == "%"); }
private static void ParseAttributes(CAttributes attributes, IElement element, int indent) { foreach (var elm in element.Children) { string nested_name = elm.GetAttribute("nested-name"); if (!string.IsNullOrEmpty(nested_name)) { CAttribute attribute = attributes[nested_name]; if (attribute == null) { attribute = new CAttribute(); attribute.NestedName = nested_name; attributes[nested_name] = attribute; } if (elm.TagName == "SPAN") { if (elm.TextContent[0] != '~') { attribute.Description = elm.TextContent; attribute.ReadOnly = true; } else { // Is a readonly attribute attribute.Description = elm.TextContent.Substring(1); } } else if (elm.TagName == "INPUT") { switch (elm.ClassName) { case "SUICheckBox": { string value = elm.GetAttribute("checked"); if (string.IsNullOrEmpty(value) || string.Compare(value, "checked") != 0) { attribute.Value = false.ToString(); } else { attribute.Value = true.ToString(); } attribute.IsBoolean = true; } break; case "SUIText": attribute.Value = elm.GetAttribute("value"); break; default: Debug.Assert(false); break; } } else if (elm.TagName == "SELECT") { ParseOptions(attribute, elm, indent + 1); continue; } else if (elm.TagName == "TEXTAREA") { attribute.Value = elm.TextContent; continue; } //else // DumpElement(elm, indent); // Do the controls stuff if (elm.ClassName != null) { UIType uitype = (UIType)Enum.Parse(typeof(UIType), elm.ClassName); } } ParseAttributes(attributes, elm, indent + 1); } }
public void ChangeValue(CAttributes p_Table, DataRowChangeEventArgs e) { throw new NotImplementedException(); }
void Awake() { t = target as CAttributes; faction = serializedObject.FindProperty("faction"); }
private void Attributes_Load(object sender, EventArgs e) { this.m_Attributes = new CAttributes(); this.m_Attributes.RowChanged += new DataRowChangeEventHandler(m_Attributes_RowChanged); }