xquery 학습중(프로젝트에서 사용하려고..) name space 문제로 데이터가 출력되지 않았다.
xquer를 사용할때 xmlns로 name space가 설정되어 있으면, 아래와 같이 default name space를 설정하면 해결 된다.
Xquery사용시 default namespace를 설정한다.
declare default element namespace "http://www.w3.org/2001/XMLSchema-instance"; (: :)
for $x in doc("books.xml")/bookstore/book
where $x/title/@lang="en"
return $x/title
좀 더 자세한 사항은 xquer와 name space 쪽으로 찾아보기 바람
===================================== XML 예제 ============================
<?xml version="1.0" encoding="UTF-8"?>
<!-- Edited by XMLSpy -->
<bookstore xmlns="http://www.w3.org/2001/XMLSchema-instance">
<book category="COOKING">
<title lang="en">Everyday Italian</title>
<author>Giada De Laurentiis</author>
<year>2005</year>
<price>30.00</price>
</book>
<book category="CHILDREN">
<title lang="en">Harry Potter</title>
<author>J K. Rowling</author>
<year>2005</year>
<price>29.99</price>
</book>
<book category="WEB">
<title lang="en">XQuery Kick Start</title>
<author>James McGovern</author>
<author>Per Bothner</author>
<author>Kurt Cagle</author>
<author>James Linn</author>
<author>Vaidyanathan Nagarajan</author>
<year>2003</year>
<price>49.99</price>
</book>
<book category="WEB">
<title lang="en">Learning XML</title>
<author>Erik T. Ray</author>
<year>2003</year>
<price>39.95</price>
</book>
</bookstore>