tags:

views:

53

answers:

1

How can we load an xml document with xquery to be parsed by the XQIB processor integrated in IE browser. Notice that the doc("doc.xml") is not supported to use with XQIB Processor.

A: 

I have no experience with XQIB, but I did find this:

http://www.systems.ethz.ch/education/courses/hs09/xml-and-databases/project/xqib-doc.pdf

Navigating other Web sources 
The doc function is not supported by XQIB. Instead, to query other sources from the 
Web, you should use the Zorba REST library (Zorba is the XQuery engine used by the 
plugin). This API is documented at 

http://www.zorba-xquery.com/doc/zorba-latest/zorba/html/rest.html 

For example: 

<html> 
  <head>    
    <script type="text/xquery"> 
      declare namespace zorba-rest 
        = "http://www.zorba-xquery.com/zorba/rest-functions"; 
      declare sequential function local:main() { 
        browser:alert( 
          (zorba-rest:get( 
              "http://www.inf.ethz.ch/rss/events.xml" 
             )//*:item/*:title/data(.) 
          )[1] 
        ) 
      }; 
    </script> 
  </head> 
  <body> 
    <h1>Hello world page.</h1> 
  </body> 
</html> 

Note that since XHTML is the default namespace, you need to use the joker (*) symbol 
to access elements which are in no namespace (it actually selects all possible 
namespaces). Unfortunately, there is no other known workaround about this in XQuery. 
philcolbourn
Thank you! My first accepted answer!
philcolbourn