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

queryXmlNode attribute matching in WQL

  • 1.  queryXmlNode attribute matching in WQL

    Posted Thu March 11, 2010 11:52 PM

    Let’s say I have the following XML (a very simplified example):

    <packages>
    
    <package type="letter" processed="false">Some package info</package>
    <package type="box" processed="true">Other package info</package>
    
    </packages>

    and that I want to use a queryXMLNode (WQL) to filter out any package elements that have the type attribute set to “letter” and the processed attribute set to “false”. What’s the proper way of doing this multiple-attribute-matching? A simple AND doesn’t seem to cut it.

    doc.packages[0].package(type='letter' AND processed='true')

    yields the same result as

    doc.packages[0].package(type='letter' I CAN WRITE ANYTHING AT ALL HERE)

    which is null, or no match, regardless of what I enter after the first attribute condition.

    If I just match on a single attribute however, as

    doc.packages[0].package(type='letter')

    it works fine.

    Thanks in advance for any enlightenment in this matter.


    #Flow-and-Java-services
    #Integration-Server-and-ESB
    #webMethods


  • 2.  RE: queryXmlNode attribute matching in WQL

    Posted Tue March 16, 2010 01:37 AM

    I had some issues like this one in the past, but can’t really remember correct syntax.

    I believe it was related to primitive types, such Strings should be placed between quotes while booleans, integers without them.

    It should be such: doc.packages[0].package(type=‘letter’ AND processed=true)

    Use XQL is much powerfull

    package[@type = ‘letter’ and @processed = ‘true’]

    Cheers


    #Integration-Server-and-ESB
    #webMethods
    #Flow-and-Java-services


  • 3.  RE: queryXmlNode attribute matching in WQL

    Posted Tue March 16, 2010 02:19 AM

    Yeah, i know about the quotes-non-quotes stuff. The thing is that the following “queries” yield the same results (ie nothing at all), although imho the last two should result in errors with blinking warning lights and sirens:

    doc.packages[0].package(type='letter' AND  processed=true)
    doc.packages[0].package(type='letter' KAJDKASDJDFLQKWFNKLNADF)
    doc.packages[0].package(type='letter' HERE IS SOME CRAP TEXT THAT IS IGNORED BY WM)

    I know XQL is more powerful, but I’ve had some issues getting that to work on more complex XML (got the multiple attribute matching thing working with XQL but some other things don’t work instead). Because of this I would like to get the WQL thing working instead but I haven’t got a clue how. Frankly I’m quite surprised that the WQL parsing/processing can’t handle these basal things in a satisfying way.


    #Flow-and-Java-services
    #Integration-Server-and-ESB
    #webMethods