<!DOCTYPE html><htmlxmlns="http://www.w3.org/1999/xhtml"><head><title>XQIB: Sample page</title><metacharset="UTF-8"/><scripttype="text/javascript"src="mxqueryjs/mxqueryjs.nocache.js"></script><scripttype="application/xquery">declaredefaultfunctionnamespace"http://www.w3.org/2005/xpath-functions";declarefunctionlocal:getBooks()asnode(){let$x:=<p>{fn:doc("books.xml")/catalog/book[@id="bk102"]/title}</p>return$x};declareupdatingfunctionlocal:onclick($loc,$evtObj){let$x:=local:getBooks()returninsertnode$xaslastintob:dom()//body};b:addEventListener(b:dom()//input, "onclick", local:onclick#2)</script></head><body><h1>Insert example</h1><inputtype="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.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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:
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.