internal XPathResult Copy()
        {
            XPathResult result = new XPathResult {
                resultType = this.resultType
            };
            switch (this.resultType)
            {
                case XPathResultType.Number:
                    result.numberResult = this.numberResult;
                    return result;

                case XPathResultType.String:
                    result.stringResult = this.stringResult;
                    return result;

                case XPathResultType.Boolean:
                    result.boolResult = this.boolResult;
                    return result;

                case XPathResultType.NodeSet:
                    result.nodeSetResult = this.nodeSetResult.Clone();
                    return result;
            }
            throw Fx.AssertAndThrow("Unexpected result type.");
        }
        public static void UsingPositionFunctionTest62()
        {
            var xml = "books.xml";
            var startingNodePath = "/bookstore";
            var testExpression = @"descendant::node()[position()=7 or position()=2]";
            var expected = new XPathResult(0,
                new XPathResultToken
                {
                    NodeType = XPathNodeType.Element,
                    HasChildren = true,
                    HasAttributes = true,
                    LocalName = "book",
                    Name = "book",
                    HasNameTable = true,
                    Value =
                        "\n\t\tSeven Years in Trenton\n\t\t\n\t\t\tJoe\n\t\t\tBob\n\t\t\tTrenton Literary Review Honorable Mention\n\t\t\tUSA\n\t\t\n\t\t12\n\t"
                },
                new XPathResultToken
                {
                    NodeType = XPathNodeType.Element,
                    HasChildren = true,
                    LocalName = "author",
                    Name = "author",
                    HasNameTable = true,
                    Value = "\n\t\t\tJoe\n\t\t\tBob\n\t\t\tTrenton Literary Review Honorable Mention\n\t\t\tUSA\n\t\t"
                });
            ;

            Utils.XPathNodesetTest(xml, testExpression, expected, startingNodePath: startingNodePath);
        }
Exemple #3
0
        public static void AbbreviatedSyntaxTest125()
        {
            TestInitialize();

            var xml = "XQL_Orders_j1.xml";
            var testExpression = @"OrderIDs/CustomerIDs/EmployeeIDs/OrderDates/OrderDate[.='11/16/94']";
            var expected = new XPathResult(0);

            Utils.XPathNodesetTest(xml, testExpression, expected);
        }
Exemple #4
0
        public static void AxesTest11()
        {
            var xml = "xp001.xml";
            var startingNodePath = "/Doc/Chap/Para/Para/Origin";
            var testExpression = @"ancestor::*";
            var namespaceManager = new XmlNamespaceManager(new NameTable());

            namespaceManager.AddNamespace("book", "http://book.htm");
            namespaceManager.AddNamespace("movie", "http://movie.htm");
            var expected = new XPathResult(0,
                new XPathResultToken
                {
                    NodeType = XPathNodeType.Element,
                    HasChildren = true,
                    LocalName = "Doc",
                    Name = "Doc",
                    HasNameTable = true,
                    Value =
                        "\n XPath test\n This shall test XPath test\n \n   XPath test\n   First paragraph  Nested  Paragraph  End of first paragraph \n   Second paragraph \n \n \n   XPath test\n   Direct content\n \n"
                },
                new XPathResultToken
                {
                    NodeType = XPathNodeType.Element,
                    HasChildren = true,
                    LocalName = "Chap",
                    Name = "Chap",
                    HasNameTable = true,
                    Value =
                        "\n   XPath test\n   First paragraph  Nested  Paragraph  End of first paragraph \n   Second paragraph \n "
                },
                new XPathResultToken
                {
                    NodeType = XPathNodeType.Element,
                    HasChildren = true,
                    LocalName = "Para",
                    Name = "Para",
                    HasNameTable = true,
                    Value = "First paragraph  Nested  Paragraph  End of first paragraph "
                },
                new XPathResultToken
                {
                    NodeType = XPathNodeType.Element,
                    HasChildren = true,
                    LocalName = "Para",
                    Name = "Para",
                    HasNameTable = true,
                    Value = " Nested  Paragraph "
                });
            ;

            Utils.XPathNodesetTest(xml, testExpression, expected, namespaceManager: namespaceManager,
                startingNodePath: startingNodePath);
        }
Exemple #5
0
        public static void NodeTestsTest82()
        {
            var xml = "xp003.xml";
            var startingNodePath = "/Doc";
            var testExpression = @"descendant::comment()";
            var expected = new XPathResult(0,
                new XPathResultToken { NodeType = XPathNodeType.Comment, HasNameTable = true, Value = " Doc Comment " },
                new XPathResultToken { NodeType = XPathNodeType.Comment, HasNameTable = true, Value = " Chap Comment " });
            ;

            Utils.XPathNodesetTest(xml, testExpression, expected, startingNodePath: startingNodePath);
        }
        public static void ComplexExpressionsTest31()
        {
            var xml = "books.xml";
            var startingNodePath = "/bookstore/book[1]";
            var testExpression = @"child::author/ancestor::book/attribute::style[.='autobiography']";
            var expected = new XPathResult(0,
                new XPathResultToken
                {
                    NodeType = XPathNodeType.Attribute,
                    LocalName = "style",
                    Name = "style",
                    HasNameTable = true,
                    Value = "autobiography"
                });
            ;

            Utils.XPathNodesetTest(xml, testExpression, expected, startingNodePath: startingNodePath);
        }
        public static void MatchesTest234()
        {
            var xml = "xp005.xml";
            var startingNodePath = "Doc/Test1";
            var testExpression = @"attribute::*[last() - 1]";
            var expected = new XPathResult(0,
                new XPathResultToken
                {
                    NodeType = XPathNodeType.Attribute,
                    LocalName = "Attr4",
                    Name = "Attr4",
                    HasNameTable = true,
                    Value = "Fourth"
                });
            ;

            Utils.XPathNodesetTest(xml, testExpression, expected, startingNodePath: startingNodePath);
        }
        public static void NodeSetFunctionsTest223()
        {
            var xml = "xp005.xml";
            var startingNodePath = "Doc/Test1";
            var testExpression = @"attribute::*[last()]";
            var expected = new XPathResult(0,
                new XPathResultToken
                {
                    NodeType = XPathNodeType.Attribute,
                    LocalName = "Attr5",
                    Name = "Attr5",
                    HasNameTable = true,
                    Value = "Last"
                });
            ;

            Utils.XPathNodesetTest(xml, testExpression, expected, startingNodePath: startingNodePath);
        }
Exemple #9
0
        public static void GlobalizationTest5612()
        {
            TestInitialize();

            var xml = "Russian_problem_chars.xml";
            var testExpression = @"//root[contains(text(), ""?? ¤ ?? ?? © ? ® ??"")]";
            var expected = new XPathResult(0,
                new XPathResultToken
                {
                    NodeType = XPathNodeType.Element,
                    HasChildren = true,
                    LocalName = "root",
                    Name = "root",
                    HasNameTable = true,
                    Value = "\n?? ¤ ?? ?? © ? ® ?? \n"
                });

            Utils.XPathNodesetTest(xml, testExpression, expected);
        }
Exemple #10
0
        public static void BasicsTest162()
        {
            var xml = "xp001.xml";
            var startingNodePath = "/Doc";
            var testExpression = @"child::*[(2 * (2 -  (3 div (1 + 2))))]";
            var expected = new XPathResult(0,
                new XPathResultToken
                {
                    NodeType = XPathNodeType.Element,
                    HasChildren = true,
                    LocalName = "Summary",
                    Name = "Summary",
                    HasNameTable = true,
                    Value = "This shall test XPath test"
                });
            ;

            Utils.XPathNodesetTest(xml, testExpression, expected, startingNodePath: startingNodePath);
        }
Exemple #11
0
        public static void BasicsTest161()
        {
            var xml = "xp001.xml";
            var startingNodePath = "/Doc";
            var testExpression = @"child::*[((((1 + 2) * 3) - 7) div 2)]";
            var expected = new XPathResult(0,
                new XPathResultToken
                {
                    NodeType = XPathNodeType.Element,
                    HasChildren = true,
                    LocalName = "Title",
                    Name = "Title",
                    HasNameTable = true,
                    Value = "XPath test"
                });
            ;

            Utils.XPathNodesetTest(xml, testExpression, expected, startingNodePath: startingNodePath);
        }
        public static void NodeSetFunctionsTest222()
        {
            var xml = "xp005.xml";
            var startingNodePath = "Doc/Test1";
            var testExpression = @"child::*[last() - 1]";
            var expected = new XPathResult(0,
                new XPathResultToken
                {
                    NodeType = XPathNodeType.Element,
                    HasChildren = true,
                    LocalName = "Child4",
                    Name = "Child4",
                    HasNameTable = true,
                    Value = "Fourth"
                });
            ;

            Utils.XPathNodesetTest(xml, testExpression, expected, startingNodePath: startingNodePath);
        }
        public static void CustomerScenariosTest302()
        {
            var xml = "xpC001.xml";
            var startingNodePath = "/Book";
            var testExpression = @"/Book/Chapter[last()]/Section[1]/Line[last()]";
            var expected = new XPathResult(0,
                new XPathResultToken
                {
                    NodeType = XPathNodeType.Element,
                    HasChildren = true,
                    LocalName = "Line",
                    Name = "Line",
                    HasNameTable = true,
                    Value = "Porsche 911"
                });
            ;

            Utils.XPathNodesetTest(xml, testExpression, expected, startingNodePath: startingNodePath);
        }
        public static void PredicatesTest102()
        {
            var xml = "xp001.xml";
            var startingNodePath = "/Doc/Chap/Para/Para/Origin";
            var testExpression = @"ancestor::*[3]";
            var expected = new XPathResult(0,
                new XPathResultToken
                {
                    NodeType = XPathNodeType.Element,
                    HasChildren = true,
                    LocalName = "Chap",
                    Name = "Chap",
                    HasNameTable = true,
                    Value =
                        "\n   XPath test\n   First paragraph  Nested  Paragraph  End of first paragraph \n   Second paragraph \n "
                });
            ;

            Utils.XPathNodesetTest(xml, testExpression, expected, startingNodePath: startingNodePath);
        }
        public static void LexicalStructureTest521()
        {
            var xml = "books.xml";
            var testExpression = @"/*[node    ()]";
            var expected = new XPathResult(0,
                new XPathResultToken
                {
                    NodeType = XPathNodeType.Element,
                    HasChildren = true,
                    HasAttributes = true,
                    LocalName = "bookstore",
                    Name = "bookstore",
                    HasNameTable = true,
                    Value =
                        "\n\t\n\t\tSeven Years in Trenton\n\t\t\n\t\t\tJoe\n\t\t\tBob\n\t\t\tTrenton Literary Review Honorable Mention\n\t\t\tUSA\n\t\t\n\t\t12\n\t\n\t\n\t\tHistory of Trenton\n\t\t\n\t\t\tMary\n\t\t\tBob\n\t\t\t\n\t\t\t\tSelected Short Stories of\n\t\t\t\tJoeBob\n\t\t\t\tLoser\n\t\t\t\tUS\n\t\t\t\n\t\t\n\t\t55\n\t\n\t\n\t\tXQL The Golden Years\n\t\t\n\t\t\tMike\n\t\t\tHyman\n\t\t\t\n\t\t\t\tXQL For Dummies\n\t\t\t\tJonathan\n\t\t\t\tMarsh\n\t\t\t\n\t\t\n\t\t55.95\n\t\n\t\n\t\tRoad and Track\n\t\t3.50\n\t\t\n\t\tYes\n\t\n\t\n\t\tPC Week\n\t\tfree\n\t\tZiff Davis\n\t\n\t\n\t\tPC Magazine\n\t\t3.95\n\t\tZiff Davis\n\t\t\n\t\t\tCreate a dream PC\n\t\t\t\tCreate a list of needed hardware\n\t\t\t\n\t\t\tThe future of the web\n\t\t\t\tCan Netscape stay alive with Microsoft eating up its browser share?\n\t\t\t\tMSFT 99.30\n\t\t\t\t1998-06-23\n\t\t\t\n\t\t\tVisual Basic 5.0 - Will it stand the test of time?\n\t\t\t\n\t\t\n\t\n\t\n\t\t\n\t\t\tSport Cars - Can you really dream?\n\t\t\t\n\t\t\n\t\n\t\n\t\tPC Magazine Best Product of 1997\n\t\n\t\n\t\tHistory of Trenton 2\n\t\t\n\t\t\tMary F\n\t\t\tRobinson\n\t\t\t\n\t\t\t\tSelected Short Stories of\n\t\t\t\tMary F\n\t\t\t\tRobinson\n\t\t\t\n\t\t\n\t\t55\n\t\n\t\n\t\tHistory of Trenton Vol 3\n\t\t\n\t\t\tMary F\n\t\t\tRobinson\n\t\t\tFrank\n\t\t\tAnderson\n\t\t\tPulizer\n\t\t\t\n\t\t\t\tSelected Short Stories of\n\t\t\t\tMary F\n\t\t\t\tRobinson\n\t\t\t\n\t\t\n\t\t10\n\t\n\t\n\t\tHow To Fix Computers\n\t\t\n\t\t\tHack\n\t\t\ter\n\t\t\tPh.D.\n\t\t\n\t\t08\n\t\n\t\n\t\tTracking Trenton\n\t\t2.50\n\t\t\n\t\n\t\n\t\tTracking Trenton Stocks\n\t\t0.98\n\t\t\n\t\n\t\n\t\tTrenton Today, Trenton Tomorrow\n\t\t\n\t\t\tToni\n\t\t\tBob\n\t\t\tB.A.\n\t\t\tPh.D.\n\t\t\tPulizer\n\t\t\tStill in Trenton\n\t\t\tTrenton Forever\n\t\t\n\t\t6.50\n\t\t\n\t\t\tIt was a dark and stormy night.\n\t\t\tBut then all nights in Trenton seem dark and\n\t\t\tstormy to someone who has gone through what\n\t\t\tI have.\n\t\t\t\n\t\t\t\n\t\t\t\tTrenton\n\t\t\t\tmisery\n\t\t\t\n\t\t\n\t\n\t\n\t\tWho's Who in Trenton\n\t\tRobert Bob\n\t\n\t\n\t\tWhere is Trenton?\n\t\n\t\n\t\tWhere in the world is Trenton?\n\t\n"
                });
            ;

            Utils.XPathNodesetTest(xml, testExpression, expected);
        }
        public static void UsingPositionFunctionTest61()
        {
            var xml = "books.xml";
            var startingNodePath = "/bookstore";
            var testExpression = @"child::*[position()=10]";
            var expected = new XPathResult(0,
                new XPathResultToken
                {
                    NodeType = XPathNodeType.Element,
                    HasChildren = true,
                    HasAttributes = true,
                    LocalName = "book",
                    Name = "book",
                    HasNameTable = true,
                    Value =
                        "\n\t\tHistory of Trenton Vol 3\n\t\t\n\t\t\tMary F\n\t\t\tRobinson\n\t\t\tFrank\n\t\t\tAnderson\n\t\t\tPulizer\n\t\t\t\n\t\t\t\tSelected Short Stories of\n\t\t\t\tMary F\n\t\t\t\tRobinson\n\t\t\t\n\t\t\n\t\t10\n\t"
                });
            ;

            Utils.XPathNodesetTest(xml, testExpression, expected, startingNodePath: startingNodePath);
        }
Exemple #17
0
        public static void NodeTestsTest81()
        {
            var xml = "xp003.xml";
            var startingNodePath = "/Doc";
            var testExpression = @"descendant::text()";
            var expected = new XPathResult(0,
                new XPathResultToken { NodeType = XPathNodeType.Whitespace, HasNameTable = true },
                new XPathResultToken { NodeType = XPathNodeType.Whitespace, HasNameTable = true },
                new XPathResultToken { NodeType = XPathNodeType.Text, HasNameTable = true, Value = "XPath test" },
                new XPathResultToken { NodeType = XPathNodeType.Whitespace, HasNameTable = true },
                new XPathResultToken { NodeType = XPathNodeType.Whitespace, HasNameTable = true },
                new XPathResultToken { NodeType = XPathNodeType.Whitespace, HasNameTable = true },
                new XPathResultToken { NodeType = XPathNodeType.Text, HasNameTable = true, Value = "XPath test" },
                new XPathResultToken { NodeType = XPathNodeType.Whitespace, HasNameTable = true },
                new XPathResultToken { NodeType = XPathNodeType.Text, HasNameTable = true, Value = "First paragraph " },
                new XPathResultToken { NodeType = XPathNodeType.Text, HasNameTable = true, Value = " Nested " },
                new XPathResultToken { NodeType = XPathNodeType.Text, HasNameTable = true, Value = " Paragraph " },
                new XPathResultToken
                {
                    NodeType = XPathNodeType.Text,
                    HasNameTable = true,
                    Value = " End of first paragraph "
                },
                new XPathResultToken { NodeType = XPathNodeType.Whitespace, HasNameTable = true },
                new XPathResultToken { NodeType = XPathNodeType.Text, HasNameTable = true, Value = "Second paragraph " },
                new XPathResultToken { NodeType = XPathNodeType.Whitespace, HasNameTable = true },
                new XPathResultToken { NodeType = XPathNodeType.Whitespace, HasNameTable = true },
                new XPathResultToken { NodeType = XPathNodeType.Whitespace, HasNameTable = true },
                new XPathResultToken { NodeType = XPathNodeType.Text, HasNameTable = true, Value = "XPath test" },
                new XPathResultToken
                {
                    NodeType = XPathNodeType.Text,
                    HasNameTable = true,
                    Value = "\n   Direct content\n "
                },
                new XPathResultToken { NodeType = XPathNodeType.Whitespace, HasNameTable = true });
            ;

            Utils.XPathNodesetTest(xml, testExpression, expected, startingNodePath: startingNodePath);
        }
