Re: [basex-talk] Creating db in restxq interface

2016-05-21 Thread Bram Vanroy | KU Leuven
Just some general comments on the HTML that you are trying to generate: 

-  You are using XHTML. XHTML as quite strict. 

-  You forgot a head element;

-  The time element is HTML5, and won't "work" as such under any
other (X)HTML declaration. Additionally, it is forbidden to have such
content outside the body tag;

-  You also have a list item (li) outside a ul. This is not valid
either.

-  Note that you wrote factbook instead of facebook, if that was
what you were trying to do

 

Edited code below. Hope it helps!

 

declare 

  %rest:path("/start")

  %updating

  %output:method("xhtml")

  %output:omit-xml-declaration("no")

  %output:doctype-public("-//W3C//DTD XHTML 1.0 Transitional//EN")

 
%output:doctype-system("http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.
dtd")

  function page:hello()

as element(Q{http://www.w3.org/1999/xhtml}html)

{

http://www.w3.org/1999/xhtml";>

  

Good day Sir!



  

  

The current time is: { current-time() }



  Home

  Link 1

  Link 2

  Link 3

  

  {

  for $result in db:open('factbook')//continent/@name

  return { data($result) }

  }

 

  

  { db:create("test") }

  

  



 

 

Van: basex-talk-boun...@mailman.uni-konstanz.de
[mailto:basex-talk-boun...@mailman.uni-konstanz.de] Namens Henning Phan
Verzonden: zaterdag 21 mei 2016 19:03
Aan: basex-talk@mailman.uni-konstanz.de
Onderwerp: [basex-talk] Creating db in restxq interface

 

Hi,

 

My question is how do you create a new database in restxq?

When trying to create a db I get the error msg:

HTTP Error 400
[XUST0001] element constructor: no updating expression allowed.

Some digging around and I learned that I might need the "updating"
annotation though even after the change it gives the same error.

My file looks like this now:

=== File start 

 

declare 
  %rest:path("/start")
  %updating
  %output:method("xhtml")
  %output:omit-xml-declaration("no")
  %output:doctype-public("-//W3C//DTD XHTML 1.0 Transitional//EN")
  %output:doctype-system("

http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";)
  function page:hello()
as element(Q{http://www.w3.org/1999/xhtml}html)
{
  http://www.w3.org/1999/xhtml>
http://www.w3.org/1999/xhtml";>
Good day Sir!

The current time is: { current-time() }


  Home
  Link 1
  Link 2
  Link 3

  {
for $result in db:open('factbook')//continent/@name
return { data($result) }
  }

{
db:create("test")
}


  
 
=== File End  


[basex-talk] Creating db in restxq interface

2016-05-21 Thread Henning Phan
Hi,
My question is how do you create a new database in restxq?When trying to create 
a db I get the error msg:HTTP Error 400[XUST0001] element constructor: no 
updating expression allowed.Some digging around and I learned that I might need 
the "updating" annotation though even after the change it gives the same 
error.My file looks like this now:=== File start 
declare 
  %rest:path("/start")
  %updating
  %output:method("xhtml")
  %output:omit-xml-declaration("no")
  %output:doctype-public("-//W3C//DTD XHTML 1.0 Transitional//EN")
  
%output:doctype-system("http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";)
  function page:hello()
as element(Q{http://www.w3.org/1999/xhtml}html)
{
  http://www.w3.org/1999/xhtml";>
Good day Sir!

The current time is: { current-time() }


  Home
  Link 1
  Link 2
  Link 3

  {
for $result in db:open('factbook')//continent/@name
return { data($result) }
  }

{
db:create("test")
}


  
=== File End