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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
9ed8dc7b
Commit
9ed8dc7b
authored
Dec 10, 2008
by
Mattias Jonsson
Browse files
Options
Browse Files
Download
Plain Diff
merge
parents
9ac7571e
1a8a7854
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
60 additions
and
2 deletions
+60
-2
mysql-test/r/xml.result
mysql-test/r/xml.result
+24
-0
mysql-test/t/xml.test
mysql-test/t/xml.test
+25
-0
strings/xml.c
strings/xml.c
+11
-2
No files found.
mysql-test/r/xml.result
View file @
9ed8dc7b
...
...
@@ -1029,4 +1029,28 @@ SELECT 1 FROM t1 ORDER BY(UPDATEXML(a, '1', '1'));
1
1
DROP TABLE t1;
SET @xml=
'
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>
Title - document with document declaration
</title>
</head>
<body>
Hi, Im a webpage with document a declaration
</body>
</html>
';
SELECT ExtractValue(@xml, 'html/head/title');
ExtractValue(@xml, 'html/head/title')
Title - document with document declaration
SELECT ExtractValue(@xml, 'html/body');
ExtractValue(@xml, 'html/body')
Hi, Im a webpage with document a declaration
SELECT ExtractValue('
<xml
"
xxx
"
"
yyy
"
>
CharData
</xml>
', '/xml');
ExtractValue('
<xml
"
xxx
"
"
yyy
"
>
CharData
</xml>
', '/xml')
NULL
Warnings:
Warning 1525 Incorrect XML value: 'parse error at line 1 pos 11: STRING unexpected ('>' wanted)'
SELECT ExtractValue('
<xml
xxx
"
yyy
"
>
CharData
</xml>
', '/xml');
ExtractValue('
<xml
xxx
"
yyy
"
>
CharData
</xml>
', '/xml')
NULL
Warnings:
Warning 1525 Incorrect XML value: 'parse error at line 1 pos 17: STRING unexpected ('>' wanted)'
End of 5.1 tests
mysql-test/t/xml.test
View file @
9ed8dc7b
...
...
@@ -551,4 +551,29 @@ INSERT INTO t1 VALUES (0), (0);
SELECT
1
FROM
t1
ORDER
BY
(
UPDATEXML
(
a
,
'1'
,
'1'
));
DROP
TABLE
t1
;
#
# BUG#38227 EXTRACTVALUE doesn't work with DTD declarations
#
# Check that quoted strings work fine in DOCTYPE declaration.
#
SET
@
xml
=
'<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title> Title - document with document declaration</title>
</head>
<body> Hi, Im a webpage with document a declaration </body>
</html>'
;
SELECT
ExtractValue
(
@
xml
,
'html/head/title'
);
SELECT
ExtractValue
(
@
xml
,
'html/body'
);
# These two documents will fail.
# Quoted strings are not allowed in regular tags
#
SELECT
ExtractValue
(
'<xml "xxx" "yyy">CharData</xml>'
,
'/xml'
);
SELECT
ExtractValue
(
'<xml xxx "yyy">CharData</xml>'
,
'/xml'
);
--
echo
End
of
5.1
tests
strings/xml.c
View file @
9ed8dc7b
...
...
@@ -328,7 +328,7 @@ int my_xml_parse(MY_XML_PARSER *p,const char *str, size_t len)
}
while
((
MY_XML_IDENT
==
(
lex
=
my_xml_scan
(
p
,
&
a
)))
||
(
MY_XML_STRING
==
lex
))
(
(
MY_XML_STRING
==
lex
&&
exclam
)
))
{
MY_XML_ATTR
b
;
if
(
MY_XML_EQ
==
(
lex
=
my_xml_scan
(
p
,
&
b
)))
...
...
@@ -349,13 +349,22 @@ int my_xml_parse(MY_XML_PARSER *p,const char *str, size_t len)
return
MY_XML_ERROR
;
}
}
else
if
(
(
MY_XML_STRING
==
lex
)
||
(
MY_XML_IDENT
==
lex
)
)
else
if
(
MY_XML_IDENT
==
lex
)
{
p
->
current_node_type
=
MY_XML_NODE_ATTR
;
if
((
MY_XML_OK
!=
my_xml_enter
(
p
,
a
.
beg
,(
size_t
)
(
a
.
end
-
a
.
beg
)))
||
(
MY_XML_OK
!=
my_xml_leave
(
p
,
a
.
beg
,(
size_t
)
(
a
.
end
-
a
.
beg
))))
return
MY_XML_ERROR
;
}
else
if
((
MY_XML_STRING
==
lex
)
&&
exclam
)
{
/*
We are in <!DOCTYPE>, e.g.
<!DOCTYPE name SYSTEM "SystemLiteral">
<!DOCTYPE name PUBLIC "PublidLiteral" "SystemLiteral">
Just skip "SystemLiteral" and "PublicidLiteral"
*/
}
else
break
;
}
...
...
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