Esempio n. 1
0
        private static DataTable _Select(XNode node, string xpath, params string[] values)
        {
            if (node == null)
            {
                Trace.WriteLine("warning no xml");
                _SetResult(null);
                return(null);
            }
            //if (XmlDocument == null) throw new HtmlXmlReaderException("error no xml data loaded");
            //HtmlXmlTables t = null;
            //if (_nodePathWithTableCode)
            //{
            //    if (_htmlXmlTables == null) _htmlXmlTables = HtmlXml.GetTables(XmlDocument);
            //    t = _htmlXmlTables;
            //}
            if (values.Length == 0)
            {
                values = new string[] { ":.:NodeValue" }
            }
            ;

            //XmlSelect select = pb.old.Xml.Select(node, new XmlSelectParameters(t, _url, _traceFunction), xpath, values);
            if (xpath == null)
            {
                Trace.WriteLine("warning no xpath");
                return(null);
            }

            XmlSelect xmlSelect = new XmlSelect();

            xmlSelect.SourceNode        = node;
            xmlSelect.SelectPrm         = new XmlSelectParameters();
            xmlSelect.SourceXPathNode   = xpath;
            xmlSelect.SourceXPathValues = values;

            //DataTable dt = pb.old.Xml.ReadSelect(select);
            DataTable dt = xmlSelect.zToDataTable();

            Trace.WriteLine("found {0} elements", dt.Rows.Count);

            _SetResult(dt);
            return(dt);
        }
Esempio n. 2
0
        private static DataTable _Select(XNode node, string xpath, params string[] values)
        {
            if (node == null)
            {
                Trace.WriteLine("warning no xml");
                _SetResult(null);
                return null;
            }
            //if (XmlDocument == null) throw new HtmlXmlReaderException("error no xml data loaded");
            //HtmlXmlTables t = null;
            //if (_nodePathWithTableCode)
            //{
            //    if (_htmlXmlTables == null) _htmlXmlTables = HtmlXml.GetTables(XmlDocument);
            //    t = _htmlXmlTables;
            //}
            if (values.Length == 0)
                values = new string[] { ":.:NodeValue" };

            //XmlSelect select = pb.old.Xml.Select(node, new XmlSelectParameters(t, _url, _traceFunction), xpath, values);
            if (xpath == null)
            {
                Trace.WriteLine("warning no xpath");
                return null;
            }

            XmlSelect xmlSelect = new XmlSelect();
            xmlSelect.SourceNode = node;
            xmlSelect.SelectPrm = new XmlSelectParameters();
            xmlSelect.SourceXPathNode = xpath;
            xmlSelect.SourceXPathValues = values;

            //DataTable dt = pb.old.Xml.ReadSelect(select);
            DataTable dt = xmlSelect.zToDataTable();
            Trace.WriteLine("found {0} elements", dt.Rows.Count);

            _SetResult(dt);
            return dt;
        }
Esempio n. 3
0
        private static DataTable _Select(XNode node, string xpath, params string[] values)
        {
            if (node == null)
            {
                Trace.WriteLine("warning no xml");
                //_SetResult(null);
                return(null);
            }
            if (values.Length == 0)
            {
                values = new string[] { ":.:NodeValue" }
            }
            ;

            //XmlSelect select = pb.old.Xml.Select(node, new XmlSelectParameters(t, _url, _traceFunction), xpath, values);
            if (xpath == null)
            {
                Trace.WriteLine("warning no xpath");
                return(null);
            }

            XmlSelect xmlSelect = new XmlSelect();

            xmlSelect.SourceNode        = node;
            xmlSelect.SelectPrm         = new XmlSelectParameters();
            xmlSelect.SourceXPathNode   = xpath;
            xmlSelect.SourceXPathValues = values;

            //DataTable dt = pb.old.Xml.ReadSelect(select);
            DataTable dt = xmlSelect.zToDataTable();

            Trace.WriteLine("found {0} elements", dt.Rows.Count);

            _SetResult(dt);
            return(dt);
        }