Example XML element called book:
<book> <Title> Mocking Bird </Title> <Year> 1960 </Year> <Genres> <Genre> Novel </Genre> </Genres> </book> I am trying to show all the books and the year they were published where the genre is 'novel'. Here is my code:
result = stmt.executeQuery(" SELECT a.book.extract('/Book/Title | /Book/Year').getStringval() FROM BooksDB a WHERE a.book.extract('Book/Genres/Genre').getStringVal() = ' Novel '"); Then I display the results to the console:
while(result.next()) System.out.println(result.getString(1)); The program runs successfully and the XPath expression is "valid" but not logically correct as it does not return any values. Any advice is appreciated!
No comments:
Post a Comment