0

私はこれXQueryを試していBaseXます:

xquery //Bookstore/Book/Title

2:01のチュートリアルでは動作しますが、次のエラーがスローされます。

Error:
Stopped at ., 1/2:
[XPDY0002] No context item defined to evaluate 'root()'.
Compiling:
- simplifying descendant-or-self step(s)
Query:
//Bookstore/Book/Title
Optimized Query:
root()/descendant::Bookstore/Book/Title
Query plan:
<QueryPlan>
  <CachedPath>
    <Root/>
    <IterStep axis="descendant" test="Bookstore"/>
    <IterStep axis="child" test="Book"/>
    <IterStep axis="child" test="Title"/>
  </CachedPath>
</QueryPlan>

Web を検索しましたが、何をすべきか本当にわかりません。root elementコマンドに があるため、なぜこれが起こっているのですかBookstore。私はこれを照会しようとしています:

<Bookstore>
   <Book ISBN="ISBN-0-13-713526-2" Price="85" Edition="3rd">
      <Title>A First Course in Database Systems</Title>
      <Authors>
         <Author>
            <First_Name>Jeffrey</First_Name>
            <Last_Name>Ullman</Last_Name>
         </Author>
         <Author>
            <First_Name>Jennifer</First_Name>
            <Last_Name>Widom</Last_Name>
         </Author>
      </Authors>
   </Book>
   <Book ISBN="ISBN-0-13-815504-6" Price="100">
      <Title>Database Systems: The Complete Book</Title>
      <Authors>
         <Author>
            <First_Name>Hector</First_Name>
            <Last_Name>Garcia-Molina</Last_Name>
         </Author>
         <Author>
            <First_Name>Jeffrey</First_Name>
            <Last_Name>Ullman</Last_Name>
         </Author>
         <Author>
            <First_Name>Jennifer</First_Name>
            <Last_Name>Widom</Last_Name>
         </Author>
      </Authors>
      <Remark>
      Buy this book bundled with "A First Course" - a great deal!</Remark>
   </Book>
   <Book ISBN = "ISBN-0-11-222222-3" Price="50">
      <Title>Jennifer's Economical Database Hints</Title>
      <Authors>
         <Author>
            <First_Name>Jennifer</First_Name>
            <Last_Name>Widom</Last_Name>
         </Author>
      </Authors>
   </Book>
   <Magazine Month="January" Year="2009">
       <Title>National Geographic</Title>
   </Magazine>
   <Magazine Month="February" Year="2009">
       <Title>National Geographic</Title>
   </Magazine>
   <Magazine Month="February" Year="2009">
       <Title>Newsweek</Title>
   </Magazine>
</Bookstore>
4

1 に答える 1