コード例 #1
0
        private ResultSetResolverArgs BuildXPathResolverArgs(XmlSourceXml xmlSource)
        {
            Trace.WriteLineIf(Extensibility.NBiTraceSwitch.TraceVerbose, "ResultSet defined through an xml-source.");

            var selects       = new List <AbstractSelect>();
            var selectFactory = new SelectFactory();

            foreach (var select in xmlSource.XPath.Selects)
            {
                selects.Add(selectFactory.Instantiate(select.Value, select.Attribute, select.Evaluate));
            }

            XPathEngine engine = null;

            if (xmlSource.File != null)
            {
                engine = new XPathFileEngine(xmlSource.GetFile(), xmlSource.XPath.From.Value, selects);
            }
            else if (xmlSource.Url != null)
            {
                engine = new XPathUrlEngine(xmlSource.Url.Value, xmlSource.XPath.From.Value, selects);
            }

            return(new XPathResultSetResolverArgs(engine));
        }
コード例 #2
0
        public void Serialize_File_PathIsSet()
        {
            var root = new XmlSourceXml()
            {
                File = new FileXml
                {
                    Path = "C:\\myPath.txt"
                }
            };
            var manager = new XmlManager();
            var xml     = manager.XmlSerializeFrom(root);

            Console.WriteLine(xml);
            Assert.That(xml, Is.StringContaining("<file>"));
            Assert.That(xml, Is.StringContaining("<path>"));
            Assert.That(xml, Is.StringContaining("C:\\myPath.txt"));
            Assert.That(xml, Is.Not.StringContaining("<parser"));
        }
コード例 #3
0
        public void Serialize_File_ParserIsSet()
        {
            var root = new XmlSourceXml()
            {
                File = new FileXml
                {
                    Path   = "C:\\myPath.txt",
                    Parser = new ParserXml()
                    {
                        Name = "myName"
                    },
                },
            };
            var manager = new XmlManager();
            var xml     = manager.XmlSerializeFrom(root);

            Console.WriteLine(xml);
            Assert.That(xml, Is.StringContaining("<parser "));
            Assert.That(xml, Is.StringContaining("name=\"myName\""));
        }