I am attempting to use the ExtractValue MYSQL function to return a segment from the xml stored in one column of my datbase. Here is how I have everything set up.
Table:
create table documents
(
id int NOT NULL AUTO_INCREMENT PRIMARY KEY,
application_id int NOT NULL,
content MEDIUMTEXT NOT NULL
);
Insert:
insert into documents values (null, 1,
'<?xml version="1.0" encoding="ISO-8859-1"?>
<bookstore>
<book>
<title lang="eng">Harry Potter</title>
<price>29.99</price>
</book>
<book>
<title lang="eng">Learning XML</title>
<price>39.95</price>
</book>
</bookstore>');
Query:
SELECT content from documents into @xml;
SELECT ExtractValue(@xml, '/bookstore');
The second query returns a really large empty text space. It almost seems like the empty space is equal to what should be returned and interestingly when I use an xpath that should return a smaller result, the blank field shrinks.
I would greatly appreciate some help with this issue and would be happy to supply more info or try anything out.