Beispiel #1
0
        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);
        }
Beispiel #2
0
        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);
        }
Beispiel #3
0
        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);
            }
        }
Beispiel #4
0
        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);
        }