diff options
author | unknown <bar@mysql.com> | 2006-12-27 18:14:28 +0400 |
---|---|---|
committer | unknown <bar@mysql.com> | 2006-12-27 18:14:28 +0400 |
commit | 38fd186721416536b0d61b816920005c8ac5a1f7 (patch) | |
tree | f484b0fb186a6aebe386231631f2225f603d578d /mysql-test/t/xml.test | |
parent | 61c7864ced276d8ac49860d9560cfb4d13120f59 (diff) | |
download | mariadb-git-38fd186721416536b0d61b816920005c8ac5a1f7.tar.gz |
Bug#24747 XPath error with the node name "Text"
mysql-test/r/xml.result:
Adding test case
mysql-test/t/xml.test:
Adding test case
sql/item_xmlfunc.cc:
Bug#24747 XPath error with the node name "Text"
Problem: keywords, nodetype names and axis names
didn't work in node name context.
Fix:
1. Changes in lexem scanner behaviour when an identifier has been read:
- search through axis names and return MY_XPATH_AXIS_xxx only
when identifier is followed by two semicolons. Don't check axis
names and return MY_XPATH_IDENT of not followed by two semicolons.
- search through nodetype names and return MY_XPATH_LEX_NODETYPE
only when identifier is followed by left parenthesis.
Don't check nodetype names and return MY_XPATH_LEX_IDENT when
not followed by parenthesis
2. Change in syntax analizer: QName scanner now accepts keywords
AND, OR, MOD, DIV as valid node names.
Diffstat (limited to 'mysql-test/t/xml.test')
-rw-r--r-- | mysql-test/t/xml.test | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/mysql-test/t/xml.test b/mysql-test/t/xml.test index ef94c7508c4..8517dce111f 100644 --- a/mysql-test/t/xml.test +++ b/mysql-test/t/xml.test @@ -406,3 +406,41 @@ select ExtractValue(@xml, "/entry[(50>pt)]/id"); select ExtractValue(@xml, "/entry[(50>=pt)]/id"); select ExtractValue(@xml, "/entry[(50<pt)]/id"); select ExtractValue(@xml, "/entry[(50<=pt)]/id"); + +# +# Bug#24747 XPath error with the node name "Text" +# +# +# Test nodetypes in node name context +# +select ExtractValue('<a><b><Text>test</Text></b></a>','/a/b/Text'); +select ExtractValue('<a><b><comment>test</comment></b></a>','/a/b/comment'); +select ExtractValue('<a><b><node>test</node></b></a>','/a/b/node'); +select ExtractValue('<a><b><processing-instruction>test</processing-instruction></b></a>','/a/b/processing-instruction'); +# +# Test keywords in node name contexts +# +select ExtractValue('<a><and>test</and></a>', '/a/and'); +select ExtractValue('<a><or>test</or></a>', '/a/or'); +select ExtractValue('<a><mod>test</mod></a>', '/a/mod'); +select ExtractValue('<a><div>test</div></a>', '/a/div'); +select ExtractValue('<a><and:and>test</and:and></a>', '/a/and:and'); +select ExtractValue('<a><or:or>test</or:or></a>', '/a/or:or'); +select ExtractValue('<a><mod:mod>test</mod:mod></a>', '/a/mod:mod'); +select ExtractValue('<a><div:div>test</div:div></a>', '/a/div:div'); +# +# Test axis names in node name context +# +select ExtractValue('<a><ancestor>test</ancestor></a>', '/a/ancestor'); +select ExtractValue('<a><ancestor-or-self>test</ancestor-or-self></a>', '/a/ancestor-or-self'); +select ExtractValue('<a><attribute>test</attribute></a>', '/a/attribute'); +select ExtractValue('<a><child>test</child></a>', '/a/child'); +select ExtractValue('<a><descendant>test</descendant></a>', '/a/descendant'); +select ExtractValue('<a><descendant-or-self>test</descendant-or-self></a>', '/a/descendant-or-self'); +select ExtractValue('<a><following>test</following></a>', '/a/following'); +select ExtractValue('<a><following-sibling>test</following-sibling></a>', '/a/following-sibling'); +select ExtractValue('<a><namespace>test</namespace></a>', '/a/namespace'); +select ExtractValue('<a><parent>test</parent></a>', '/a/parent'); +select ExtractValue('<a><preceding>test</preceding></a>', '/a/preceding'); +select ExtractValue('<a><preceding-sibling>test</preceding-sibling></a>', '/a/preceding-sibling'); +select ExtractValue('<a><self>test</self></a>', '/a/self'); |