Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
9bf1fb4c
Commit
9bf1fb4c
authored
Apr 07, 2006
by
bar@mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug#18285: ExtractValue not returning character data within <![CDATA[]]> as expected
parent
3c2e84f7
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
0 deletions
+31
-0
mysql-test/r/xml.result
mysql-test/r/xml.result
+3
-0
mysql-test/t/xml.test
mysql-test/t/xml.test
+6
-0
strings/xml.c
strings/xml.c
+22
-0
No files found.
mysql-test/r/xml.result
View file @
9bf1fb4c
...
...
@@ -609,6 +609,9 @@ extractvalue('<a>Jack</a>','/a[contains(../a,"j")]' collate latin1_bin)
select extractvalue('<a>Jack</a>' collate latin1_bin,'/a[contains(../a,"j")]');
extractvalue('<a>Jack</a>' collate latin1_bin,'/a[contains(../a,"j")]')
select ExtractValue('<tag1><![CDATA[test]]></tag1>','/tag1');
ExtractValue('<tag1><![CDATA[test]]></tag1>','/tag1')
test
select extractValue('<e>1</e>','position()');
ERROR HY000: XPATH syntax error: ''
select extractValue('<e>1</e>','last()');
...
...
mysql-test/t/xml.test
View file @
9bf1fb4c
...
...
@@ -278,6 +278,12 @@ select extractvalue('<a>Jack</a>','/a[contains(../a,"j")]');
select
extractvalue
(
'<a>Jack</a>'
,
'/a[contains(../a,"j")]'
collate
latin1_bin
);
select
extractvalue
(
'<a>Jack</a>'
collate
latin1_bin
,
'/a[contains(../a,"j")]'
);
#
# Bug#18285: ExtractValue not returning character
# data within <![CDATA[]]> as expected
#
select
ExtractValue
(
'<tag1><![CDATA[test]]></tag1>'
,
'/tag1'
);
#
# Bug #18171 XML: ExtractValue: the XPath position()
# function crashes the server!
...
...
strings/xml.c
View file @
9bf1fb4c
...
...
@@ -30,6 +30,7 @@
#define MY_XML_TEXT 'T'
#define MY_XML_QUESTION '?'
#define MY_XML_EXCLAM '!'
#define MY_XML_CDATA 'D'
typedef
struct
xml_attr_st
{
...
...
@@ -45,6 +46,7 @@ static const char *lex2str(int lex)
case
MY_XML_EOF
:
return
"EOF"
;
case
MY_XML_STRING
:
return
"STRING"
;
case
MY_XML_IDENT
:
return
"IDENT"
;
case
MY_XML_CDATA
:
return
"CDATA"
;
case
MY_XML_EQ
:
return
"'='"
;
case
MY_XML_LT
:
return
"'<'"
;
case
MY_XML_GT
:
return
"'>'"
;
...
...
@@ -90,6 +92,20 @@ static int my_xml_scan(MY_XML_PARSER *p,MY_XML_ATTR *a)
a
->
end
=
p
->
cur
;
lex
=
MY_XML_COMMENT
;
}
else
if
(
!
bcmp
(
p
->
cur
,
"<![CDATA["
,
9
))
{
p
->
cur
+=
9
;
for
(;
p
->
cur
<
p
->
end
-
2
;
p
->
cur
++
)
{
if
(
p
->
cur
[
0
]
==
']'
&&
p
->
cur
[
1
]
==
']'
&&
p
->
cur
[
2
]
==
'>'
)
{
p
->
cur
+=
3
;
a
->
end
=
p
->
cur
;
break
;
}
}
lex
=
MY_XML_CDATA
;
}
else
if
(
strchr
(
"?=/<>!"
,
p
->
cur
[
0
]))
{
p
->
cur
++
;
...
...
@@ -215,7 +231,13 @@ int my_xml_parse(MY_XML_PARSER *p,const char *str, uint len)
lex
=
my_xml_scan
(
p
,
&
a
);
if
(
MY_XML_COMMENT
==
lex
)
continue
;
if
(
lex
==
MY_XML_CDATA
)
{
a
.
beg
+=
9
;
a
.
end
-=
3
;
my_xml_value
(
p
,
a
.
beg
,
(
uint
)
(
a
.
end
-
a
.
beg
));
continue
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment