Daniel - 2012-07-07

I'm trying to access a book title from a file named books.xml, which is located in the same directory as my HTML+XQIB file.
The content of the books.xml came from the example at the following web page.
http://msdn.microsoft.com/en-us/library/windows/desktop/ms762271%28v=vs.85%29.aspx

Here is the HTML+XQIB code:

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>   
    <title>XQIB: Sample page</title>
    <meta charset="UTF-8"/>
    <script type="text/javascript" src="mxqueryjs/mxqueryjs.nocache.js"></script>
    <script type="application/xquery">
    declare default function namespace "http://www.w3.org/2005/xpath-functions";

    declare function local:getBooks() as node()
    {
     let $x := <p> { fn:doc("books.xml")/catalog/book[@id="bk102"]/title } </p>
     return  $x 
    } ;
      declare updating function local:onclick($loc, $evtObj) {
       let $x := local:getBooks()
        return
         insert node $x 
          as last into b:dom()//body
      } ;     
      b:addEventListener
        (b:dom()//input, "onclick", local:onclick#2)
    </script>
  </head>
  <body>
    <h1>Insert example</h1>
    <input type="button" value="Click to add a line!"/>
  </body>
</html>

I have tried the path-name to the books.xml file several ways: file name as in the example, a Unix style:
"file:///C:/temp/books.xml", a Windows style "C:\temp\books.xml", and a hybrid style: "file:///C:\temp\books.xml".
In FireFox, I get an errFODC002 Getting your resource at file:///C:/temp/books.xml failed. The Windows style of path name does not cause a crash but it does not return data. In Chrome, none of the path-names return an error or data.

The Hello World and Simple Query examples do work in the same directory. If I store the query:     
let $x := <p> { fn:doc("books.xml")/catalog/book/title } </p>
return  $x
in a text file and run Zorba from a command line interface with the file it works fine.
Any assistance would be appreciated.