Exemple #18
0
        public static void NodeSetsTest181()
        {
            var xml = "xp001.xml";
            var startingNodePath = "/Doc";
            var testExpression = @"child::Title | child::Chap";
            var expected = new XPathResult(0,
                new XPathResultToken
                {
                    NodeType = XPathNodeType.Element,
                    HasChildren = true,
                    LocalName = "Title",
                    Name = "Title",
                    HasNameTable = true,
                    Value = "XPath test"
                },
                new XPathResultToken
                {
                    NodeType = XPathNodeType.Element,
                    HasChildren = true,
                    LocalName = "Chap",
                    Name = "Chap",
                    HasNameTable = true,
                    Value =
                        "\n   XPath test\n   First paragraph  Nested  Paragraph  End of first paragraph \n   Second paragraph \n "
                },
                new XPathResultToken
                {
                    NodeType = XPathNodeType.Element,
                    HasChildren = true,
                    LocalName = "Chap",
                    Name = "Chap",
                    HasNameTable = true,
                    Value = "\n   XPath test\n   Direct content\n "
                });
            ;

            Utils.XPathNodesetTest(xml, testExpression, expected, startingNodePath: startingNodePath);
        }
        public static void MiscellaneousCasesTest531()
        {
            var xml = "books.xml";
            var testExpression = @"/bookstore/magazine[6]/@frequency/following::title";
            var expected = new XPathResult(0,
                new XPathResultToken
                {
                    NodeType = XPathNodeType.Element,
                    HasChildren = true,
                    LocalName = "title",
                    Name = "title",
                    HasNameTable = true,
                    Value = "Tracking Trenton"
                },
                new XPathResultToken
                {
                    NodeType = XPathNodeType.Element,
                    HasChildren = true,
                    LocalName = "title",
                    Name = "title",
                    HasNameTable = true,
                    Value = "Tracking Trenton Stocks"
                },
                new XPathResultToken
                {
                    NodeType = XPathNodeType.Element,
                    HasChildren = true,
                    LocalName = "title",
                    Name = "title",
                    HasNameTable = true,
                    Value = "Trenton Today, Trenton Tomorrow"
                });
            ;

            Utils.XPathNodesetTest(xml, testExpression, expected);
        }
        public static void SetContextFunctionalTestsTest432()
        {
            var xml = "name.xml";
            var testExpression = @"//NSbook:book[1]";
            var namespaceManager = new XmlNamespaceManager(new NameTable());

            namespaceManager.AddNamespace("NSbook", "http://book.htm");
            var expected = new XPathResult(0,
                new XPathResultToken
                {
                    NodeType = XPathNodeType.Element,
                    HasChildren = true,
                    HasAttributes = true,
                    LocalName = "book",
                    Name = "NSbook:book",
                    NamespaceURI = "http://book.htm",
                    HasNameTable = true,
                    Prefix = "NSbook",
                    Value = "\n\t\t\tA Brief History Of Time\n\t\t"
                });
            ;

            Utils.XPathNodesetTest(xml, testExpression, expected, namespaceManager: namespaceManager);
        }
        /// <summary>
        /// surrogates : xpath testing, return 7 nodes
        /// </summary>
        //[Fact(Skip = "Issue #18: Outer loop test")]
        public static void GlobalizationTest566()
        {
            var xml            = "Surrogates_1.xml";
            var testExpression =
                @"//Row[Data/text()=""𠀋"" or Data/text()=""𠂢"" or Data/text()=""𠂤"" or Data/text()=""𪀚"" or Data/text()=""𪂂"" or Data/text()=""𪃹"" or Data/text()=""𥇍""] ";
            var expected = new XPathResult(0,
                                           new XPathResultToken
            {
                NodeType     = XPathNodeType.Element,
                HasChildren  = true,
                LocalName    = "Row",
                Name         = "Row",
                HasNameTable = true,
                Value        = "\n    𠀋\n    2000B\n    D840\n    DC0B\n    \n    \n    \n   "
            },
                                           new XPathResultToken
            {
                NodeType     = XPathNodeType.Element,
                HasChildren  = true,
                LocalName    = "Row",
                Name         = "Row",
                HasNameTable = true,
                Value        = "\n    \n    𠂢\n    200A2\n    D840\n    DCA2\n    \n    \n    \n   "
            },
                                           new XPathResultToken
            {
                NodeType     = XPathNodeType.Element,
                HasChildren  = true,
                LocalName    = "Row",
                Name         = "Row",
                HasNameTable = true,
                Value        = "\n    \n    𠂤\n    200A4\n    D840\n    DCA4\n    \n    \n    \n   "
            },
                                           new XPathResultToken
            {
                NodeType     = XPathNodeType.Element,
                HasChildren  = true,
                LocalName    = "Row",
                Name         = "Row",
                HasNameTable = true,
                Value        = "\n    \n    𥇍\n    251CD\n    D854\n    DDCD\n    \n    \n    \n   "
            },
                                           new XPathResultToken
            {
                NodeType     = XPathNodeType.Element,
                HasChildren  = true,
                LocalName    = "Row",
                Name         = "Row",
                HasNameTable = true,
                Value        = "\n    \n    𪀚\n    2A01A\n    D868\n    DC1A\n    \n    \n    \n   "
            },
                                           new XPathResultToken
            {
                NodeType     = XPathNodeType.Element,
                HasChildren  = true,
                LocalName    = "Row",
                Name         = "Row",
                HasNameTable = true,
                Value        = "\n    \n    𪂂\n    2A082\n    D868\n    DC82\n    \n    \n    \n   "
            },
                                           new XPathResultToken
            {
                NodeType     = XPathNodeType.Element,
                HasChildren  = true,
                LocalName    = "Row",
                Name         = "Row",
                HasNameTable = true,
                Value        = "\n    \n    𪃹\n    2A0F9\n    D868\n    DCF9\n    \n \n   "
            });

            ;

            Utils.XPathNodesetTest(xml, testExpression, expected);
        }
Exemple #22
0
        public static void GlobalizationTest569()
        {
            var xml            = "JPN_problem_chars_1.xml";
            var testExpression =
                "//char[@Expression=\"\uFF71\" or @Expression=\"\uFF72\" or @Expression=\"\uFF73\" or @Expression=\"\uFF74\" or @Expression=\"\uFF75\" or @Expression=\"\u3042\" or @Expression=\"\u3044\" or @Expression=\"\u3046\" or @Expression=\"\u3048\" or @Expression=\"\u304A\" or @Expression=\"\u30A2\" or @Expression=\"\u30A4\" or @Expression=\"\u30A6\" or @Expression=\"\u30A8\" or @Expression=\"\u30AA\" or @Expression=\"\u4E9C\" or @Expression=\"\u4F0A\" or @Expression=\"\u5B87\" or @Expression=\"\u6C5F\" ]";
            var expected = new XPathResult(0,
                                           new XPathResultToken
            {
                NodeType       = XPathNodeType.Element,
                HasAttributes  = true,
                IsEmptyElement = true,
                LocalName      = "char",
                Name           = "char",
                HasNameTable   = true
            },
                                           new XPathResultToken
            {
                NodeType       = XPathNodeType.Element,
                HasAttributes  = true,
                IsEmptyElement = true,
                LocalName      = "char",
                Name           = "char",
                HasNameTable   = true
            },
                                           new XPathResultToken
            {
                NodeType       = XPathNodeType.Element,
                HasAttributes  = true,
                IsEmptyElement = true,
                LocalName      = "char",
                Name           = "char",
                HasNameTable   = true
            },
                                           new XPathResultToken
            {
                NodeType       = XPathNodeType.Element,
                HasAttributes  = true,
                IsEmptyElement = true,
                LocalName      = "char",
                Name           = "char",
                HasNameTable   = true
            },
                                           new XPathResultToken
            {
                NodeType       = XPathNodeType.Element,
                HasAttributes  = true,
                IsEmptyElement = true,
                LocalName      = "char",
                Name           = "char",
                HasNameTable   = true
            },
                                           new XPathResultToken
            {
                NodeType       = XPathNodeType.Element,
                HasAttributes  = true,
                IsEmptyElement = true,
                LocalName      = "char",
                Name           = "char",
                HasNameTable   = true
            },
                                           new XPathResultToken
            {
                NodeType       = XPathNodeType.Element,
                HasAttributes  = true,
                IsEmptyElement = true,
                LocalName      = "char",
                Name           = "char",
                HasNameTable   = true
            },
                                           new XPathResultToken
            {
                NodeType       = XPathNodeType.Element,
                HasAttributes  = true,
                IsEmptyElement = true,
                LocalName      = "char",
                Name           = "char",
                HasNameTable   = true
            },
                                           new XPathResultToken
            {
                NodeType       = XPathNodeType.Element,
                HasAttributes  = true,
                IsEmptyElement = true,
                LocalName      = "char",
                Name           = "char",
                HasNameTable   = true
            },
                                           new XPathResultToken
            {
                NodeType       = XPathNodeType.Element,
                HasAttributes  = true,
                IsEmptyElement = true,
                LocalName      = "char",
                Name           = "char",
                HasNameTable   = true
            },
                                           new XPathResultToken
            {
                NodeType       = XPathNodeType.Element,
                HasAttributes  = true,
                IsEmptyElement = true,
                LocalName      = "char",
                Name           = "char",
                HasNameTable   = true
            },
                                           new XPathResultToken
            {
                NodeType       = XPathNodeType.Element,
                HasAttributes  = true,
                IsEmptyElement = true,
                LocalName      = "char",
                Name           = "char",
                HasNameTable   = true
            },
                                           new XPathResultToken
            {
                NodeType       = XPathNodeType.Element,
                HasAttributes  = true,
                IsEmptyElement = true,
                LocalName      = "char",
                Name           = "char",
                HasNameTable   = true
            },
                                           new XPathResultToken
            {
                NodeType       = XPathNodeType.Element,
                HasAttributes  = true,
                IsEmptyElement = true,
                LocalName      = "char",
                Name           = "char",
                HasNameTable   = true
            },
                                           new XPathResultToken
            {
                NodeType       = XPathNodeType.Element,
                HasAttributes  = true,
                IsEmptyElement = true,
                LocalName      = "char",
                Name           = "char",
                HasNameTable   = true
            },
                                           new XPathResultToken
            {
                NodeType       = XPathNodeType.Element,
                HasAttributes  = true,
                IsEmptyElement = true,
                LocalName      = "char",
                Name           = "char",
                HasNameTable   = true
            },
                                           new XPathResultToken
            {
                NodeType       = XPathNodeType.Element,
                HasAttributes  = true,
                IsEmptyElement = true,
                LocalName      = "char",
                Name           = "char",
                HasNameTable   = true
            },
                                           new XPathResultToken
            {
                NodeType       = XPathNodeType.Element,
                HasAttributes  = true,
                IsEmptyElement = true,
                LocalName      = "char",
                Name           = "char",
                HasNameTable   = true
            },
                                           new XPathResultToken
            {
                NodeType       = XPathNodeType.Element,
                HasAttributes  = true,
                IsEmptyElement = true,
                LocalName      = "char",
                Name           = "char",
                HasNameTable   = true
            });

            ;

            Utils.XPathNodesetTest(xml, testExpression, expected);
        }
        public static void GlobalizationTest569()
        {
            var xml            = "JPN_problem_chars_1.xml";
            var testExpression =
                @"//char[@Expression=""ア"" or @Expression=""イ"" or @Expression=""ウ"" or @Expression=""エ"" or @Expression=""オ"" or @Expression=""あ"" or @Expression=""い"" or @Expression=""う"" or @Expression=""え"" or @Expression=""お"" or @Expression=""ア"" or @Expression=""イ"" or @Expression=""ウ"" or @Expression=""エ"" or @Expression=""オ"" or @Expression=""亜"" or @Expression=""伊"" or @Expression=""宇"" or @Expression=""江"" ]";
            var expected = new XPathResult(0,
                                           new XPathResultToken
            {
                NodeType       = XPathNodeType.Element,
                HasAttributes  = true,
                IsEmptyElement = true,
                LocalName      = "char",
                Name           = "char",
                HasNameTable   = true
            },
                                           new XPathResultToken
            {
                NodeType       = XPathNodeType.Element,
                HasAttributes  = true,
                IsEmptyElement = true,
                LocalName      = "char",
                Name           = "char",
                HasNameTable   = true
            },
                                           new XPathResultToken
            {
                NodeType       = XPathNodeType.Element,
                HasAttributes  = true,
                IsEmptyElement = true,
                LocalName      = "char",
                Name           = "char",
                HasNameTable   = true
            },
                                           new XPathResultToken
            {
                NodeType       = XPathNodeType.Element,
                HasAttributes  = true,
                IsEmptyElement = true,
                LocalName      = "char",
                Name           = "char",
                HasNameTable   = true
            },
                                           new XPathResultToken
            {
                NodeType       = XPathNodeType.Element,
                HasAttributes  = true,
                IsEmptyElement = true,
                LocalName      = "char",
                Name           = "char",
                HasNameTable   = true
            },
                                           new XPathResultToken
            {
                NodeType       = XPathNodeType.Element,
                HasAttributes  = true,
                IsEmptyElement = true,
                LocalName      = "char",
                Name           = "char",
                HasNameTable   = true
            },
                                           new XPathResultToken
            {
                NodeType       = XPathNodeType.Element,
                HasAttributes  = true,
                IsEmptyElement = true,
                LocalName      = "char",
                Name           = "char",
                HasNameTable   = true
            },
                                           new XPathResultToken
            {
                NodeType       = XPathNodeType.Element,
                HasAttributes  = true,
                IsEmptyElement = true,
                LocalName      = "char",
                Name           = "char",
                HasNameTable   = true
            },
                                           new XPathResultToken
            {
                NodeType       = XPathNodeType.Element,
                HasAttributes  = true,
                IsEmptyElement = true,
                LocalName      = "char",
                Name           = "char",
                HasNameTable   = true
            },
                                           new XPathResultToken
            {
                NodeType       = XPathNodeType.Element,
                HasAttributes  = true,
                IsEmptyElement = true,
                LocalName      = "char",
                Name           = "char",
                HasNameTable   = true
            },
                                           new XPathResultToken
            {
                NodeType       = XPathNodeType.Element,
                HasAttributes  = true,
                IsEmptyElement = true,
                LocalName      = "char",
                Name           = "char",
                HasNameTable   = true
            },
                                           new XPathResultToken
            {
                NodeType       = XPathNodeType.Element,
                HasAttributes  = true,
                IsEmptyElement = true,
                LocalName      = "char",
                Name           = "char",
                HasNameTable   = true
            },
                                           new XPathResultToken
            {
                NodeType       = XPathNodeType.Element,
                HasAttributes  = true,
                IsEmptyElement = true,
                LocalName      = "char",
                Name           = "char",
                HasNameTable   = true
            },
                                           new XPathResultToken
            {
                NodeType       = XPathNodeType.Element,
                HasAttributes  = true,
                IsEmptyElement = true,
                LocalName      = "char",
                Name           = "char",
                HasNameTable   = true
            },
                                           new XPathResultToken
            {
                NodeType       = XPathNodeType.Element,
                HasAttributes  = true,
                IsEmptyElement = true,
                LocalName      = "char",
                Name           = "char",
                HasNameTable   = true
            },
                                           new XPathResultToken
            {
                NodeType       = XPathNodeType.Element,
                HasAttributes  = true,
                IsEmptyElement = true,
                LocalName      = "char",
                Name           = "char",
                HasNameTable   = true
            },
                                           new XPathResultToken
            {
                NodeType       = XPathNodeType.Element,
                HasAttributes  = true,
                IsEmptyElement = true,
                LocalName      = "char",
                Name           = "char",
                HasNameTable   = true
            },
                                           new XPathResultToken
            {
                NodeType       = XPathNodeType.Element,
                HasAttributes  = true,
                IsEmptyElement = true,
                LocalName      = "char",
                Name           = "char",
                HasNameTable   = true
            },
                                           new XPathResultToken
            {
                NodeType       = XPathNodeType.Element,
                HasAttributes  = true,
                IsEmptyElement = true,
                LocalName      = "char",
                Name           = "char",
                HasNameTable   = true
            });

            ;

            Utils.XPathNodesetTest(xml, testExpression, expected);
        }
