I must admit, I am rather dissapointed in XQuery implementation in Tamino, as compared to the W3C Xquery, especially since Software AG sits on W3C board!
That having been said, is there any way to check for a node existance or text existance within a node using an if() statement?
Right now I have to do rather clunky For where return…
Also, is there a way to check if a node has any children? And those children being either sub nodes or text… because often I have a field which will contain small portion of html, and I am not usre if my web designer will put in just text or text in several
you can check whether a certain node contains any element children or any text children or any children at all using filters
, [text()], or [node()] respectively, for example input()//description
would select all description nodes that do contain element children and input()//description[not()] those that don’t. text() is slightly complicated since there might be more text node than you think, i.e. those consisting entirely of white space. Of course ‘where’ clauses work too, like for $d in input()//description where $d/ return $d
Concerning your criticism w.r.t. the XQuery subset Tamino currently implements. Of course we in principle intend to support all of XQuery. When deciding about what to implement first we have a higher priority with issues in the database area (index usage in FLWR, performant joins and sorts, etc.) than in a large coverage of the XQuery language. ‘if’ is a problem because lots of people miss it (like you). Since it imposes some extra care on optimization, I am not sure when we’ll have it. There is more to do here than meets the eye.
I just looked at my last post and at least in my browser it is corrupted. Wherever a fat dot occurs in my browser there has previously been an opening square bracket followed by an asterisk followed by a closing square bracket. Looking at the source I saw that this has been replaced by a BR tag and a LI tag. I do not understand this.
I’ve been using XQuery only for a month, and even thought I learned quite a lot, and had to already make 3 pages long queries, some details still elude me. I think I still don’t know the whole subset of Tamino’s XQuery. Your solution seem so obvious, I don’t know how come I didn’t think of it myself!
The not() function is very useful, so is the fact that I can use text() in a where clause (I wasn’t aware of it). Also I didn’t know I could use node() to check for an existence of a node.
What is better to use? a “" or a node()? Or is it that "” will check for existence of both a text and nodes, whereas node() will only check for existence of nodes?
Thank you so much for pointing these out to me. This will greatly improve my XQueries, since they’re getting rather complicated.
Also, on the note of me criticizing the subset of XQuery in Tamino. I am sure there is more then meets the eye. I am a programmer myself and I can appreciate the amount of work that must go into implementing these things. I also realize I am riding on the “bleeding edge” and there’s a price to pay. However, I would have expected just a little better support of XQuery in Tamino. Call me demanding :).
Same goes for namespaces in schemas - support for them is next to nonexistent, despite what the documentation would make you believe! And yes, I know what I am talking about, since I’ve come across some major bugs that were ultimately forwarded to the development team when it comes to using namespaces in schemas.
Anyways, all this to say that Tamino is a terrific product, but it has still a lot of maturing to do. Nice thing is that there is a community here and we can try to find workarounds for this very young and great technology.
You asked: What is better to use? a “" or a node()? Or is it that "” will check for existence of both a text and nodes, whereas node() will only check for existence of nodes?
As in XPath, “*” selects element nodes, while “node()” selects all types of node. So x[ * ] will select an x element with an element child, while x[ node() ] will select an x element with any kind of child - it might be a text node or even a comment node.
(And we don’t mind you being a demanding user! If we didn’t have demanding users, we wouldn’t have such an exciting product. We’re proud of how far we have already got in implementing XQuery in an industrial scale product; we are aware that the implementation is incomplete, and that there is more work to be done; we are also aware that the spec is still changing, so in a sense we would ideally wait a bit longer. We are trying to get the balance right, which isn’t always easy.)
I need these tools (node(), etc) because the XQuery implementation is still not complete, and as I mentioned the XQueries can get very huge. So, I greatly appreciate your, Juliane’s and other people’s help!
And keep up the good job, despite some issues I have with Tamino, it is still an excellent product and I am amazed with xml technology and with XQuery. As a web developer, switching from sql server to xml driven database has made my life so much easier!
I enjoy the puzzled look on people’s faces when I try to explain to them why we ditched sql server and went with Tamino. People are still not getting it! Unfortunately for them they will be forced to get it pretty soon, because the world is embracing xml technology at break neck speed.