2
* Phoebe DOM Implementation.
4
* This is a C++ approximation of the W3C DOM model, which follows
5
* fairly closely the specifications in the various .idl files, copies of
6
* which are provided for reference. Most important is this one:
8
* http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/idl-definitions.html
13
* Copyright (C) 2005 Bob Jamison
15
* This library is free software; you can redistribute it and/or
16
* modify it under the terms of the GNU Lesser General Public
17
* License as published by the Free Software Foundation; either
18
* version 2.1 of the License, or (at your option) any later version.
20
* This library is distributed in the hope that it will be useful,
21
* but WITHOUT ANY WARRANTY; without even the implied warranty of
22
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
23
* Lesser General Public License for more details.
25
* You should have received a copy of the GNU Lesser General Public
26
* License along with this library; if not, write to the Free Software
27
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
39
XpathTest xpathTests[] =
44
"Select the root element AAA",
59
"Select all elements CCC which are children of the root element AAA",
74
"Select all elements BBB which are children of DDD which are children of the root element AAA",
89
"Select all elements BBB",
108
"Select all elements BBB which are children of DDD",
127
"Select all elements enclosed by elements /AAA/CCC/DDD",
157
"Select all elements BBB which have 3 ancestors",
187
"Select all elements",
217
"Select the first BBB child of element AAA",
228
"Select the last BBB child of element AAA",
239
"Select all attributes @id",
243
" <BBB name = 'bbb'/>"
250
"Select BBB elements which have attribute id",
254
" <BBB name = 'bbb'/>"
261
"Select BBB elements which have attribute name",
265
" <BBB name = 'bbb'/>"
272
"Select BBB elements which have any attribute",
276
" <BBB name = 'bbb'/>"
283
"Select BBB elements without an attribute",
287
" <BBB name = 'bbb'/>"
294
"Select BBB elements which have attribute id with value b1",
297
" <BBB name = ' bbb '/>"
298
" <BBB name = 'bbb'/>"
303
"//BBB[@name='bbb']",
304
"Select BBB elements which have attribute name with value 'bbb'",
307
" <BBB name = ' bbb '/>"
308
" <BBB name = 'bbb'/>"
313
"//BBB[normalize-space(@name)='bbb']",
314
"Select BBB elements which have attribute name with value bbb, leading and trailing spaces are removed before comparison",
317
" <BBB name = ' bbb '/>"
318
" <BBB name = 'bbb'/>"
324
"Select elements which have two children BBB",
344
"Select elements which have 2 children",
364
"Select elements which have 3 children",
384
"Select all elements with name BBB, equivalent with //BBB",
403
"//*[starts-with(name(),'B')]",
404
"Select all elements name of which starts with letter B",
423
"//*[contains(name(),'C')]",
424
"Select all elements name of which contain letter C",
443
"//*[string-length(name()) = 3]",
444
"Select elements with three-letter name",
456
"//*[string-length(name()) < 3]",
457
"Select elements name of which has one or two characters",
469
"//*[string-length(name()) > 3]",
470
"Select elements with name longer than three characters",
483
"Select all elements CCC and BBB",
496
"Select all elements BBB and elements EEE which are children of root element AAA",
508
"/AAA/EEE | //DDD/CCC | /AAA | //BBB",
509
"Number of combinations is not restricted",
522
"Equivalent of /child::AAA",
531
"Equivalent of /AAA",
540
"Equivalent of /child::AAA/child::BBB",
548
"/child::AAA/child::BBB",
549
"Equivalent of /AAA/BBB",
558
"Both possibilities can be combined",
567
"Select all descendants of document root and therefore all elements",
590
"/AAA/BBB/descendant::*",
591
"Select all descendants of /AAA/BBB",
614
"//CCC/descendant::*",
615
"Select all elements which have CCC among its ancestors",
638
"//CCC/descendant::DDD",
639
"Select elements DDD which have CCC among its ancestors",
663
"Select all parents of DDD element",
686
"/AAA/BBB/DDD/CCC/EEE/ancestor::*",
687
"Select all elements given in this absolute path",
711
"Select ancestors of FFF element",
734
"/AAA/BBB/following-sibling::*",
735
"The following-sibling axis contains all the following siblings of the context node.",
759
"//CCC/following-sibling::*",
760
"The following-sibling axis contains all the following siblings of the context node.",
784
"/AAA/XXX/preceding-sibling::*",
785
"The preceding-sibling axis contains all the preceding siblings of the context node.",
809
"//CCC/preceding-sibling::*",
833
"/AAA/XXX/following::*",
866
"//ZZZ/following::*",
899
"/AAA/XXX/preceding::*",
926
"//GGG/preceding::*",
953
"/AAA/XXX/descendant-or-self::*",
980
"//CCC/descendant-or-self::*",
1007
"/AAA/XXX/DDD/EEE/ancestor-or-self::*",
1034
"//GGG/ancestor-or-self::*",
1061
"//GGG/ancestor::*",
1090
"//GGG/descendant::*",
1119
"//GGG/following::*",
1148
"//GGG/preceding::*",
1206
"//GGG/ancestor::* | //GGG/descendant::* | //GGG/following::* | //GGG/preceding::* | //GGG/self::*",
1235
"//BBB[position() mod 2 = 0 ]",
1236
"Select even BBB elements",
1253
"//BBB[ position() = floor(last() div 2 + 0.5) or position() = ceiling(last() div 2 + 0.5) ]",
1254
"Select middle BBB element(s)",
1271
"//CCC[ position() = floor(last() div 2 + 0.5) or position() = ceiling(last() div 2 + 0.5) ]",
1272
"Select middle CCC element(s)",