Exemple #24
0
        public static void AbbreviatedSyntaxTest121()
        {
            var xml            = "books.xml";
            var testExpression = @"bookstore//title";
            var expected       = new XPathResult(0,
                                                 new XPathResultToken
            {
                NodeType     = XPathNodeType.Element,
                HasChildren  = true,
                LocalName    = "title",
                Name         = "title",
                HasNameTable = true,
                Value        = "Seven Years in Trenton"
            },
                                                 new XPathResultToken
            {
                NodeType     = XPathNodeType.Element,
                HasChildren  = true,
                LocalName    = "title",
                Name         = "title",
                HasNameTable = true,
                Value        = "History of Trenton"
            },
                                                 new XPathResultToken
            {
                NodeType     = XPathNodeType.Element,
                HasChildren  = true,
                LocalName    = "title",
                Name         = "title",
                HasNameTable = true,
                Value        = "XQL The Golden Years"
            },
                                                 new XPathResultToken
            {
                NodeType     = XPathNodeType.Element,
                HasChildren  = true,
                LocalName    = "title",
                Name         = "title",
                HasNameTable = true,
                Value        = "Road and Track"
            },
                                                 new XPathResultToken
            {
                NodeType     = XPathNodeType.Element,
                HasChildren  = true,
                LocalName    = "title",
                Name         = "title",
                HasNameTable = true,
                Value        = "PC Week"
            },
                                                 new XPathResultToken
            {
                NodeType     = XPathNodeType.Element,
                HasChildren  = true,
                LocalName    = "title",
                Name         = "title",
                HasNameTable = true,
                Value        = "PC Magazine"
            },
                                                 new XPathResultToken
            {
                NodeType     = XPathNodeType.Element,
                HasChildren  = true,
                LocalName    = "title",
                Name         = "title",
                HasNameTable = true,
                Value        = "History of Trenton 2"
            },
                                                 new XPathResultToken
            {
                NodeType     = XPathNodeType.Element,
                HasChildren  = true,
                LocalName    = "title",
                Name         = "title",
                HasNameTable = true,
                Value        = "History of Trenton Vol 3"
            },
                                                 new XPathResultToken
            {
                NodeType     = XPathNodeType.Element,
                HasChildren  = true,
                LocalName    = "title",
                Name         = "title",
                HasNameTable = true,
                Value        = "How To Fix Computers"
            },
                                                 new XPathResultToken
            {
                NodeType     = XPathNodeType.Element,
                HasChildren  = true,
                LocalName    = "title",
                Name         = "title",
                HasNameTable = true,
                Value        = "Tracking Trenton"
            },
                                                 new XPathResultToken
            {
                NodeType     = XPathNodeType.Element,
                HasChildren  = true,
                LocalName    = "title",
                Name         = "title",
                HasNameTable = true,
                Value        = "Tracking Trenton Stocks"
            },
                                                 new XPathResultToken
            {
                NodeType     = XPathNodeType.Element,
                HasChildren  = true,
                LocalName    = "title",
                Name         = "title",
                HasNameTable = true,
                Value        = "Trenton Today, Trenton Tomorrow"
            });

            ;

            Utils.XPathNodesetTest(xml, testExpression, expected);
        }
Exemple #25
0
        public static void GlobalizationTest566()
        {
            var xml            = "Surrogates_1.xml";
            var testExpression =
                "//Row[Data/text()=\"\uD840\uDC0B\" or Data/text()=\"\uD840\uDCA2\" or Data/text()=\"\uD840\uDCA4\" or Data/text()=\"\uD868\uDC1A\" or Data/text()=\"\uD868\uDC82\" or Data/text()=\"\uD868\uDCF9\" or Data/text()=\"\uD854\uDDCD\"] ";
            var expected = new XPathResult(0,
                                           new XPathResultToken
            {
                NodeType     = XPathNodeType.Element,
                HasChildren  = true,
                LocalName    = "Row",
                Name         = "Row",
                HasNameTable = true,
                Value        = "\n    \uD840\uDC0B\n    2000B\n    D840\n    DC0B\n    \n    \n    \n   "
            },
                                           new XPathResultToken
            {
                NodeType     = XPathNodeType.Element,
                HasChildren  = true,
                LocalName    = "Row",
                Name         = "Row",
                HasNameTable = true,
                Value        = "\n    \n    \uD840\uDCA2\n    200A2\n    D840\n    DCA2\n    \n    \n    \n   "
            },
                                           new XPathResultToken
            {
                NodeType     = XPathNodeType.Element,
                HasChildren  = true,
                LocalName    = "Row",
                Name         = "Row",
                HasNameTable = true,
                Value        = "\n    \n    \uD840\uDCA4\n    200A4\n    D840\n    DCA4\n    \n    \n    \n   "
            },
                                           new XPathResultToken
            {
                NodeType     = XPathNodeType.Element,
                HasChildren  = true,
                LocalName    = "Row",
                Name         = "Row",
                HasNameTable = true,
                Value        = "\n    \n    \uD854\uDDCD\n    251CD\n    D854\n    DDCD\n    \n    \n    \n   "
            },
                                           new XPathResultToken
            {
                NodeType     = XPathNodeType.Element,
                HasChildren  = true,
                LocalName    = "Row",
                Name         = "Row",
                HasNameTable = true,
                Value        = "\n    \n    \uD868\uDC1A\n    2A01A\n    D868\n    DC1A\n    \n    \n    \n   "
            },
                                           new XPathResultToken
            {
                NodeType     = XPathNodeType.Element,
                HasChildren  = true,
                LocalName    = "Row",
                Name         = "Row",
                HasNameTable = true,
                Value        = "\n    \n    \uD868\uDC82\n    2A082\n    D868\n    DC82\n    \n    \n    \n   "
            },
                                           new XPathResultToken
            {
                NodeType     = XPathNodeType.Element,
                HasChildren  = true,
                LocalName    = "Row",
                Name         = "Row",
                HasNameTable = true,
                Value        = "\n    \n    \uD868\uDCF9\n    2A0F9\n    D868\n    DCF9\n    \n \n   "
            });

            ;

            Utils.XPathNodesetTest(xml, testExpression, expected);
        }
        public static void GlobalizationTest5613()
        {
            var xml            = "KOR_problem_chars_b.xml";
            var testExpression =
                @"root/V[contains(text(), ""한글"") or text()=""は꾜は꾜は꾜は꾜は꾜"" or contains(text(), ""詰詰"") or contains(text(), ""檍也"") or contains(text(), ""가나 가"") or contains(text(), ""Junja"")]";
            var expected = new XPathResult(0,
                                           new XPathResultToken
            {
                NodeType     = XPathNodeType.Element,
                HasChildren  = true,
                LocalName    = "V",
                Name         = "V",
                HasNameTable = true,
                Value        = "한글"
            },
                                           new XPathResultToken
            {
                NodeType     = XPathNodeType.Element,
                HasChildren  = true,
                LocalName    = "V",
                Name         = "V",
                HasNameTable = true,
                Value        = "は꾜は꾜は꾜は꾜は꾜"
            },
                                           new XPathResultToken
            {
                NodeType     = XPathNodeType.Element,
                HasChildren  = true,
                LocalName    = "V",
                Name         = "V",
                HasNameTable = true,
                Value        = "詰詰詰詰"
            },
                                           new XPathResultToken
            {
                NodeType     = XPathNodeType.Element,
                HasChildren  = true,
                LocalName    = "V",
                Name         = "V",
                HasNameTable = true,
                Value        = "言檍也言檍也言檍也"
            },
                                           new XPathResultToken
            {
                NodeType     = XPathNodeType.Element,
                HasChildren  = true,
                LocalName    = "V",
                Name         = "V",
                HasNameTable = true,
                Value        = "가나 가나 가나 가나 가나 가나"
            },
                                           new XPathResultToken
            {
                NodeType     = XPathNodeType.Element,
                HasChildren  = true,
                LocalName    = "V",
                Name         = "V",
                HasNameTable = true,
                Value        = "Junja"
            });

            ;

            Utils.XPathNodesetTest(xml, testExpression, expected);
        }
Exemple #27
0
        public void PredicatesTest1041()
        {
            var xml            = "xql_orders-flat-200a.xml";
            var testExpression = @"/ROOT/OrderIDs[OrderID/@CollatingOrder>=1033]/OrderID/@CollatingOrder";
            var expected       = new XPathResult(0,
                                                 new XPathResultToken
            {
                NodeType     = XPathNodeType.Attribute,
                LocalName    = "CollatingOrder",
                Name         = "CollatingOrder",
                HasNameTable = true,
                Value        = "1033"
            },
                                                 new XPathResultToken
            {
                NodeType     = XPathNodeType.Attribute,
                LocalName    = "CollatingOrder",
                Name         = "CollatingOrder",
                HasNameTable = true,
                Value        = "1033"
            },
                                                 new XPathResultToken
            {
                NodeType     = XPathNodeType.Attribute,
                LocalName    = "CollatingOrder",
                Name         = "CollatingOrder",
                HasNameTable = true,
                Value        = "1034"
            },
                                                 new XPathResultToken
            {
                NodeType     = XPathNodeType.Attribute,
                LocalName    = "CollatingOrder",
                Name         = "CollatingOrder",
                HasNameTable = true,
                Value        = "1033"
            },
                                                 new XPathResultToken
            {
                NodeType     = XPathNodeType.Attribute,
                LocalName    = "CollatingOrder",
                Name         = "CollatingOrder",
                HasNameTable = true,
                Value        = "1034"
            },
                                                 new XPathResultToken
            {
                NodeType     = XPathNodeType.Attribute,
                LocalName    = "CollatingOrder",
                Name         = "CollatingOrder",
                HasNameTable = true,
                Value        = "1034"
            },
                                                 new XPathResultToken
            {
                NodeType     = XPathNodeType.Attribute,
                LocalName    = "CollatingOrder",
                Name         = "CollatingOrder",
                HasNameTable = true,
                Value        = "1033"
            },
                                                 new XPathResultToken
            {
                NodeType     = XPathNodeType.Attribute,
                LocalName    = "CollatingOrder",
                Name         = "CollatingOrder",
                HasNameTable = true,
                Value        = "1033"
            },
                                                 new XPathResultToken
            {
                NodeType     = XPathNodeType.Attribute,
                LocalName    = "CollatingOrder",
                Name         = "CollatingOrder",
                HasNameTable = true,
                Value        = "1033"
            },
                                                 new XPathResultToken
            {
                NodeType     = XPathNodeType.Attribute,
                LocalName    = "CollatingOrder",
                Name         = "CollatingOrder",
                HasNameTable = true,
                Value        = "1033"
            });

            Utils.XPathNodesetTest(xml, testExpression, expected);
        }
        public static void UsingPositionFunctionTest685()
        {
            var xml = "books.xml";
            var testExpression = @"//book/following-sibling::*[position()=1][position()=last()][1]";
            var expected = new XPathResult(0,
                new XPathResultToken
                {
                    NodeType = XPathNodeType.Element,
                    HasChildren = true,
                    HasAttributes = true,
                    LocalName = "book",
                    Name = "book",
                    HasNameTable = true,
                    Value =
                        "\n\t\tHistory of Trenton\n\t\t\n\t\t\tMary\n\t\t\tBob\n\t\t\t\n\t\t\t\tSelected Short Stories of\n\t\t\t\tJoeBob\n\t\t\t\tLoser\n\t\t\t\tUS\n\t\t\t\n\t\t\n\t\t55\n\t"
                },
                new XPathResultToken
                {
                    NodeType = XPathNodeType.Element,
                    HasChildren = true,
                    HasAttributes = true,
                    LocalName = "book",
                    Name = "book",
                    HasNameTable = true,
                    Value =
                        "\n\t\tXQL The Golden Years\n\t\t\n\t\t\tMike\n\t\t\tHyman\n\t\t\t\n\t\t\t\tXQL For Dummies\n\t\t\t\tJonathan\n\t\t\t\tMarsh\n\t\t\t\n\t\t\n\t\t55.95\n\t"
                },
                new XPathResultToken
                {
                    NodeType = XPathNodeType.Element,
                    HasChildren = true,
                    HasAttributes = true,
                    LocalName = "magazine",
                    Name = "magazine",
                    HasNameTable = true,
                    Value = "\n\t\tRoad and Track\n\t\t3.50\n\t\t\n\t\tYes\n\t"
                },
                new XPathResultToken
                {
                    NodeType = XPathNodeType.Element,
                    HasChildren = true,
                    HasAttributes = true,
                    LocalName = "book",
                    Name = "book",
                    HasNameTable = true,
                    Value =
                        "\n\t\tHistory of Trenton Vol 3\n\t\t\n\t\t\tMary F\n\t\t\tRobinson\n\t\t\tFrank\n\t\t\tAnderson\n\t\t\tPulizer\n\t\t\t\n\t\t\t\tSelected Short Stories of\n\t\t\t\tMary F\n\t\t\t\tRobinson\n\t\t\t\n\t\t\n\t\t10\n\t"
                },
                new XPathResultToken
                {
                    NodeType = XPathNodeType.Element,
                    HasChildren = true,
                    HasAttributes = true,
                    LocalName = "book",
                    Name = "book",
                    HasNameTable = true,
                    Value = "\n\t\tHow To Fix Computers\n\t\t\n\t\t\tHack\n\t\t\ter\n\t\t\tPh.D.\n\t\t\n\t\t08\n\t"
                },
                new XPathResultToken
                {
                    NodeType = XPathNodeType.Element,
                    HasChildren = true,
                    HasAttributes = true,
                    LocalName = "magazine",
                    Name = "magazine",
                    HasNameTable = true,
                    Value = "\n\t\tTracking Trenton\n\t\t2.50\n\t\t\n\t"
                },
                new XPathResultToken
                {
                    NodeType = XPathNodeType.Element,
                    HasChildren = true,
                    HasAttributes = true,
                    LocalName = "book",
                    Name = "my:book",
                    NamespaceURI = "urn:http//www.placeholder-name-here.com/schema/",
                    HasNameTable = true,
                    Prefix = "my",
                    Value = "\n\t\tWho's Who in Trenton\n\t\tRobert Bob\n\t"
                });
            ;

            Utils.XPathNodesetTest(xml, testExpression, expected);
        }
Exemple #29
0
        public static void GlobalizationTest5614()
        {
            var xml            = "Single_byte_problem_chars_b.xml";
            var testExpression =
                "//V[contains(text(), \"\u00F6\u00DC\u00DF\") or text()=\"\u00A9 \u00AE\" or contains(text(), \"\u00BF\u00BE\u00D5\") or contains(text(), \"\u00C4\u00E4\u00D6\u00A7\u00B2\u00B3@\u00B5\") or contains(text(), \"\u00E5E5\u00E5\") or contains(text(), \"\u2122\")]";
            var expected = new XPathResult(0,
                                           new XPathResultToken
            {
                NodeType     = XPathNodeType.Element,
                HasChildren  = true,
                LocalName    = "V",
                Name         = "V",
                HasNameTable = true,
                Value        = "\u00F6\u00DC\u00DF"
            },
                                           new XPathResultToken
            {
                NodeType     = XPathNodeType.Element,
                HasChildren  = true,
                LocalName    = "V",
                Name         = "V",
                HasNameTable = true,
                Value        = "\u00A9 \u00AE"
            },
                                           new XPathResultToken
            {
                NodeType     = XPathNodeType.Element,
                HasChildren  = true,
                LocalName    = "V",
                Name         = "V",
                HasNameTable = true,
                Value        = "\u00BF\u00BE\u00D5"
            },
                                           new XPathResultToken
            {
                NodeType     = XPathNodeType.Element,
                HasChildren  = true,
                LocalName    = "V",
                Name         = "V",
                HasNameTable = true,
                Value        = "\u00C4\u00E4\u00D6\u00A7\u00B2\u00B3@\u00B5"
            },
                                           new XPathResultToken
            {
                NodeType     = XPathNodeType.Element,
                HasChildren  = true,
                LocalName    = "V",
                Name         = "V",
                HasNameTable = true,
                Value        = "\u00E5E5\u00E5"
            },
                                           new XPathResultToken
            {
                NodeType     = XPathNodeType.Element,
                HasChildren  = true,
                LocalName    = "V",
                Name         = "V",
                HasNameTable = true,
                Value        = "\u2122 \u00A9\u00AD\u00AE"
            });

            ;

            Utils.XPathNodesetTest(xml, testExpression, expected);
        }
