diff options
author | bar@mysql.com <> | 2006-04-17 11:49:20 +0500 |
---|---|---|
committer | bar@mysql.com <> | 2006-04-17 11:49:20 +0500 |
commit | faee72a936226d7ebb2740375418f2966b86e38a (patch) | |
tree | 15ef3a723fc958fb65e19df9d1c279e5b1017f2a /sql/item_xmlfunc.cc | |
parent | 6f5999e9b5ffa775e8d3c0510e8b2c6a6ef2b1e7 (diff) | |
download | mariadb-git-faee72a936226d7ebb2740375418f2966b86e38a.tar.gz |
Bug#18170: XML: ExtractValue(): XPath expression can't use QNames (colon in names)
Problem source:
Qualified names (aka QName) didn't work as tag names and attribute names,
because the parser lacked a real rule to scan QName, so it understood
only non-qualified names without prefixes.
Solution:
New rule was added to check both "ident" and "ident:ident" sequences.
Diffstat (limited to 'sql/item_xmlfunc.cc')
-rw-r--r-- | sql/item_xmlfunc.cc | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/sql/item_xmlfunc.cc b/sql/item_xmlfunc.cc index 71900c26c2d..2e70b896af7 100644 --- a/sql/item_xmlfunc.cc +++ b/sql/item_xmlfunc.cc @@ -2267,6 +2267,30 @@ static int my_xpath_parse_Number(MY_XPATH *xpath) /* + QName grammar can be found in a separate document + http://www.w3.org/TR/REC-xml-names/#NT-QName + + [6] QName ::= (Prefix ':')? LocalPart + [7] Prefix ::= NCName + [8] LocalPart ::= NCName +*/ +static int +my_xpath_parse_QName(MY_XPATH *xpath) +{ + const char *beg; + if (!my_xpath_parse_term(xpath, MY_XPATH_LEX_IDENT)) + return 0; + beg= xpath->prevtok.beg; + if (!my_xpath_parse_term(xpath, MY_XPATH_LEX_COLON)) + return 1; /* Non qualified name */ + if (!my_xpath_parse_term(xpath, MY_XPATH_LEX_IDENT)) + return 0; + xpath->prevtok.beg= beg; + return 1; +} + + +/* Scan Variable reference SYNOPSYS @@ -2299,7 +2323,7 @@ my_xpath_parse_VariableReference(MY_XPATH *xpath) static int my_xpath_parse_NodeTest_QName(MY_XPATH *xpath) { - if (!my_xpath_parse_term(xpath, MY_XPATH_LEX_IDENT)) + if (!my_xpath_parse_QName(xpath)) return 0; DBUG_ASSERT(xpath->context); uint len= xpath->prevtok.end - xpath->prevtok.beg; |