private void AnalyzeTField(TField tfield, HtmlNode hn, XmlElement root, XmlDocument xdResult) { string name = tfield.Name; TConst tconst = tfield.TConst; TXPath txpath = tfield.TXPath; TRegex tregex = tfield.TRegex; if (txpath == null) { String valConst = AnalyzeTConst(tconst); AddElement(name, valConst, root, xdResult); return; } String valXpath = AnalyzeTXPath(txpath, hn); if (tregex == null) { AddElement(name, valXpath, root, xdResult); return; } String valRegex = AnalyzeTRegex(tregex, valXpath); AddElement(name, valRegex, root, xdResult); }
private static TConst GetTConst(XmlNode xnField) { XmlNode xnConst = xnField.SelectSingleNode(@"./const"); if (xnConst == null) { return(null); } string econst = xnConst.InnerText; TValue tv = GetTValue(xnField); TConst tc = new TConst(econst, tv); return(tc); }
private string AnalyzeTConst(TConst tconst) { EConst ec = tconst.eConst; switch (ec) { case EConst.now: return(DateTime.Now.ToString()); case EConst.value: default: return(tconst.tValue.Value); } }
private static TField GetTField(XmlNode xnField) { XmlNode xnName = xnField.SelectSingleNode(@"./name"); if (xnName == null) { throw new Exception("no name tag found"); } string name = xnName.InnerText; TXPath tx = GetTXPath(xnField); TRegex tr = GetTRegex(xnField); TConst tc = GetTConst(xnField); TField tf = new TField(name, tx, tr, tc); return(tf); }