Exemple #30
0
        private void button1_Click(object sender, RoutedEventArgs e)
        {
            DOMDocument document = browser.GetDocument();

            //XPath expressions
            XPathResult resultNum     = document.Evaluate("count(//div)");
            XPathResult resultNumSpec = document.Evaluate("count(//div[@class='col-sm-4 prod-thumb'])");
            XPathResult result        = document.Evaluate("string( / html / body / div[2] / div[2] / div[1] / div[2] / div / div[1] / div[2] / h3 / a)");
            XPathResult resultNodes   = document.Evaluate("/ html / body / div[2] / div[2] / div[1] / div[2] / div / *");

            //Check if XPath result type is correct
            if (resultNum.IsNumber && resultNumSpec.IsNumber)
            {
                label1.Content = "Quantity of all <div> = " + resultNum.Number;
                label2.Content = "Quantity of <div> with class 'col-sm-4 prod-thumb' = " + resultNumSpec.Number;
            }
            else
            {
                label1.Content = "Error";
                label2.Content = "Error";
            }

            //Check if XPath result type is correct
            if (result.IsString)
            {
                label3.Content = "Text from selected element: " + result.String;
            }
            else
            {
                label3.Content = "Error";
            }

            //Check if XPath result type is correct
            if (resultNodes.IsIterator)
            {
                label4.Content = resultNodes.ResultType;
            }
            else
            {
                label4.Content = "Mistake";
            }

            //Get list with DOMNodes
            var tmp = resultNodes.Iterator.Select(item => item.Node.Children);

            try
            {
                //Extract list with DOMNodes
                foreach (var item in tmp)
                {
                    foreach (var item1 in item)
                    {
                        //Extract DOMNode from the list
                        label4.Content = "Node type: " + item1.NodeType;
                        label5.Content = "Node name: " + item1.NodeName;
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
        public static void GlobalizationTest5614()
        {
            var xml            = "Single_byte_problem_chars_b.xml";
            var testExpression =
                @"//V[contains(text(), ""öÜß"") or text()=""© ®"" or contains(text(), ""¿¾Õ"") or contains(text(), ""ÄäÖ§²³@µ"") or contains(text(), ""åE5å"") or contains(text(), ""™"")]";
            var expected = new XPathResult(0,
                                           new XPathResultToken
            {
                NodeType     = XPathNodeType.Element,
                HasChildren  = true,
                LocalName    = "V",
                Name         = "V",
                HasNameTable = true,
                Value        = "öÜß"
            },
                                           new XPathResultToken
            {
                NodeType     = XPathNodeType.Element,
                HasChildren  = true,
                LocalName    = "V",
                Name         = "V",
                HasNameTable = true,
                Value        = "© ®"
            },
                                           new XPathResultToken
            {
                NodeType     = XPathNodeType.Element,
                HasChildren  = true,
                LocalName    = "V",
                Name         = "V",
                HasNameTable = true,
                Value        = "¿¾Õ"
            },
                                           new XPathResultToken
            {
                NodeType     = XPathNodeType.Element,
                HasChildren  = true,
                LocalName    = "V",
                Name         = "V",
                HasNameTable = true,
                Value        = "ÄäÖ§²³@µ"
            },
                                           new XPathResultToken
            {
                NodeType     = XPathNodeType.Element,
                HasChildren  = true,
                LocalName    = "V",
                Name         = "V",
                HasNameTable = true,
                Value        = "åE5å"
            },
                                           new XPathResultToken
            {
                NodeType     = XPathNodeType.Element,
                HasChildren  = true,
                LocalName    = "V",
                Name         = "V",
                HasNameTable = true,
                Value        = "™ ©­®"
            });

            ;

            Utils.XPathNodesetTest(xml, testExpression, expected);
        }
Exemple #32
0
        public static void AbbreviatedSyntaxTest1213()
        {
            var xml            = "books.xml";
            var testExpression = @"//*[1]";
            var expected       = new XPathResult(0,
                                                 new XPathResultToken
            {
                NodeType      = XPathNodeType.Element,
                HasChildren   = true,
                HasAttributes = true,
                LocalName     = "bookstore",
                Name          = "bookstore",
                HasNameTable  = true,
                Value         =
                    "\n\t\n\t\tSeven Years in Trenton\n\t\t\n\t\t\tJoe\n\t\t\tBob\n\t\t\tTrenton Literary Review Honorable Mention\n\t\t\tUSA\n\t\t\n\t\t12\n\t\n\t\n\t\tHistory of Trenton\n\t\t\n\t\t\tMary\n\t\t\tBob\n\t\t\t\n\t\t\t\tSelected Short Stories of\n\t\t\t\tJoeBob\n\t\t\t\tLoser\n\t\t\t\tUS\n\t\t\t\n\t\t\n\t\t55\n\t\n\t\n\t\tXQL The Golden Years\n\t\t\n\t\t\tMike\n\t\t\tHyman\n\t\t\t\n\t\t\t\tXQL For Dummies\n\t\t\t\tJonathan\n\t\t\t\tMarsh\n\t\t\t\n\t\t\n\t\t55.95\n\t\n\t\n\t\tRoad and Track\n\t\t3.50\n\t\t\n\t\tYes\n\t\n\t\n\t\tPC Week\n\t\tfree\n\t\tZiff Davis\n\t\n\t\n\t\tPC Magazine\n\t\t3.95\n\t\tZiff Davis\n\t\t\n\t\t\tCreate a dream PC\n\t\t\t\tCreate a list of needed hardware\n\t\t\t\n\t\t\tThe future of the web\n\t\t\t\tCan Netscape stay alive with Microsoft eating up its browser share?\n\t\t\t\tMSFT 99.30\n\t\t\t\t1998-06-23\n\t\t\t\n\t\t\tVisual Basic 5.0 - Will it stand the test of time?\n\t\t\t\n\t\t\n\t\n\t\n\t\t\n\t\t\tSport Cars - Can you really dream?\n\t\t\t\n\t\t\n\t\n\t\n\t\tPC Magazine Best Product of 1997\n\t\n\t\n\t\tHistory of Trenton 2\n\t\t\n\t\t\tMary F\n\t\t\tRobinson\n\t\t\t\n\t\t\t\tSelected Short Stories of\n\t\t\t\tMary F\n\t\t\t\tRobinson\n\t\t\t\n\t\t\n\t\t55\n\t\n\t\n\t\tHistory of Trenton Vol 3\n\t\t\n\t\t\tMary F\n\t\t\tRobinson\n\t\t\tFrank\n\t\t\tAnderson\n\t\t\tPulizer\n\t\t\t\n\t\t\t\tSelected Short Stories of\n\t\t\t\tMary F\n\t\t\t\tRobinson\n\t\t\t\n\t\t\n\t\t10\n\t\n\t\n\t\tHow To Fix Computers\n\t\t\n\t\t\tHack\n\t\t\ter\n\t\t\tPh.D.\n\t\t\n\t\t08\n\t\n\t\n\t\tTracking Trenton\n\t\t2.50\n\t\t\n\t\n\t\n\t\tTracking Trenton Stocks\n\t\t0.98\n\t\t\n\t\n\t\n\t\tTrenton Today, Trenton Tomorrow\n\t\t\n\t\t\tToni\n\t\t\tBob\n\t\t\tB.A.\n\t\t\tPh.D.\n\t\t\tPulizer\n\t\t\tStill in Trenton\n\t\t\tTrenton Forever\n\t\t\n\t\t6.50\n\t\t\n\t\t\tIt was a dark and stormy night.\n\t\t\tBut then all nights in Trenton seem dark and\n\t\t\tstormy to someone who has gone through what\n\t\t\tI have.\n\t\t\t\n\t\t\t\n\t\t\t\tTrenton\n\t\t\t\tmisery\n\t\t\t\n\t\t\n\t\n\t\n\t\tWho's Who in Trenton\n\t\tRobert Bob\n\t\n\t\n\t\tWhere is Trenton?\n\t\n\t\n\t\tWhere in the world is Trenton?\n\t\n"
            },
                                                 new XPathResultToken
            {
                NodeType      = XPathNodeType.Element,
                HasChildren   = true,
                HasAttributes = true,
                LocalName     = "book",
                Name          = "book",
                HasNameTable  = true,
                Value         =
                    "\n\t\tSeven Years in Trenton\n\t\t\n\t\t\tJoe\n\t\t\tBob\n\t\t\tTrenton Literary Review Honorable Mention\n\t\t\tUSA\n\t\t\n\t\t12\n\t"
            },
                                                 new XPathResultToken
            {
                NodeType     = XPathNodeType.Element,
                HasChildren  = true,
                LocalName    = "title",
                Name         = "title",
                HasNameTable = true,
                Value        = "Seven Years in Trenton"
            },
                                                 new XPathResultToken
            {
                NodeType     = XPathNodeType.Element,
                HasChildren  = true,
                LocalName    = "first-name",
                Name         = "first-name",
                HasNameTable = true,
                Value        = "Joe"
            },
                                                 new XPathResultToken
            {
                NodeType     = XPathNodeType.Element,
                HasChildren  = true,
                LocalName    = "title",
                Name         = "title",
                HasNameTable = true,
                Value        = "History of Trenton"
            },
                                                 new XPathResultToken
            {
                NodeType     = XPathNodeType.Element,
                HasChildren  = true,
                LocalName    = "first-name",
                Name         = "first-name",
                HasNameTable = true,
                Value        = "Mary"
            },
                                                 new XPathResultToken
            {
                NodeType     = XPathNodeType.Element,
                HasChildren  = true,
                LocalName    = "first-name",
                Name         = "first-name",
                HasNameTable = true,
                Value        = "JoeBob"
            },
                                                 new XPathResultToken
            {
                NodeType     = XPathNodeType.Element,
                HasChildren  = true,
                LocalName    = "title",
                Name         = "title",
                HasNameTable = true,
                Value        = "XQL The Golden Years"
            },
                                                 new XPathResultToken
            {
                NodeType     = XPathNodeType.Element,
                HasChildren  = true,
                LocalName    = "first.name",
                Name         = "first.name",
                HasNameTable = true,
                Value        = "Mike"
            },
                                                 new XPathResultToken
            {
                NodeType     = XPathNodeType.Element,
                HasChildren  = true,
                LocalName    = "first.name",
                Name         = "first.name",
                HasNameTable = true,
                Value        = "Jonathan"
            },
                                                 new XPathResultToken
            {
                NodeType     = XPathNodeType.Element,
                HasChildren  = true,
                LocalName    = "title",
                Name         = "title",
                HasNameTable = true,
                Value        = "Road and Track"
            },
                                                 new XPathResultToken
            {
                NodeType     = XPathNodeType.Element,
                HasChildren  = true,
                LocalName    = "title",
                Name         = "title",
                HasNameTable = true,
                Value        = "PC Week"
            },
                                                 new XPathResultToken
            {
                NodeType     = XPathNodeType.Element,
                HasChildren  = true,
                LocalName    = "title",
                Name         = "title",
                HasNameTable = true,
                Value        = "PC Magazine"
            },
                                                 new XPathResultToken
            {
                NodeType     = XPathNodeType.Element,
                HasChildren  = true,
                LocalName    = "story1",
                Name         = "story1",
                HasNameTable = true,
                Value        = "Create a dream PC\n\t\t\t\tCreate a list of needed hardware\n\t\t\t"
            },
                                                 new XPathResultToken
            {
                NodeType     = XPathNodeType.Element,
                HasChildren  = true,
                LocalName    = "details",
                Name         = "details",
                HasNameTable = true,
                Value        = "Create a list of needed hardware"
            },
                                                 new XPathResultToken
            {
                NodeType     = XPathNodeType.Element,
                HasChildren  = true,
                LocalName    = "details",
                Name         = "details",
                HasNameTable = true,
                Value        = "Can Netscape stay alive with Microsoft eating up its browser share?"
            },
                                                 new XPathResultToken
            {
                NodeType     = XPathNodeType.Element,
                HasChildren  = true,
                LocalName    = "articles",
                Name         = "articles",
                HasNameTable = true,
                Value        = "\n\t\t\tSport Cars - Can you really dream?\n\t\t\t\n\t\t"
            },
                                                 new XPathResultToken
            {
                NodeType     = XPathNodeType.Element,
                HasChildren  = true,
                LocalName    = "story1",
                Name         = "story1",
                HasNameTable = true,
                Value        = "Sport Cars - Can you really dream?\n\t\t\t"
            },
                                                 new XPathResultToken
            {
                NodeType     = XPathNodeType.Element,
                HasChildren  = true,
                LocalName    = "award",
                Name         = "award",
                HasNameTable = true,
                Value        = "PC Magazine Best Product of 1997"
            },
                                                 new XPathResultToken
            {
                NodeType     = XPathNodeType.Element,
                HasChildren  = true,
                LocalName    = "title",
                Name         = "title",
                HasNameTable = true,
                Value        = "History of Trenton 2"
            },
                                                 new XPathResultToken
            {
                NodeType     = XPathNodeType.Element,
                HasChildren  = true,
                LocalName    = "first.name",
                Name         = "first.name",
                HasNameTable = true,
                Value        = "Mary F"
            },
                                                 new XPathResultToken
            {
                NodeType     = XPathNodeType.Element,
                HasChildren  = true,
                LocalName    = "first.name",
                Name         = "first.name",
                HasNameTable = true,
                Value        = "Mary F"
            },
                                                 new XPathResultToken
            {
                NodeType     = XPathNodeType.Element,
                HasChildren  = true,
                LocalName    = "title",
                Name         = "title",
                HasNameTable = true,
                Value        = "History of Trenton Vol 3"
            },
                                                 new XPathResultToken
            {
                NodeType     = XPathNodeType.Element,
                HasChildren  = true,
                LocalName    = "first-name",
                Name         = "first-name",
                HasNameTable = true,
                Value        = "Mary F"
            },
                                                 new XPathResultToken
            {
                NodeType     = XPathNodeType.Element,
                HasChildren  = true,
                LocalName    = "first-name",
                Name         = "first-name",
                HasNameTable = true,
                Value        = "Mary F"
            },
                                                 new XPathResultToken
            {
                NodeType     = XPathNodeType.Element,
                HasChildren  = true,
                LocalName    = "title",
                Name         = "title",
                HasNameTable = true,
                Value        = "How To Fix Computers"
            },
                                                 new XPathResultToken
            {
                NodeType     = XPathNodeType.Element,
                HasChildren  = true,
                LocalName    = "first-name",
                Name         = "first-name",
                HasNameTable = true,
                Value        = "Hack"
            },
                                                 new XPathResultToken
            {
                NodeType     = XPathNodeType.Element,
                HasChildren  = true,
                LocalName    = "title",
                Name         = "title",
                HasNameTable = true,
                Value        = "Tracking Trenton"
            },
                                                 new XPathResultToken
            {
                NodeType     = XPathNodeType.Element,
                HasChildren  = true,
                LocalName    = "title",
                Name         = "title",
                HasNameTable = true,
                Value        = "Tracking Trenton Stocks"
            },
                                                 new XPathResultToken
            {
                NodeType     = XPathNodeType.Element,
                HasChildren  = true,
                LocalName    = "title",
                Name         = "title",
                HasNameTable = true,
                Value        = "Trenton Today, Trenton Tomorrow"
            },
                                                 new XPathResultToken
            {
                NodeType     = XPathNodeType.Element,
                HasChildren  = true,
                LocalName    = "first-name",
                Name         = "first-name",
                HasNameTable = true,
                Value        = "Toni"
            },
                                                 new XPathResultToken
            {
                NodeType     = XPathNodeType.Element,
                HasChildren  = true,
                LocalName    = "p",
                Name         = "p",
                HasNameTable = true,
                Value        = "It was a dark and stormy night."
            },
                                                 new XPathResultToken
            {
                NodeType     = XPathNodeType.Element,
                HasChildren  = true,
                LocalName    = "emph",
                Name         = "emph",
                HasNameTable = true,
                Value        = "I"
            },
                                                 new XPathResultToken
            {
                NodeType     = XPathNodeType.Element,
                HasChildren  = true,
                LocalName    = "term",
                Name         = "term",
                HasNameTable = true,
                Value        = "Trenton"
            },
                                                 new XPathResultToken
            {
                NodeType     = XPathNodeType.Element,
                HasChildren  = true,
                LocalName    = "title",
                Name         = "my:title",
                NamespaceURI = "urn:http//www.placeholder-name-here.com/schema/",
                HasNameTable = true,
                Prefix       = "my",
                Value        = "Who's Who in Trenton"
            },
                                                 new XPathResultToken
            {
                NodeType     = XPathNodeType.Element,
                HasChildren  = true,
                LocalName    = "title",
                Name         = "my:title",
                NamespaceURI = "urn:http//www.placeholder-name-here.com/schema/",
                HasNameTable = true,
                Prefix       = "my",
                Value        = "Where is Trenton?"
            },
                                                 new XPathResultToken
            {
                NodeType     = XPathNodeType.Element,
                HasChildren  = true,
                LocalName    = "title",
                Name         = "my:title",
                NamespaceURI = "urn:http//www.placeholder-name-here.com/schema/",
                HasNameTable = true,
                Prefix       = "my",
                Value        = "Where in the world is Trenton?"
            });

            ;

            Utils.XPathNodesetTest(xml, testExpression, expected);
        }
Exemple #33
0
        public static void RegressionTestsTest5511()
        {
            var xml            = "books.xml";
            var testExpression = @"//book[starts-with(@stype,'')]";
            var expected       = new XPathResult(0,
                                                 new XPathResultToken
            {
                NodeType      = XPathNodeType.Element,
                HasChildren   = true,
                HasAttributes = true,
                LocalName     = "book",
                Name          = "book",
                HasNameTable  = true,
                Value         =
                    "\n\t\tSeven Years in Trenton\n\t\t\n\t\t\tJoe\n\t\t\tBob\n\t\t\tTrenton Literary Review Honorable Mention\n\t\t\tUSA\n\t\t\n\t\t12\n\t"
            },
                                                 new XPathResultToken
            {
                NodeType      = XPathNodeType.Element,
                HasChildren   = true,
                HasAttributes = true,
                LocalName     = "book",
                Name          = "book",
                HasNameTable  = true,
                Value         =
                    "\n\t\tHistory of Trenton\n\t\t\n\t\t\tMary\n\t\t\tBob\n\t\t\t\n\t\t\t\tSelected Short Stories of\n\t\t\t\tJoeBob\n\t\t\t\tLoser\n\t\t\t\tUS\n\t\t\t\n\t\t\n\t\t55\n\t"
            },
                                                 new XPathResultToken
            {
                NodeType      = XPathNodeType.Element,
                HasChildren   = true,
                HasAttributes = true,
                LocalName     = "book",
                Name          = "book",
                HasNameTable  = true,
                Value         =
                    "\n\t\tXQL The Golden Years\n\t\t\n\t\t\tMike\n\t\t\tHyman\n\t\t\t\n\t\t\t\tXQL For Dummies\n\t\t\t\tJonathan\n\t\t\t\tMarsh\n\t\t\t\n\t\t\n\t\t55.95\n\t"
            },
                                                 new XPathResultToken
            {
                NodeType      = XPathNodeType.Element,
                HasChildren   = true,
                HasAttributes = true,
                LocalName     = "book",
                Name          = "book",
                HasNameTable  = true,
                Value         =
                    "\n\t\tHistory of Trenton 2\n\t\t\n\t\t\tMary F\n\t\t\tRobinson\n\t\t\t\n\t\t\t\tSelected Short Stories of\n\t\t\t\tMary F\n\t\t\t\tRobinson\n\t\t\t\n\t\t\n\t\t55\n\t"
            },
                                                 new XPathResultToken
            {
                NodeType      = XPathNodeType.Element,
                HasChildren   = true,
                HasAttributes = true,
                LocalName     = "book",
                Name          = "book",
                HasNameTable  = true,
                Value         =
                    "\n\t\tHistory of Trenton Vol 3\n\t\t\n\t\t\tMary F\n\t\t\tRobinson\n\t\t\tFrank\n\t\t\tAnderson\n\t\t\tPulizer\n\t\t\t\n\t\t\t\tSelected Short Stories of\n\t\t\t\tMary F\n\t\t\t\tRobinson\n\t\t\t\n\t\t\n\t\t10\n\t"
            },
                                                 new XPathResultToken
            {
                NodeType      = XPathNodeType.Element,
                HasChildren   = true,
                HasAttributes = true,
                LocalName     = "book",
                Name          = "book",
                HasNameTable  = true,
                Value         = "\n\t\tHow To Fix Computers\n\t\t\n\t\t\tHack\n\t\t\ter\n\t\t\tPh.D.\n\t\t\n\t\t08\n\t"
            },
                                                 new XPathResultToken
            {
                NodeType      = XPathNodeType.Element,
                HasChildren   = true,
                HasAttributes = true,
                LocalName     = "book",
                Name          = "book",
                HasNameTable  = true,
                Value         =
                    "\n\t\tTrenton Today, Trenton Tomorrow\n\t\t\n\t\t\tToni\n\t\t\tBob\n\t\t\tB.A.\n\t\t\tPh.D.\n\t\t\tPulizer\n\t\t\tStill in Trenton\n\t\t\tTrenton Forever\n\t\t\n\t\t6.50\n\t\t\n\t\t\tIt was a dark and stormy night.\n\t\t\tBut then all nights in Trenton seem dark and\n\t\t\tstormy to someone who has gone through what\n\t\t\tI have.\n\t\t\t\n\t\t\t\n\t\t\t\tTrenton\n\t\t\t\tmisery\n\t\t\t\n\t\t\n\t"
            });

            Utils.XPathNodesetTest(xml, testExpression, expected);
        }
Exemple #34
0
        public static void GlobalizationTest5610()
        {
            var xml            = "JPN_problem_chars_2.xml";
            var testExpression =
                "//char[contains(., \"\u592A\u5E73\u6D0B\") or contains(., \"\u6BEB\u6B47\u6B49\") or contains(., \"\u6ECC\u6F3E\u9ED1\") or contains(., \"\u5341\u6B43\u6FEC\u85F9\u72BE\u8868\") or contains(., \"\u86DE\u6BEB\u70DF\u7930\u7AF9\") or contains(., \"\uFF41\uFF22\uFF41\") or contains(., \"\uFF90\uFF91\uFF92\")]";
            var expected = new XPathResult(0,
                                           new XPathResultToken
            {
                NodeType     = XPathNodeType.Element,
                HasChildren  = true,
                LocalName    = "char",
                Name         = "char",
                HasNameTable = true,
                Value        = "\nNon-Problem \u592A\u5E73\u6D0B\n"
            },
                                           new XPathResultToken
            {
                NodeType     = XPathNodeType.Element,
                HasChildren  = true,
                LocalName    = "char",
                Name         = "char",
                HasNameTable = true,
                Value        = "\nDOS Restricted \u6BEB\u6B47\u6B49\n"
            },
                                           new XPathResultToken
            {
                NodeType     = XPathNodeType.Element,
                HasChildren  = true,
                LocalName    = "char",
                Name         = "char",
                HasNameTable = true,
                Value        = "\nBoundary \u6ECC\u6F3E\u9ED1\n"
            },
                                           new XPathResultToken
            {
                NodeType     = XPathNodeType.Element,
                HasChildren  = true,
                LocalName    = "char",
                Name         = "char",
                HasNameTable = true,
                Value        = "\n5C Trail Byte \u5341\u6B43\u6FEC\u85F9\u72BE\u8868 \n"
            },
                                           new XPathResultToken
            {
                NodeType     = XPathNodeType.Element,
                HasChildren  = true,
                LocalName    = "char",
                Name         = "char",
                HasNameTable = true,
                Value        = "\n7C Trail Byte \u86DE\u6BEB\u70DF\u7930\u7AF9 \n"
            },
                                           new XPathResultToken
            {
                NodeType     = XPathNodeType.Element,
                HasChildren  = true,
                LocalName    = "char",
                Name         = "char",
                HasNameTable = true,
                Value        = "\nDB Romaji \uFF41\uFF22\uFF41 \n"
            },
                                           new XPathResultToken
            {
                NodeType     = XPathNodeType.Element,
                HasChildren  = true,
                LocalName    = "char",
                Name         = "char",
                HasNameTable = true,
                Value        = "\nKana \uFF90\uFF91\uFF92 \n"
            });

            ;

            Utils.XPathNodesetTest(xml, testExpression, expected);
        }
Exemple #35
0
        public static void RegressionTestsTest557()
        {
            var xml            = "t98598.xml";
            var testExpression = @"//namespace::*";
            var expected       = new XPathResult(0,
                                                 new XPathResultToken
            {
                NodeType     = XPathNodeType.Namespace,
                LocalName    = "xml",
                Name         = "xml",
                HasNameTable = true,
                Value        = "http://www.w3.org/XML/1998/namespace"
            },
                                                 new XPathResultToken
            {
                NodeType     = XPathNodeType.Namespace,
                LocalName    = "foo2",
                Name         = "foo2",
                HasNameTable = true,
                Value        = "f2"
            },
                                                 new XPathResultToken
            {
                NodeType     = XPathNodeType.Namespace,
                LocalName    = "foo1",
                Name         = "foo1",
                HasNameTable = true,
                Value        = "f1"
            },
                                                 new XPathResultToken {
                NodeType = XPathNodeType.Namespace, HasNameTable = true, Value = "f0"
            },
                                                 new XPathResultToken
            {
                NodeType     = XPathNodeType.Namespace,
                LocalName    = "xml",
                Name         = "xml",
                HasNameTable = true,
                Value        = "http://www.w3.org/XML/1998/namespace"
            },
                                                 new XPathResultToken
            {
                NodeType     = XPathNodeType.Namespace,
                LocalName    = "bar2",
                Name         = "bar2",
                HasNameTable = true,
                Value        = "b2"
            },
                                                 new XPathResultToken
            {
                NodeType     = XPathNodeType.Namespace,
                LocalName    = "bar1",
                Name         = "bar1",
                HasNameTable = true,
                Value        = "b1"
            },
                                                 new XPathResultToken {
                NodeType = XPathNodeType.Namespace, HasNameTable = true, Value = "b0"
            },
                                                 new XPathResultToken
            {
                NodeType     = XPathNodeType.Namespace,
                LocalName    = "xml",
                Name         = "xml",
                HasNameTable = true,
                Value        = "http://www.w3.org/XML/1998/namespace"
            });

            Utils.XPathNodesetTest(xml, testExpression, expected);
        }
        public static void GlobalizationTest5610()
        {
            var xml            = "JPN_problem_chars_2.xml";
            var testExpression =
                @"//char[contains(., ""太平洋"") or contains(., ""毫歇歉"") or contains(., ""滌漾黑"") or contains(., ""十歃濬藹犾表"") or contains(., ""蛞毫烟礰竹"") or contains(., ""aBa"") or contains(., ""ミムメ"")]";
            var expected = new XPathResult(0,
                                           new XPathResultToken
            {
                NodeType     = XPathNodeType.Element,
                HasChildren  = true,
                LocalName    = "char",
                Name         = "char",
                HasNameTable = true,
                Value        = "\nNon-Problem 太平洋\n"
            },
                                           new XPathResultToken
            {
                NodeType     = XPathNodeType.Element,
                HasChildren  = true,
                LocalName    = "char",
                Name         = "char",
                HasNameTable = true,
                Value        = "\nDOS Restricted 毫歇歉\n"
            },
                                           new XPathResultToken
            {
                NodeType     = XPathNodeType.Element,
                HasChildren  = true,
                LocalName    = "char",
                Name         = "char",
                HasNameTable = true,
                Value        = "\nBoundary 滌漾黑\n"
            },
                                           new XPathResultToken
            {
                NodeType     = XPathNodeType.Element,
                HasChildren  = true,
                LocalName    = "char",
                Name         = "char",
                HasNameTable = true,
                Value        = "\n5C Trail Byte 十歃濬藹犾表 \n"
            },
                                           new XPathResultToken
            {
                NodeType     = XPathNodeType.Element,
                HasChildren  = true,
                LocalName    = "char",
                Name         = "char",
                HasNameTable = true,
                Value        = "\n7C Trail Byte 蛞毫烟礰竹 \n"
            },
                                           new XPathResultToken
            {
                NodeType     = XPathNodeType.Element,
                HasChildren  = true,
                LocalName    = "char",
                Name         = "char",
                HasNameTable = true,
                Value        = "\nDB Romaji aBa \n"
            },
                                           new XPathResultToken
            {
                NodeType     = XPathNodeType.Element,
                HasChildren  = true,
                LocalName    = "char",
                Name         = "char",
                HasNameTable = true,
                Value        = "\nKana ミムメ \n"
            });

            ;

            Utils.XPathNodesetTest(xml, testExpression, expected);
        }
        public static void UsingPositionFunctionTest687()
        {
            var xml = "books.xml";
            var testExpression = @"//book/preceding-sibling::*[position()=1][position()=last()][1]";
            var expected = new XPathResult(0,
                new XPathResultToken
                {
                    NodeType = XPathNodeType.Element,
                    HasChildren = true,
                    HasAttributes = true,
                    LocalName = "book",
                    Name = "book",
                    HasNameTable = true,
                    Value =
                        "\n\t\tSeven Years in Trenton\n\t\t\n\t\t\tJoe\n\t\t\tBob\n\t\t\tTrenton Literary Review Honorable Mention\n\t\t\tUSA\n\t\t\n\t\t12\n\t"
                },
                new XPathResultToken
                {
                    NodeType = XPathNodeType.Element,
                    HasChildren = true,
                    HasAttributes = true,
                    LocalName = "book",
                    Name = "book",
                    HasNameTable = true,
                    Value =
                        "\n\t\tHistory of Trenton\n\t\t\n\t\t\tMary\n\t\t\tBob\n\t\t\t\n\t\t\t\tSelected Short Stories of\n\t\t\t\tJoeBob\n\t\t\t\tLoser\n\t\t\t\tUS\n\t\t\t\n\t\t\n\t\t55\n\t"
                },
                new XPathResultToken
                {
                    NodeType = XPathNodeType.Element,
                    HasChildren = true,
                    HasAttributes = true,
                    LocalName = "magazine",
                    Name = "magazine",
                    HasNameTable = true,
                    Value = "\n\t\tPC Magazine Best Product of 1997\n\t"
                },
                new XPathResultToken
                {
                    NodeType = XPathNodeType.Element,
                    HasChildren = true,
                    HasAttributes = true,
                    LocalName = "book",
                    Name = "book",
                    HasNameTable = true,
                    Value =
                        "\n\t\tHistory of Trenton 2\n\t\t\n\t\t\tMary F\n\t\t\tRobinson\n\t\t\t\n\t\t\t\tSelected Short Stories of\n\t\t\t\tMary F\n\t\t\t\tRobinson\n\t\t\t\n\t\t\n\t\t55\n\t"
                },
                new XPathResultToken
                {
                    NodeType = XPathNodeType.Element,
                    HasChildren = true,
                    HasAttributes = true,
                    LocalName = "book",
                    Name = "book",
                    HasNameTable = true,
                    Value =
                        "\n\t\tHistory of Trenton Vol 3\n\t\t\n\t\t\tMary F\n\t\t\tRobinson\n\t\t\tFrank\n\t\t\tAnderson\n\t\t\tPulizer\n\t\t\t\n\t\t\t\tSelected Short Stories of\n\t\t\t\tMary F\n\t\t\t\tRobinson\n\t\t\t\n\t\t\n\t\t10\n\t"
                },
                new XPathResultToken
                {
                    NodeType = XPathNodeType.Element,
                    HasChildren = true,
                    HasAttributes = true,
                    LocalName = "magazine",
                    Name = "my:magazine",
                    NamespaceURI = "urn:http//www.placeholder-name-here.com/schema/",
                    HasNameTable = true,
                    Prefix = "my",
                    Value = "\n\t\tTracking Trenton Stocks\n\t\t0.98\n\t\t\n\t"
                });
            ;

            Utils.XPathNodesetTest(xml, testExpression, expected);
        }
Exemple #38
0
        public static void StepsTest149()
        {
            var xml            = "books.xml";
            var testExpression = @"/bookstore/* [name()='book' or name()='magazine'][name()='magazine']";
            var expected       = new XPathResult(0,
                                                 new XPathResultToken
            {
                NodeType      = XPathNodeType.Element,
                HasChildren   = true,
                HasAttributes = true,
                LocalName     = "magazine",
                Name          = "magazine",
                HasNameTable  = true,
                Value         = "\n\t\tRoad and Track\n\t\t3.50\n\t\t\n\t\tYes\n\t"
            },
                                                 new XPathResultToken
            {
                NodeType      = XPathNodeType.Element,
                HasChildren   = true,
                HasAttributes = true,
                LocalName     = "magazine",
                Name          = "magazine",
                HasNameTable  = true,
                Value         = "\n\t\tPC Week\n\t\tfree\n\t\tZiff Davis\n\t"
            },
                                                 new XPathResultToken
            {
                NodeType      = XPathNodeType.Element,
                HasChildren   = true,
                HasAttributes = true,
                LocalName     = "magazine",
                Name          = "magazine",
                HasNameTable  = true,
                Value         =
                    "\n\t\tPC Magazine\n\t\t3.95\n\t\tZiff Davis\n\t\t\n\t\t\tCreate a dream PC\n\t\t\t\tCreate a list of needed hardware\n\t\t\t\n\t\t\tThe future of the web\n\t\t\t\tCan Netscape stay alive with Microsoft eating up its browser share?\n\t\t\t\tMSFT 99.30\n\t\t\t\t1998-06-23\n\t\t\t\n\t\t\tVisual Basic 5.0 - Will it stand the test of time?\n\t\t\t\n\t\t\n\t"
            },
                                                 new XPathResultToken
            {
                NodeType      = XPathNodeType.Element,
                HasChildren   = true,
                HasAttributes = true,
                LocalName     = "magazine",
                Name          = "magazine",
                HasNameTable  = true,
                Value         = "\n\t\t\n\t\t\tSport Cars - Can you really dream?\n\t\t\t\n\t\t\n\t"
            },
                                                 new XPathResultToken
            {
                NodeType      = XPathNodeType.Element,
                HasChildren   = true,
                HasAttributes = true,
                LocalName     = "magazine",
                Name          = "magazine",
                HasNameTable  = true,
                Value         = "\n\t\tPC Magazine Best Product of 1997\n\t"
            },
                                                 new XPathResultToken
            {
                NodeType      = XPathNodeType.Element,
                HasChildren   = true,
                HasAttributes = true,
                LocalName     = "magazine",
                Name          = "magazine",
                HasNameTable  = true,
                Value         = "\n\t\tTracking Trenton\n\t\t2.50\n\t\t\n\t"
            });

            ;

            Utils.XPathNodesetTest(xml, testExpression, expected);
        }
        public static void UsingPositionFunctionTest681()
        {
            var xml = "books.xml";
            var testExpression = @"//book/namespace::*/parent::*[position()=1][position()=last()][1]";
            var expected = new XPathResult(0,
                new XPathResultToken
                {
                    NodeType = XPathNodeType.Element,
                    HasChildren = true,
                    HasAttributes = true,
                    LocalName = "book",
                    Name = "book",
                    HasNameTable = true,
                    Value =
                        "\n\t\tSeven Years in Trenton\n\t\t\n\t\t\tJoe\n\t\t\tBob\n\t\t\tTrenton Literary Review Honorable Mention\n\t\t\tUSA\n\t\t\n\t\t12\n\t"
                },
                new XPathResultToken
                {
                    NodeType = XPathNodeType.Element,
                    HasChildren = true,
                    HasAttributes = true,
                    LocalName = "book",
                    Name = "book",
                    HasNameTable = true,
                    Value =
                        "\n\t\tHistory of Trenton\n\t\t\n\t\t\tMary\n\t\t\tBob\n\t\t\t\n\t\t\t\tSelected Short Stories of\n\t\t\t\tJoeBob\n\t\t\t\tLoser\n\t\t\t\tUS\n\t\t\t\n\t\t\n\t\t55\n\t"
                },
                new XPathResultToken
                {
                    NodeType = XPathNodeType.Element,
                    HasChildren = true,
                    HasAttributes = true,
                    LocalName = "book",
                    Name = "book",
                    HasNameTable = true,
                    Value =
                        "\n\t\tXQL The Golden Years\n\t\t\n\t\t\tMike\n\t\t\tHyman\n\t\t\t\n\t\t\t\tXQL For Dummies\n\t\t\t\tJonathan\n\t\t\t\tMarsh\n\t\t\t\n\t\t\n\t\t55.95\n\t"
                },
                new XPathResultToken
                {
                    NodeType = XPathNodeType.Element,
                    HasChildren = true,
                    HasAttributes = true,
                    LocalName = "book",
                    Name = "book",
                    HasNameTable = true,
                    Value =
                        "\n\t\tHistory of Trenton 2\n\t\t\n\t\t\tMary F\n\t\t\tRobinson\n\t\t\t\n\t\t\t\tSelected Short Stories of\n\t\t\t\tMary F\n\t\t\t\tRobinson\n\t\t\t\n\t\t\n\t\t55\n\t"
                },
                new XPathResultToken
                {
                    NodeType = XPathNodeType.Element,
                    HasChildren = true,
                    HasAttributes = true,
                    LocalName = "book",
                    Name = "book",
                    HasNameTable = true,
                    Value =
                        "\n\t\tHistory of Trenton Vol 3\n\t\t\n\t\t\tMary F\n\t\t\tRobinson\n\t\t\tFrank\n\t\t\tAnderson\n\t\t\tPulizer\n\t\t\t\n\t\t\t\tSelected Short Stories of\n\t\t\t\tMary F\n\t\t\t\tRobinson\n\t\t\t\n\t\t\n\t\t10\n\t"
                },
                new XPathResultToken
                {
                    NodeType = XPathNodeType.Element,
                    HasChildren = true,
                    HasAttributes = true,
                    LocalName = "book",
                    Name = "book",
                    HasNameTable = true,
                    Value = "\n\t\tHow To Fix Computers\n\t\t\n\t\t\tHack\n\t\t\ter\n\t\t\tPh.D.\n\t\t\n\t\t08\n\t"
                },
                new XPathResultToken
                {
                    NodeType = XPathNodeType.Element,
                    HasChildren = true,
                    HasAttributes = true,
                    LocalName = "book",
                    Name = "book",
                    HasNameTable = true,
                    Value =
                        "\n\t\tTrenton Today, Trenton Tomorrow\n\t\t\n\t\t\tToni\n\t\t\tBob\n\t\t\tB.A.\n\t\t\tPh.D.\n\t\t\tPulizer\n\t\t\tStill in Trenton\n\t\t\tTrenton Forever\n\t\t\n\t\t6.50\n\t\t\n\t\t\tIt was a dark and stormy night.\n\t\t\tBut then all nights in Trenton seem dark and\n\t\t\tstormy to someone who has gone through what\n\t\t\tI have.\n\t\t\t\n\t\t\t\n\t\t\t\tTrenton\n\t\t\t\tmisery\n\t\t\t\n\t\t\n\t"
                });
            ;

            Utils.XPathNodesetTest(xml, testExpression, expected);
        }
        public static void UsingPositionFunctionTest623()
        {
            var xml = "books.xml";
            var startingNodePath = "/bookstore/book/author";
            var testExpression = @"self::node()[position()>1 or position()<1]";
            var expected = new XPathResult(0);
            ;

            Utils.XPathNodesetTest(xml, testExpression, expected, startingNodePath: startingNodePath);
        }
        public static void UsingPositionFunctionTest682()
        {
            var xml = "books.xml";
            var testExpression = @"//book/following::*/parent::*[position()=1][position()=last()][1]";
            var expected = new XPathResult(0,
                new XPathResultToken
                {
                    NodeType = XPathNodeType.Element,
                    HasChildren = true,
                    HasAttributes = true,
                    LocalName = "bookstore",
                    Name = "bookstore",
                    HasNameTable = true,
                    Value =
                        "\n\t\n\t\tSeven Years in Trenton\n\t\t\n\t\t\tJoe\n\t\t\tBob\n\t\t\tTrenton Literary Review Honorable Mention\n\t\t\tUSA\n\t\t\n\t\t12\n\t\n\t\n\t\tHistory of Trenton\n\t\t\n\t\t\tMary\n\t\t\tBob\n\t\t\t\n\t\t\t\tSelected Short Stories of\n\t\t\t\tJoeBob\n\t\t\t\tLoser\n\t\t\t\tUS\n\t\t\t\n\t\t\n\t\t55\n\t\n\t\n\t\tXQL The Golden Years\n\t\t\n\t\t\tMike\n\t\t\tHyman\n\t\t\t\n\t\t\t\tXQL For Dummies\n\t\t\t\tJonathan\n\t\t\t\tMarsh\n\t\t\t\n\t\t\n\t\t55.95\n\t\n\t\n\t\tRoad and Track\n\t\t3.50\n\t\t\n\t\tYes\n\t\n\t\n\t\tPC Week\n\t\tfree\n\t\tZiff Davis\n\t\n\t\n\t\tPC Magazine\n\t\t3.95\n\t\tZiff Davis\n\t\t\n\t\t\tCreate a dream PC\n\t\t\t\tCreate a list of needed hardware\n\t\t\t\n\t\t\tThe future of the web\n\t\t\t\tCan Netscape stay alive with Microsoft eating up its browser share?\n\t\t\t\tMSFT 99.30\n\t\t\t\t1998-06-23\n\t\t\t\n\t\t\tVisual Basic 5.0 - Will it stand the test of time?\n\t\t\t\n\t\t\n\t\n\t\n\t\t\n\t\t\tSport Cars - Can you really dream?\n\t\t\t\n\t\t\n\t\n\t\n\t\tPC Magazine Best Product of 1997\n\t\n\t\n\t\tHistory of Trenton 2\n\t\t\n\t\t\tMary F\n\t\t\tRobinson\n\t\t\t\n\t\t\t\tSelected Short Stories of\n\t\t\t\tMary F\n\t\t\t\tRobinson\n\t\t\t\n\t\t\n\t\t55\n\t\n\t\n\t\tHistory of Trenton Vol 3\n\t\t\n\t\t\tMary F\n\t\t\tRobinson\n\t\t\tFrank\n\t\t\tAnderson\n\t\t\tPulizer\n\t\t\t\n\t\t\t\tSelected Short Stories of\n\t\t\t\tMary F\n\t\t\t\tRobinson\n\t\t\t\n\t\t\n\t\t10\n\t\n\t\n\t\tHow To Fix Computers\n\t\t\n\t\t\tHack\n\t\t\ter\n\t\t\tPh.D.\n\t\t\n\t\t08\n\t\n\t\n\t\tTracking Trenton\n\t\t2.50\n\t\t\n\t\n\t\n\t\tTracking Trenton Stocks\n\t\t0.98\n\t\t\n\t\n\t\n\t\tTrenton Today, Trenton Tomorrow\n\t\t\n\t\t\tToni\n\t\t\tBob\n\t\t\tB.A.\n\t\t\tPh.D.\n\t\t\tPulizer\n\t\t\tStill in Trenton\n\t\t\tTrenton Forever\n\t\t\n\t\t6.50\n\t\t\n\t\t\tIt was a dark and stormy night.\n\t\t\tBut then all nights in Trenton seem dark and\n\t\t\tstormy to someone who has gone through what\n\t\t\tI have.\n\t\t\t\n\t\t\t\n\t\t\t\tTrenton\n\t\t\t\tmisery\n\t\t\t\n\t\t\n\t\n\t\n\t\tWho's Who in Trenton\n\t\tRobert Bob\n\t\n\t\n\t\tWhere is Trenton?\n\t\n\t\n\t\tWhere in the world is Trenton?\n\t\n"
                },
                new XPathResultToken
                {
                    NodeType = XPathNodeType.Element,
                    HasChildren = true,
                    HasAttributes = true,
                    LocalName = "book",
                    Name = "book",
                    HasNameTable = true,
                    Value =
                        "\n\t\tHistory of Trenton\n\t\t\n\t\t\tMary\n\t\t\tBob\n\t\t\t\n\t\t\t\tSelected Short Stories of\n\t\t\t\tJoeBob\n\t\t\t\tLoser\n\t\t\t\tUS\n\t\t\t\n\t\t\n\t\t55\n\t"
                },
                new XPathResultToken
                {
                    NodeType = XPathNodeType.Element,
                    HasChildren = true,
                    LocalName = "author",
                    Name = "author",
                    HasNameTable = true,
                    Value =
                        "\n\t\t\tMary\n\t\t\tBob\n\t\t\t\n\t\t\t\tSelected Short Stories of\n\t\t\t\tJoeBob\n\t\t\t\tLoser\n\t\t\t\tUS\n\t\t\t\n\t\t"
                },
                new XPathResultToken
                {
                    NodeType = XPathNodeType.Element,
                    HasChildren = true,
                    LocalName = "publication",
                    Name = "publication",
                    HasNameTable = true,
                    Value = "\n\t\t\t\tSelected Short Stories of\n\t\t\t\tJoeBob\n\t\t\t\tLoser\n\t\t\t\tUS\n\t\t\t"
                },
                new XPathResultToken
                {
                    NodeType = XPathNodeType.Element,
                    HasChildren = true,
                    HasAttributes = true,
                    LocalName = "book",
                    Name = "book",
                    HasNameTable = true,
                    Value =
                        "\n\t\tXQL The Golden Years\n\t\t\n\t\t\tMike\n\t\t\tHyman\n\t\t\t\n\t\t\t\tXQL For Dummies\n\t\t\t\tJonathan\n\t\t\t\tMarsh\n\t\t\t\n\t\t\n\t\t55.95\n\t"
                },
                new XPathResultToken
                {
                    NodeType = XPathNodeType.Element,
                    HasChildren = true,
                    LocalName = "author",
                    Name = "author",
                    HasNameTable = true,
                    Value =
                        "\n\t\t\tMike\n\t\t\tHyman\n\t\t\t\n\t\t\t\tXQL For Dummies\n\t\t\t\tJonathan\n\t\t\t\tMarsh\n\t\t\t\n\t\t"
                },
                new XPathResultToken
                {
                    NodeType = XPathNodeType.Element,
                    HasChildren = true,
                    LocalName = "publication",
                    Name = "publication",
                    HasNameTable = true,
                    Value = "\n\t\t\t\tXQL For Dummies\n\t\t\t\tJonathan\n\t\t\t\tMarsh\n\t\t\t"
                },
                new XPathResultToken
                {
                    NodeType = XPathNodeType.Element,
                    HasChildren = true,
                    HasAttributes = true,
                    LocalName = "magazine",
                    Name = "magazine",
                    HasNameTable = true,
                    Value = "\n\t\tRoad and Track\n\t\t3.50\n\t\t\n\t\tYes\n\t"
                },
                new XPathResultToken
                {
                    NodeType = XPathNodeType.Element,
                    HasChildren = true,
                    HasAttributes = true,
                    LocalName = "magazine",
                    Name = "magazine",
                    HasNameTable = true,
                    Value = "\n\t\tPC Week\n\t\tfree\n\t\tZiff Davis\n\t"
                },
                new XPathResultToken
                {
                    NodeType = XPathNodeType.Element,
                    HasChildren = true,
                    HasAttributes = true,
                    LocalName = "magazine",
                    Name = "magazine",
                    HasNameTable = true,
                    Value =
                        "\n\t\tPC Magazine\n\t\t3.95\n\t\tZiff Davis\n\t\t\n\t\t\tCreate a dream PC\n\t\t\t\tCreate a list of needed hardware\n\t\t\t\n\t\t\tThe future of the web\n\t\t\t\tCan Netscape stay alive with Microsoft eating up its browser share?\n\t\t\t\tMSFT 99.30\n\t\t\t\t1998-06-23\n\t\t\t\n\t\t\tVisual Basic 5.0 - Will it stand the test of time?\n\t\t\t\n\t\t\n\t"
                },
                new XPathResultToken
                {
                    NodeType = XPathNodeType.Element,
                    HasChildren = true,
                    LocalName = "articles",
                    Name = "articles",
                    HasNameTable = true,
                    Value =
                        "\n\t\t\tCreate a dream PC\n\t\t\t\tCreate a list of needed hardware\n\t\t\t\n\t\t\tThe future of the web\n\t\t\t\tCan Netscape stay alive with Microsoft eating up its browser share?\n\t\t\t\tMSFT 99.30\n\t\t\t\t1998-06-23\n\t\t\t\n\t\t\tVisual Basic 5.0 - Will it stand the test of time?\n\t\t\t\n\t\t"
                },
                new XPathResultToken
                {
                    NodeType = XPathNodeType.Element,
                    HasChildren = true,
                    LocalName = "story1",
                    Name = "story1",
                    HasNameTable = true,
                    Value = "Create a dream PC\n\t\t\t\tCreate a list of needed hardware\n\t\t\t"
                },
                new XPathResultToken
                {
                    NodeType = XPathNodeType.Element,
                    HasChildren = true,
                    LocalName = "story2",
                    Name = "story2",
                    HasNameTable = true,
                    Value =
                        "The future of the web\n\t\t\t\tCan Netscape stay alive with Microsoft eating up its browser share?\n\t\t\t\tMSFT 99.30\n\t\t\t\t1998-06-23\n\t\t\t"
                },
                new XPathResultToken
                {
                    NodeType = XPathNodeType.Element,
                    HasChildren = true,
                    HasAttributes = true,
                    LocalName = "magazine",
                    Name = "magazine",
                    HasNameTable = true,
                    Value = "\n\t\t\n\t\t\tSport Cars - Can you really dream?\n\t\t\t\n\t\t\n\t"
                },
                new XPathResultToken
                {
                    NodeType = XPathNodeType.Element,
                    HasChildren = true,
                    LocalName = "articles",
                    Name = "articles",
                    HasNameTable = true,
                    Value = "\n\t\t\tSport Cars - Can you really dream?\n\t\t\t\n\t\t"
                },
                new XPathResultToken
                {
                    NodeType = XPathNodeType.Element,
                    HasChildren = true,
                    HasAttributes = true,
                    LocalName = "magazine",
                    Name = "magazine",
                    HasNameTable = true,
                    Value = "\n\t\tPC Magazine Best Product of 1997\n\t"
                },
                new XPathResultToken
                {
                    NodeType = XPathNodeType.Element,
                    HasChildren = true,
                    HasAttributes = true,
                    LocalName = "book",
                    Name = "book",
                    HasNameTable = true,
                    Value =
                        "\n\t\tHistory of Trenton 2\n\t\t\n\t\t\tMary F\n\t\t\tRobinson\n\t\t\t\n\t\t\t\tSelected Short Stories of\n\t\t\t\tMary F\n\t\t\t\tRobinson\n\t\t\t\n\t\t\n\t\t55\n\t"
                },
                new XPathResultToken
                {
                    NodeType = XPathNodeType.Element,
                    HasChildren = true,
                    LocalName = "author",
                    Name = "author",
                    HasNameTable = true,
                    Value =
                        "\n\t\t\tMary F\n\t\t\tRobinson\n\t\t\t\n\t\t\t\tSelected Short Stories of\n\t\t\t\tMary F\n\t\t\t\tRobinson\n\t\t\t\n\t\t"
                },
                new XPathResultToken
                {
                    NodeType = XPathNodeType.Element,
                    HasChildren = true,
                    LocalName = "publication",
                    Name = "publication",
                    HasNameTable = true,
                    Value = "\n\t\t\t\tSelected Short Stories of\n\t\t\t\tMary F\n\t\t\t\tRobinson\n\t\t\t"
                },
                new XPathResultToken
                {
                    NodeType = XPathNodeType.Element,
                    HasChildren = true,
                    HasAttributes = true,
                    LocalName = "book",
                    Name = "book",
                    HasNameTable = true,
                    Value =
                        "\n\t\tHistory of Trenton Vol 3\n\t\t\n\t\t\tMary F\n\t\t\tRobinson\n\t\t\tFrank\n\t\t\tAnderson\n\t\t\tPulizer\n\t\t\t\n\t\t\t\tSelected Short Stories of\n\t\t\t\tMary F\n\t\t\t\tRobinson\n\t\t\t\n\t\t\n\t\t10\n\t"
                },
                new XPathResultToken
                {
                    NodeType = XPathNodeType.Element,
                    HasChildren = true,
                    LocalName = "author",
                    Name = "author",
                    HasNameTable = true,
                    Value =
                        "\n\t\t\tMary F\n\t\t\tRobinson\n\t\t\tFrank\n\t\t\tAnderson\n\t\t\tPulizer\n\t\t\t\n\t\t\t\tSelected Short Stories of\n\t\t\t\tMary F\n\t\t\t\tRobinson\n\t\t\t\n\t\t"
                },
                new XPathResultToken
                {
                    NodeType = XPathNodeType.Element,
                    HasChildren = true,
                    LocalName = "publication",
                    Name = "publication",
                    HasNameTable = true,
                    Value = "\n\t\t\t\tSelected Short Stories of\n\t\t\t\tMary F\n\t\t\t\tRobinson\n\t\t\t"
                },
                new XPathResultToken
                {
                    NodeType = XPathNodeType.Element,
                    HasChildren = true,
                    HasAttributes = true,
                    LocalName = "book",
                    Name = "book",
                    HasNameTable = true,
                    Value = "\n\t\tHow To Fix Computers\n\t\t\n\t\t\tHack\n\t\t\ter\n\t\t\tPh.D.\n\t\t\n\t\t08\n\t"
                },
                new XPathResultToken
                {
                    NodeType = XPathNodeType.Element,
                    HasChildren = true,
                    LocalName = "author",
                    Name = "author",
                    HasNameTable = true,
                    Value = "\n\t\t\tHack\n\t\t\ter\n\t\t\tPh.D.\n\t\t"
                },
                new XPathResultToken
                {
                    NodeType = XPathNodeType.Element,
                    HasChildren = true,
                    HasAttributes = true,
                    LocalName = "magazine",
                    Name = "magazine",
                    HasNameTable = true,
                    Value = "\n\t\tTracking Trenton\n\t\t2.50\n\t\t\n\t"
                },
                new XPathResultToken
                {
                    NodeType = XPathNodeType.Element,
                    HasChildren = true,
                    HasAttributes = true,
                    LocalName = "magazine",
                    Name = "my:magazine",
                    NamespaceURI = "urn:http//www.placeholder-name-here.com/schema/",
                    HasNameTable = true,
                    Prefix = "my",
                    Value = "\n\t\tTracking Trenton Stocks\n\t\t0.98\n\t\t\n\t"
                },
                new XPathResultToken
                {
                    NodeType = XPathNodeType.Element,
                    HasChildren = true,
                    HasAttributes = true,
                    LocalName = "book",
                    Name = "book",
                    HasNameTable = true,
                    Value =
                        "\n\t\tTrenton Today, Trenton Tomorrow\n\t\t\n\t\t\tToni\n\t\t\tBob\n\t\t\tB.A.\n\t\t\tPh.D.\n\t\t\tPulizer\n\t\t\tStill in Trenton\n\t\t\tTrenton Forever\n\t\t\n\t\t6.50\n\t\t\n\t\t\tIt was a dark and stormy night.\n\t\t\tBut then all nights in Trenton seem dark and\n\t\t\tstormy to someone who has gone through what\n\t\t\tI have.\n\t\t\t\n\t\t\t\n\t\t\t\tTrenton\n\t\t\t\tmisery\n\t\t\t\n\t\t\n\t"
                },
                new XPathResultToken
                {
                    NodeType = XPathNodeType.Element,
                    HasChildren = true,
                    LocalName = "author",
                    Name = "author",
                    HasNameTable = true,
                    Value =
                        "\n\t\t\tToni\n\t\t\tBob\n\t\t\tB.A.\n\t\t\tPh.D.\n\t\t\tPulizer\n\t\t\tStill in Trenton\n\t\t\tTrenton Forever\n\t\t"
                },
                new XPathResultToken
                {
                    NodeType = XPathNodeType.Element,
                    HasChildren = true,
                    LocalName = "excerpt",
                    Name = "excerpt",
                    HasNameTable = true,
                    Value =
                        "\n\t\t\tIt was a dark and stormy night.\n\t\t\tBut then all nights in Trenton seem dark and\n\t\t\tstormy to someone who has gone through what\n\t\t\tI have.\n\t\t\t\n\t\t\t\n\t\t\t\tTrenton\n\t\t\t\tmisery\n\t\t\t\n\t\t"
                },
                new XPathResultToken
                {
                    NodeType = XPathNodeType.Element,
                    HasChildren = true,
                    LocalName = "p",
                    Name = "p",
                    HasNameTable = true,
                    Value =
                        "But then all nights in Trenton seem dark and\n\t\t\tstormy to someone who has gone through what\n\t\t\tI have.\n\t\t\t"
                },
                new XPathResultToken
                {
                    NodeType = XPathNodeType.Element,
                    HasChildren = true,
                    LocalName = "definition-list",
                    Name = "definition-list",
                    HasNameTable = true,
                    Value = "\n\t\t\t\tTrenton\n\t\t\t\tmisery\n\t\t\t"
                },
                new XPathResultToken
                {
                    NodeType = XPathNodeType.Element,
                    HasChildren = true,
                    HasAttributes = true,
                    LocalName = "book",
                    Name = "my:book",
                    NamespaceURI = "urn:http//www.placeholder-name-here.com/schema/",
                    HasNameTable = true,
                    Prefix = "my",
                    Value = "\n\t\tWho's Who in Trenton\n\t\tRobert Bob\n\t"
                },
                new XPathResultToken
                {
                    NodeType = XPathNodeType.Element,
                    HasChildren = true,
                    HasAttributes = true,
                    LocalName = "book",
                    Name = "my:book",
                    NamespaceURI = "urn:http//www.placeholder-name-here.com/schema/",
                    HasNameTable = true,
                    Prefix = "my",
                    Value = "\n\t\tWhere is Trenton?\n\t"
                },
                new XPathResultToken
                {
                    NodeType = XPathNodeType.Element,
                    HasChildren = true,
                    HasAttributes = true,
                    LocalName = "book",
                    Name = "my:book",
                    NamespaceURI = "urn:http//www.placeholder-name-here.com/schema/",
                    HasNameTable = true,
                    Prefix = "my",
                    Value = "\n\t\tWhere in the world is Trenton?\n\t"
                });
            ;

            Utils.XPathNodesetTest(xml, testExpression, expected);
        }
        public static void UsingPositionFunctionTest627()
        {
            var xml = "books.xml";
            var startingNodePath = "/bookstore";
            var testExpression = @"child::*/child::*[position()=last()]";
            var expected = new XPathResult(0,
                new XPathResultToken
                {
                    NodeType = XPathNodeType.Element,
                    HasChildren = true,
                    LocalName = "price",
                    Name = "price",
                    HasNameTable = true,
                    Value = "12"
                },
                new XPathResultToken
                {
                    NodeType = XPathNodeType.Element,
                    HasChildren = true,
                    LocalName = "price",
                    Name = "price",
                    HasNameTable = true,
                    Value = "55"
                },
                new XPathResultToken
                {
                    NodeType = XPathNodeType.Element,
                    HasChildren = true,
                    HasAttributes = true,
                    LocalName = "price",
                    Name = "price",
                    HasNameTable = true,
                    Value = "55.95"
                },
                new XPathResultToken
                {
                    NodeType = XPathNodeType.Element,
                    HasChildren = true,
                    HasAttributes = true,
                    LocalName = "special_edition",
                    Name = "special_edition",
                    HasNameTable = true,
                    Value = "Yes"
                },
                new XPathResultToken
                {
                    NodeType = XPathNodeType.Element,
                    HasChildren = true,
                    LocalName = "publisher",
                    Name = "publisher",
                    HasNameTable = true,
                    Value = "Ziff Davis"
                },
                new XPathResultToken
                {
                    NodeType = XPathNodeType.Element,
                    HasChildren = true,
                    LocalName = "articles",
                    Name = "articles",
                    HasNameTable = true,
                    Value =
                        "\n\t\t\tCreate a dream PC\n\t\t\t\tCreate a list of needed hardware\n\t\t\t\n\t\t\tThe future of the web\n\t\t\t\tCan Netscape stay alive with Microsoft eating up its browser share?\n\t\t\t\tMSFT 99.30\n\t\t\t\t1998-06-23\n\t\t\t\n\t\t\tVisual Basic 5.0 - Will it stand the test of time?\n\t\t\t\n\t\t"
                },
                new XPathResultToken
                {
                    NodeType = XPathNodeType.Element,
                    HasChildren = true,
                    LocalName = "articles",
                    Name = "articles",
                    HasNameTable = true,
                    Value = "\n\t\t\tSport Cars - Can you really dream?\n\t\t\t\n\t\t"
                },
                new XPathResultToken
                {
                    NodeType = XPathNodeType.Element,
                    HasChildren = true,
                    LocalName = "award",
                    Name = "award",
                    HasNameTable = true,
                    Value = "PC Magazine Best Product of 1997"
                },
                new XPathResultToken
                {
                    NodeType = XPathNodeType.Element,
                    HasChildren = true,
                    LocalName = "price",
                    Name = "price",
                    HasNameTable = true,
                    Value = "55"
                },
                new XPathResultToken
                {
                    NodeType = XPathNodeType.Element,
                    HasChildren = true,
                    LocalName = "price",
                    Name = "price",
                    HasNameTable = true,
                    Value = "10"
                },
                new XPathResultToken
                {
                    NodeType = XPathNodeType.Element,
                    HasChildren = true,
                    LocalName = "price",
                    Name = "price",
                    HasNameTable = true,
                    Value = "08"
                },
                new XPathResultToken
                {
                    NodeType = XPathNodeType.Element,
                    HasAttributes = true,
                    IsEmptyElement = true,
                    LocalName = "subscription",
                    Name = "subscription",
                    HasNameTable = true
                },
                new XPathResultToken
                {
                    NodeType = XPathNodeType.Element,
                    HasAttributes = true,
                    IsEmptyElement = true,
                    LocalName = "subscription",
                    Name = "subscription",
                    HasNameTable = true
                },
                new XPathResultToken
                {
                    NodeType = XPathNodeType.Element,
                    HasChildren = true,
                    LocalName = "excerpt",
                    Name = "excerpt",
                    HasNameTable = true,
                    Value =
                        "\n\t\t\tIt was a dark and stormy night.\n\t\t\tBut then all nights in Trenton seem dark and\n\t\t\tstormy to someone who has gone through what\n\t\t\tI have.\n\t\t\t\n\t\t\t\n\t\t\t\tTrenton\n\t\t\t\tmisery\n\t\t\t\n\t\t"
                },
                new XPathResultToken
                {
                    NodeType = XPathNodeType.Element,
                    HasChildren = true,
                    LocalName = "author",
                    Name = "my:author",
                    NamespaceURI = "urn:http//www.placeholder-name-here.com/schema/",
                    HasNameTable = true,
                    Prefix = "my",
                    Value = "Robert Bob"
                },
                new XPathResultToken
                {
                    NodeType = XPathNodeType.Element,
                    HasChildren = true,
                    LocalName = "title",
                    Name = "my:title",
                    NamespaceURI = "urn:http//www.placeholder-name-here.com/schema/",
                    HasNameTable = true,
                    Prefix = "my",
                    Value = "Where is Trenton?"
                },
                new XPathResultToken
                {
                    NodeType = XPathNodeType.Element,
                    HasChildren = true,
                    LocalName = "title",
                    Name = "my:title",
                    NamespaceURI = "urn:http//www.placeholder-name-here.com/schema/",
                    HasNameTable = true,
                    Prefix = "my",
                    Value = "Where in the world is Trenton?"
                });
            ;

            Utils.XPathNodesetTest(xml, testExpression, expected, startingNodePath: startingNodePath);
        }
        public static void UsingPositionFunctionTest686()
        {
            var xml = "books.xml";
            var testExpression = @"//book/preceding::*[position()=1][position()=last()][1]";
            var expected = new XPathResult(0,
                new XPathResultToken
                {
                    NodeType = XPathNodeType.Element,
                    HasChildren = true,
                    LocalName = "price",
                    Name = "price",
                    HasNameTable = true,
                    Value = "12"
                },
                new XPathResultToken
                {
                    NodeType = XPathNodeType.Element,
                    HasChildren = true,
                    LocalName = "price",
                    Name = "price",
                    HasNameTable = true,
                    Value = "55"
                },
                new XPathResultToken
                {
                    NodeType = XPathNodeType.Element,
                    HasChildren = true,
                    LocalName = "award",
                    Name = "award",
                    HasNameTable = true,
                    Value = "PC Magazine Best Product of 1997"
                },
                new XPathResultToken
                {
                    NodeType = XPathNodeType.Element,
                    HasChildren = true,
                    LocalName = "price",
                    Name = "price",
                    HasNameTable = true,
                    Value = "55"
                },
                new XPathResultToken
                {
                    NodeType = XPathNodeType.Element,
                    HasChildren = true,
                    LocalName = "price",
                    Name = "price",
                    HasNameTable = true,
                    Value = "10"
                },
                new XPathResultToken
                {
                    NodeType = XPathNodeType.Element,
                    HasAttributes = true,
                    IsEmptyElement = true,
                    LocalName = "subscription",
                    Name = "subscription",
                    HasNameTable = true
                });
            ;

            Utils.XPathNodesetTest(xml, testExpression, expected);
        }
Exemple #44
0
        public static void GlobalizationTest5613()
        {
            var xml            = "KOR_problem_chars_b.xml";
            var testExpression =
                "root/V[contains(text(), \"\uD55C\uAE00\") or text()=\"\u306F\uAF9C\u306F\uAF9C\u306F\uAF9C\u306F\uAF9C\u306F\uAF9C\" or contains(text(), \"\u8A70\u8A70\") or contains(text(), \"\u6A8D\u4E5F\") or contains(text(), \"\uAC00\uB098 \uAC00\") or contains(text(), \"\uFF2A\uFF55\uFF4E\uFF4A\uFF41\")]";
            var expected = new XPathResult(0,
                                           new XPathResultToken
            {
                NodeType     = XPathNodeType.Element,
                HasChildren  = true,
                LocalName    = "V",
                Name         = "V",
                HasNameTable = true,
                Value        = "\uD55C\uAE00"
            },
                                           new XPathResultToken
            {
                NodeType     = XPathNodeType.Element,
                HasChildren  = true,
                LocalName    = "V",
                Name         = "V",
                HasNameTable = true,
                Value        = "\u306F\uAF9C\u306F\uAF9C\u306F\uAF9C\u306F\uAF9C\u306F\uAF9C"
            },
                                           new XPathResultToken
            {
                NodeType     = XPathNodeType.Element,
                HasChildren  = true,
                LocalName    = "V",
                Name         = "V",
                HasNameTable = true,
                Value        = "\u8A70\u8A70\u8A70\u8A70"
            },
                                           new XPathResultToken
            {
                NodeType     = XPathNodeType.Element,
                HasChildren  = true,
                LocalName    = "V",
                Name         = "V",
                HasNameTable = true,
                Value        = "\u8A00\u6A8D\u4E5F\u8A00\u6A8D\u4E5F\u8A00\u6A8D\u4E5F"
            },
                                           new XPathResultToken
            {
                NodeType     = XPathNodeType.Element,
                HasChildren  = true,
                LocalName    = "V",
                Name         = "V",
                HasNameTable = true,
                Value        = "\uAC00\uB098 \uAC00\uB098 \uAC00\uB098 \uAC00\uB098 \uAC00\uB098 \uAC00\uB098"
            },
                                           new XPathResultToken
            {
                NodeType     = XPathNodeType.Element,
                HasChildren  = true,
                LocalName    = "V",
                Name         = "V",
                HasNameTable = true,
                Value        = "\uFF2A\uFF55\uFF4E\uFF4A\uFF41"
            });

            ;

            Utils.XPathNodesetTest(xml, testExpression, expected);
        }
        public static void UsingPositionFunctionTest620()
        {
            var xml = "books.xml";
            var startingNodePath = "/bookstore";
            var testExpression = @"magazine/attribute::*[position()=1 or position()=2][position()=last()]";
            var expected = new XPathResult(0,
                new XPathResultToken
                {
                    NodeType = XPathNodeType.Attribute,
                    LocalName = "frequency",
                    Name = "frequency",
                    HasNameTable = true,
                    Value = "monthly"
                },
                new XPathResultToken
                {
                    NodeType = XPathNodeType.Attribute,
                    LocalName = "frequency",
                    Name = "frequency",
                    HasNameTable = true,
                    Value = "weekly"
                },
                new XPathResultToken
                {
                    NodeType = XPathNodeType.Attribute,
                    LocalName = "frequency",
                    Name = "frequency",
                    HasNameTable = true,
                    Value = "bi-monthly"
                },
                new XPathResultToken
                {
                    NodeType = XPathNodeType.Attribute,
                    LocalName = "frequency",
                    Name = "frequency",
                    HasNameTable = true,
                    Value = "monthly"
                },
                new XPathResultToken
                {
                    NodeType = XPathNodeType.Attribute,
                    LocalName = "frequency",
                    Name = "frequency",
                    HasNameTable = true,
                    Value = "monthly"
                },
                new XPathResultToken
                {
                    NodeType = XPathNodeType.Attribute,
                    LocalName = "frequency",
                    Name = "frequency",
                    HasNameTable = true,
                    Value = "monthly"
                });
            ;

            Utils.XPathNodesetTest(xml, testExpression, expected, startingNodePath: startingNodePath);
        }
Exemple #46
0
 public static XPathResult Evaluate(string expression, XmlNode contextNode, XPathNSResolver resolver, ushort type, XPathResult result)
 {
     return(default(XPathResult));
 }
        public static void UsingPositionFunctionTest626()
        {
            var xml = "books.xml";
            var startingNodePath = "/bookstore";
            var testExpression = @"(child::*/child::*)[position()=last()]";
            var expected = new XPathResult(0,
                new XPathResultToken
                {
                    NodeType = XPathNodeType.Element,
                    HasChildren = true,
                    LocalName = "title",
                    Name = "my:title",
                    NamespaceURI = "urn:http//www.placeholder-name-here.com/schema/",
                    HasNameTable = true,
                    Prefix = "my",
                    Value = "Where in the world is Trenton?"
                });
            ;

            Utils.XPathNodesetTest(xml, testExpression, expected, startingNodePath: startingNodePath);
        }
Exemple #48
0
        public static void NodeSetsTest511()
        {
            var xml            = "books.xml";
            var testExpression = @"/bookstore/book | /bookstore/magazine";
            var expected       = new XPathResult(0,
                                                 new XPathResultToken
            {
                NodeType      = XPathNodeType.Element,
                HasChildren   = true,
                HasAttributes = true,
                LocalName     = "book",
                Name          = "book",
                HasNameTable  = true,
                Value         =
                    "\n\t\tSeven Years in Trenton\n\t\t\n\t\t\tJoe\n\t\t\tBob\n\t\t\tTrenton Literary Review Honorable Mention\n\t\t\tUSA\n\t\t\n\t\t12\n\t"
            },
                                                 new XPathResultToken
            {
                NodeType      = XPathNodeType.Element,
                HasChildren   = true,
                HasAttributes = true,
                LocalName     = "book",
                Name          = "book",
                HasNameTable  = true,
                Value         =
                    "\n\t\tHistory of Trenton\n\t\t\n\t\t\tMary\n\t\t\tBob\n\t\t\t\n\t\t\t\tSelected Short Stories of\n\t\t\t\tJoeBob\n\t\t\t\tLoser\n\t\t\t\tUS\n\t\t\t\n\t\t\n\t\t55\n\t"
            },
                                                 new XPathResultToken
            {
                NodeType      = XPathNodeType.Element,
                HasChildren   = true,
                HasAttributes = true,
                LocalName     = "book",
                Name          = "book",
                HasNameTable  = true,
                Value         =
                    "\n\t\tXQL The Golden Years\n\t\t\n\t\t\tMike\n\t\t\tHyman\n\t\t\t\n\t\t\t\tXQL For Dummies\n\t\t\t\tJonathan\n\t\t\t\tMarsh\n\t\t\t\n\t\t\n\t\t55.95\n\t"
            },
                                                 new XPathResultToken
            {
                NodeType      = XPathNodeType.Element,
                HasChildren   = true,
                HasAttributes = true,
                LocalName     = "magazine",
                Name          = "magazine",
                HasNameTable  = true,
                Value         = "\n\t\tRoad and Track\n\t\t3.50\n\t\t\n\t\tYes\n\t"
            },
                                                 new XPathResultToken
            {
                NodeType      = XPathNodeType.Element,
                HasChildren   = true,
                HasAttributes = true,
                LocalName     = "magazine",
                Name          = "magazine",
                HasNameTable  = true,
                Value         = "\n\t\tPC Week\n\t\tfree\n\t\tZiff Davis\n\t"
            },
                                                 new XPathResultToken
            {
                NodeType      = XPathNodeType.Element,
                HasChildren   = true,
                HasAttributes = true,
                LocalName     = "magazine",
                Name          = "magazine",
                HasNameTable  = true,
                Value         =
                    "\n\t\tPC Magazine\n\t\t3.95\n\t\tZiff Davis\n\t\t\n\t\t\tCreate a dream PC\n\t\t\t\tCreate a list of needed hardware\n\t\t\t\n\t\t\tThe future of the web\n\t\t\t\tCan Netscape stay alive with Microsoft eating up its browser share?\n\t\t\t\tMSFT 99.30\n\t\t\t\t1998-06-23\n\t\t\t\n\t\t\tVisual Basic 5.0 - Will it stand the test of time?\n\t\t\t\n\t\t\n\t"
            },
                                                 new XPathResultToken
            {
                NodeType      = XPathNodeType.Element,
                HasChildren   = true,
                HasAttributes = true,
                LocalName     = "magazine",
                Name          = "magazine",
                HasNameTable  = true,
                Value         = "\n\t\t\n\t\t\tSport Cars - Can you really dream?\n\t\t\t\n\t\t\n\t"
            },
                                                 new XPathResultToken
            {
                NodeType      = XPathNodeType.Element,
                HasChildren   = true,
                HasAttributes = true,
                LocalName     = "magazine",
                Name          = "magazine",
                HasNameTable  = true,
                Value         = "\n\t\tPC Magazine Best Product of 1997\n\t"
            },
                                                 new XPathResultToken
            {
                NodeType      = XPathNodeType.Element,
                HasChildren   = true,
                HasAttributes = true,
                LocalName     = "book",
                Name          = "book",
                HasNameTable  = true,
                Value         =
                    "\n\t\tHistory of Trenton 2\n\t\t\n\t\t\tMary F\n\t\t\tRobinson\n\t\t\t\n\t\t\t\tSelected Short Stories of\n\t\t\t\tMary F\n\t\t\t\tRobinson\n\t\t\t\n\t\t\n\t\t55\n\t"
            },
                                                 new XPathResultToken
            {
                NodeType      = XPathNodeType.Element,
                HasChildren   = true,
                HasAttributes = true,
                LocalName     = "book",
                Name          = "book",
                HasNameTable  = true,
                Value         =
                    "\n\t\tHistory of Trenton Vol 3\n\t\t\n\t\t\tMary F\n\t\t\tRobinson\n\t\t\tFrank\n\t\t\tAnderson\n\t\t\tPulizer\n\t\t\t\n\t\t\t\tSelected Short Stories of\n\t\t\t\tMary F\n\t\t\t\tRobinson\n\t\t\t\n\t\t\n\t\t10\n\t"
            },
                                                 new XPathResultToken
            {
                NodeType      = XPathNodeType.Element,
                HasChildren   = true,
                HasAttributes = true,
                LocalName     = "book",
                Name          = "book",
                HasNameTable  = true,
                Value         = "\n\t\tHow To Fix Computers\n\t\t\n\t\t\tHack\n\t\t\ter\n\t\t\tPh.D.\n\t\t\n\t\t08\n\t"
            },
                                                 new XPathResultToken
            {
                NodeType      = XPathNodeType.Element,
                HasChildren   = true,
                HasAttributes = true,
                LocalName     = "magazine",
                Name          = "magazine",
                HasNameTable  = true,
                Value         = "\n\t\tTracking Trenton\n\t\t2.50\n\t\t\n\t"
            },
                                                 new XPathResultToken
            {
                NodeType      = XPathNodeType.Element,
                HasChildren   = true,
                HasAttributes = true,
                LocalName     = "book",
                Name          = "book",
                HasNameTable  = true,
                Value         =
                    "\n\t\tTrenton Today, Trenton Tomorrow\n\t\t\n\t\t\tToni\n\t\t\tBob\n\t\t\tB.A.\n\t\t\tPh.D.\n\t\t\tPulizer\n\t\t\tStill in Trenton\n\t\t\tTrenton Forever\n\t\t\n\t\t6.50\n\t\t\n\t\t\tIt was a dark and stormy night.\n\t\t\tBut then all nights in Trenton seem dark and\n\t\t\tstormy to someone who has gone through what\n\t\t\tI have.\n\t\t\t\n\t\t\t\n\t\t\t\tTrenton\n\t\t\t\tmisery\n\t\t\t\n\t\t\n\t"
            });

            ;

            Utils.XPathNodesetTest(xml, testExpression, expected);
        }
        public static void UsingPositionFunctionTest628()
        {
            var xml = "numbers.xml";
            var testExpression = @"//*[position()=//n]";
            var expected = new XPathResult(0,
                new XPathResultToken
                {
                    NodeType = XPathNodeType.Element,
                    HasChildren = true,
                    LocalName = "mydoc",
                    Name = "mydoc",
                    HasNameTable = true,
                    Value = "\n\n\t1\n\t2\n\t3\n\n\n\t1\n\t1\n\t2\n\t2\n\t3\n\t4\n\n\n\t5\n\tNaN\n\t0\n\n\n"
                },
                new XPathResultToken
                {
                    NodeType = XPathNodeType.Element,
                    HasChildren = true,
                    LocalName = "numbers",
                    Name = "numbers",
                    HasNameTable = true,
                    Value = "\n\t1\n\t2\n\t3\n"
                },
                new XPathResultToken
                {
                    NodeType = XPathNodeType.Element,
                    HasChildren = true,
                    LocalName = "n",
                    Name = "n",
                    HasNameTable = true,
                    Value = "1"
                },
                new XPathResultToken
                {
                    NodeType = XPathNodeType.Element,
                    HasChildren = true,
                    LocalName = "n",
                    Name = "n",
                    HasNameTable = true,
                    Value = "2"
                },
                new XPathResultToken
                {
                    NodeType = XPathNodeType.Element,
                    HasChildren = true,
                    LocalName = "n",
                    Name = "n",
                    HasNameTable = true,
                    Value = "3"
                },
                new XPathResultToken
                {
                    NodeType = XPathNodeType.Element,
                    HasChildren = true,
                    LocalName = "numbers",
                    Name = "numbers",
                    HasNameTable = true,
                    Value = "\n\t1\n\t1\n\t2\n\t2\n\t3\n\t4\n"
                },
                new XPathResultToken
                {
                    NodeType = XPathNodeType.Element,
                    HasChildren = true,
                    LocalName = "n",
                    Name = "n",
                    HasNameTable = true,
                    Value = "1"
                },
                new XPathResultToken
                {
                    NodeType = XPathNodeType.Element,
                    HasChildren = true,
                    LocalName = "n",
                    Name = "n",
                    HasNameTable = true,
                    Value = "1"
                },
                new XPathResultToken
                {
                    NodeType = XPathNodeType.Element,
                    HasChildren = true,
                    LocalName = "n",
                    Name = "n",
                    HasNameTable = true,
                    Value = "2"
                },
                new XPathResultToken
                {
                    NodeType = XPathNodeType.Element,
                    HasChildren = true,
                    LocalName = "n",
                    Name = "n",
                    HasNameTable = true,
                    Value = "2"
                },
                new XPathResultToken
                {
                    NodeType = XPathNodeType.Element,
                    HasChildren = true,
                    LocalName = "n",
                    Name = "n",
                    HasNameTable = true,
                    Value = "3"
                },
                new XPathResultToken
                {
                    NodeType = XPathNodeType.Element,
                    HasChildren = true,
                    LocalName = "numbers",
                    Name = "numbers",
                    HasNameTable = true,
                    Value = "\n\t5\n\tNaN\n\t0\n"
                },
                new XPathResultToken
                {
                    NodeType = XPathNodeType.Element,
                    HasChildren = true,
                    LocalName = "n",
                    Name = "n",
                    HasNameTable = true,
                    Value = "5"
                },
                new XPathResultToken
                {
                    NodeType = XPathNodeType.Element,
                    HasChildren = true,
                    LocalName = "n",
                    Name = "n",
                    HasNameTable = true,
                    Value = "NaN"
                },
                new XPathResultToken
                {
                    NodeType = XPathNodeType.Element,
                    HasChildren = true,
                    LocalName = "n",
                    Name = "n",
                    HasNameTable = true,
                    Value = "0"
                });
            ;

            Utils.XPathNodesetTest(xml, testExpression, expected);
        }
Exemple #50
0
        static void Main(string[] args)
        {
            // The XPathMessageQueryCollection inherits from MessageQueryCollection.
            XPathMessageQueryCollection queryCollection = MessageHelper.SetupQueryCollection();


            // Create a message and a copy of the message. You must create a buffered copy to access the message body.
            Message       mess = MessageHelper.CreateMessage();
            MessageBuffer mb   = mess.CreateBufferedCopy(int.MaxValue);


            // Evaluate every query in the collection.
            foreach (XPathMessageQuery q in queryCollection)
            {
                // Evaluate the query. Note the result type is an XPathResult.
                XPathResult qPathResult = q.Evaluate <XPathResult>(mb);

                // Use the XPathResult to determine the result type.
                Console.WriteLine("Result type: {0}", qPathResult.ResultType);

                // The following code prints the result according to the result type.

                if (qPathResult.ResultType == XPathResultType.String)
                {
                    Console.WriteLine("{0} = {1}", q.Expression, qPathResult.GetResultAsString());
                }

                if (qPathResult.ResultType == XPathResultType.NodeSet)
                {
                    // Iterate through the node set.
                    XPathNodeIterator ns = qPathResult.GetResultAsNodeset();
                    foreach (XPathNavigator n in ns)
                    {
                        Console.WriteLine("\t{0} = {1}", q.Expression, n.Value);
                    }
                }
                if (qPathResult.ResultType == XPathResultType.Number)
                {
                    Console.WriteLine("\t{0} = {1}", q.Expression, qPathResult.GetResultAsNumber());
                }

                if (qPathResult.ResultType == XPathResultType.Boolean)
                {
                    Console.WriteLine("\t{0} ={1}", q.Expression, qPathResult.GetResultAsBoolean());
                }

                if (qPathResult.ResultType == XPathResultType.Error)
                {
                    Console.WriteLine("\tError!");
                }
            }

            Console.WriteLine();

            // The alternate code below demonstrates similar funcionality using a MessageQueryTable.
            // The difference is the KeyValuePair that requires a key to index each value.
            // The code uses the expression as the key, and an arbitrary value for the value.

            //MessageQueryTable<string> mq = MessageHelper.SetupTable();
            //foreach (KeyValuePair<MessageQuery, string> kv in mq)
            //{
            //    XPathMessageQuery xp = (XPathMessageQuery)kv.Key;
            //    Console.WriteLine("Value = {0}", kv.Value);
            //    Console.WriteLine("{0} = {1}", xp.Expression, xp.Evaluate<string>(mb));
            //}

            Console.ReadLine();
        }