protected MetaTableEntry createEntry <T>(List <T> entrySourceData, Boolean Add = false) { MetaTableEntry output = new MetaTableEntry(); Type dataType = typeof(T); foreach (MetaTableProperty property in Table.properties.items) { String valueToStore = ""; if (property.index < 0) { valueToStore = items.Count.ToString(); output.StoreValue(property.PropertyName, valueToStore, null); } else if (property.index < entrySourceData.Count) { switch (dataType.Name) { case nameof(String): Object v = entrySourceData[property.index]; valueToStore = (String)v; output.StoreValue(property.PropertyName, valueToStore, null); break; case nameof(SourceTableCell): SourceTableCell c = entrySourceData[property.index] as SourceTableCell; valueToStore = c.Value; output.StoreValue(property.PropertyName, valueToStore, c); break; default: throw new NotImplementedException(); break; } } else { valueToStore = property.GetDefaultData(); output.StoreValue(property.PropertyName, valueToStore, null); } } if (Add) { items.Add(output); } return(output); }
public void StoreValue(String PropertyName, String value, SourceTableCell sourceCell = null) { if (sourceCell != null) { if (!sourceCellLinks.ContainsKey(PropertyName)) { sourceCellLinks.Add(PropertyName, sourceCell); } } if (!properties.ContainsKey(PropertyName)) { properties.Add(PropertyName, ""); } properties[PropertyName] = value; }
public Boolean OverwriteStoredValue(String PropertyName, String value, SourceTableCell sourceCell = null) { if (sourceCell != null) { if (sourceCellLinks.ContainsKey(PropertyName)) { return(false); } else { sourceCellLinks.Add(PropertyName, sourceCell); } } if (!properties.ContainsKey(PropertyName)) { return(false); } properties[PropertyName] = value; return(true); }
//public abstract MetaTableSchema GetTableSchema(); public virtual void SetSourceTableCell(SourceTableCell cell, HtmlNode cellNode, HtmlDocument htmlDocument) { if (htmlDocument == null) { htmlDocument = cellNode.OwnerDocument; } if (cell == null) { return; } if (valueExtraction.StoreExtraData) { foreach (var att in cellNode.Attributes) { cell.AttributeData.Add(att.Name, att.DeEntitizeValue); } cell.SourceCellTagName = cellNode.Name; cell.SourceCellXPath = cellNode.XPath; cell.SourceValueString = cellNode.InnerHtml; } if (valueExtraction.StoreSourceNode) { cell.SourceNode = cellNode; } cellNode.DescendantNodes(); String v = cellNode.GetTextContent(); // v = HtmlDocument.HtmlEncode(cellNode.InnerText); //htmlDocument.Encoding String nv = valueExtraction.ProcessInput(v, htmlDocument.StreamEncoding, htmlDocument.Encoding); cell.Value = nv; }
public override void SetSourceTableCell(SourceTableCell cell, HtmlNode cellNode, HtmlDocument htmlDocument) { base.SetSourceTableCell(cell, cellNode, htmlDocument); }