@@ -31,21 +31,13 @@ private function convert2XPath($query){
3131
3232 $ xpath = preg_replace (
3333 [
34- "/::/ " ,
35- "/([^,])\s/ " ,
34+ "/([^,])\s/ " ,
3635 "/\/>\// " ,
3736
3837 "/\[([^\.\s\/\#\[\,]+)='(([^\s\.]+)\.([^\s\.]+))+'\]/ " ,
3938
4039 "/:first-child/ " ,
4140 "/:last-child/ " ,
42-
43- "/([^\.\s\/\#\[,]+),\s([^\.\s\/\#\[,]+)/ " ,
44- "/,\s([^\.\s\/\#\[,]+)/ " ,
45- "/((self::[^\.\s\/\#\[,]+ or\s)+(self::[^\.\s\/\#\[,]+)+)/ " ,
46- "/self::self::/ " ,
47- "/\/{1,2}\[/ " ,
48- "/^\[/ " ,
4941
5042 "/\.([^\.\s\/\#\[,]+)/ " ,
5143 "/\/{1,2}\[/ " ,
@@ -62,10 +54,16 @@ private function convert2XPath($query){
6254 "/{dot}/ " ,
6355 "/::text/ " ,
6456 "/::comment/ " ,
65- "/::attributes/ "
57+ "/::attributes/ " ,
58+
59+ "/([^\.\s\/\#\[,]+),\s([^\.\s\/\#\[,]+)/ " ,
60+ "/,\s([^\.\s\/\#\[,]+)/ " ,
61+ "/((self::[^\.\s\/\#\[,]+ or\s)+(self::[^\.\s\/\#\[,]+)+)/ " ,
62+ "/self::self::/ " ,
63+ "/\/{1,2}\[/ " ,
64+ "/^\[/ " ,
6665 ],
6766 [
68- " :: " ,
6967 "$1/ " ,
7068 "/ " ,
7169
@@ -74,13 +72,6 @@ private function convert2XPath($query){
7472 "[1] " ,
7573 "[last()] " ,
7674
77- "self::$1 or self::$2 " ,
78- " or self::$1 " ,
79- "[$1] " ,
80- "self:: " ,
81- "/*[ " ,
82- "*[ " ,
83-
8475 "[contains(@class, '$1')] " ,
8576 "/*[ " ,
8677 "*[ " ,
@@ -96,7 +87,14 @@ private function convert2XPath($query){
9687 ". " ,
9788 "text() " ,
9889 "comment() " ,
99- "@* "
90+ "@* " ,
91+
92+ "self::$1 or self::$2 " ,
93+ " or self::$1 " ,
94+ "[$1] " ,
95+ "self:: " ,
96+ "/*[ " ,
97+ "*[ " ,
10098 ],
10199 $ xpath
102100 );
0 commit comments