IBM webMethods Hybrid Integration

IBM webMethods Hybrid Integration

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.

 View Only
Expand all | Collapse all

Finding empty element in XQuery

  • 1.  Finding empty element in XQuery

    Posted Wed June 11, 2003 07:31 PM

    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


    #webMethods
    #Tamino
    #API-Management


  • 2.  RE: Finding empty element in XQuery

    Posted Thu June 12, 2003 12:03 PM

    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.


    #API-Management
    #Tamino
    #webMethods


  • 3.  RE: Finding empty element in XQuery

    Posted Thu June 12, 2003 07:23 PM

    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


    #Tamino
    #webMethods
    #API-Management


  • 4.  RE: Finding empty element in XQuery

    Posted Fri June 13, 2003 12:38 AM

    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


    #API-Management
    #webMethods
    #Tamino


  • 5.  RE: Finding empty element in XQuery

    Posted Mon June 16, 2003 07:17 AM

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


    #API-Management
    #webMethods
    #Tamino


  • 6.  RE: Finding empty element in XQuery

    Posted Mon June 16, 2003 07:16 PM


  • 7.  RE: Finding empty element in XQuery

    Posted Tue June 24, 2003 09:31 PM