I\'m reading a book about xQuery and it is full of expression like element constructor... and my question is:
What is the element constructor and is \
An element constructor creates an element. There are several ways that you can do that in XQuery.
The curly braces {}
mark the beginning and end of an enclosed expression in XQuery. Since you can use literal XML and computed expressions, the curly braces denote when you are leaving the static context and entering the dynamic constructs. Similar to how you would use <%@ page ... %>
for JSP directives.
With a direct element constructor, you use XML syntax to create a static XML structure.
For instance:
Harold and the Purple Crayon
With a computed element constructor, an element node and content and can generate dynamic XML structure from expressions for the element name and it's content.
For example:
element book {
attribute { "isbn" } { "isbn-0060229357" },
Harold and the Purple Crayon
}
You can also use an expression to compute the element name:
element { fn:concat("bo", "ok") } {
attribute { "isbn" } { "isbn-0060229357" },
Harold and the Purple Crayon
}