Finding empty element in XQuery

Hello,

I have an XQuery statment that is trying to find where a certain tag is empty, however I never find any nodes meeting my criteria even though I know there is at least one out there.

My query is:
for $rpt in input()/rptdocument/rptinfo where $rpt/seriescode=‘’ return {$rpt/seriescode}

When I use the _xql sytax in the browser the seriescode = ‘’ does return my node. What is the proper syntax in xquery to find an empty element? Thanks.

Heather

To issue the query you have to use _xquery command not _xql. I’ve tried this and it works. I am using Tamino v4141. What result do you get back?

Stuart Fyffe-Collins
Software AG (UK) Ltd.

Your syntax looks OK, so the problem must be elsewhere. Can you confirm exactly what you mean by an empty element? Presumably there is no whitespace in the element content? It would be useful to see what the source document and result document actually look like.

Michael Kay

A small example of my source is as follows:


false
show
true

false
010742
false
CYC
9700100004
20030312


1
false
S
PR 7686
RPT130
A1
D0001
RQR
20030612


C

. . .


The result I get when I don’t search for a specific seriescode are:

<?xml version="1.0" encoding="ISO-8859-1" ?>
- <ino:response xmlns:ino=“http://namespaces.softwareag.com/tamino/response2” xmlns:xql=“XQL FAQ (XML Query Language - Frequently Asked Questions)”>
- <xq:query xmlns:xq=“http://namespaces.softwareag.com/tamino/XQuery/result”>
- <![CDATA[ for $rpt in input()/rptdocument/rptinfo return {$rpt/seriescode}
]]>
</xq:query>
- <ino:message ino:returnvalue=“0”>
ino:messagelineXQuery Request processing</ino:messageline>
</ino:message>
- <xq:result xmlns:xq=“http://namespaces.softwareag.com/tamino/XQuery/result”>
+
CYC

-
HP

-
PRD

-
QC

-
ADM

-
DIS

-
C22

-
C25

-
C44

-
N30

-
O10

-
O17

-
T88

-
U65

-
AU1

-
AU2

-
ID1

-
PG1

-
SXT

-
EGP

-


</xq:result>
- <ino:message ino:returnvalue=“0”>
ino:messagelineXQuery Request processed</ino:messageline>
</ino:message>
</ino:response>

One of the last items in the list above is the empty element I am referring to “”.

Thanks again for your help.

Heather

Works correctly f/r me, but I am using 4.1.4. (I inserted your s

There

F.Y.I