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
  • 1.  Delete XML instance with XQuery

    Posted Thu May 01, 2003 04:24 AM

    Is it possible to delete an entire instance of XML via XQuery.

    My XQuery is as follows:
    declare namespace tf=“http://namespaces.softwareag.com/tamino/TaminoFunction
    update for $i in input()/genericData[name=‘Dummy’]
    where tf:getInoId($i) = 2036
    do delete $i

    ----
    I get the following message:
    <ino:messagetext ino:code=“INOXQE6450”>Update results in non-well-formed document</ino:messagetext>
    ino:messagelineAttempt to delete the root element</ino:messageline>
    </ino:message>



    Any immediate help would be greatly appreciated.

    Thanks,
    Michelle


    #webMethods
    #webMethods-Tamino-XML-Server-APIs
    #API-Management


  • 2.  RE: Delete XML instance with XQuery

    Posted Thu May 01, 2003 11:10 AM

    I believe you have to use the _delete command, i.e.

    _delete=genericData[@ino:id=2036]

    Hope this helps.

    Stuart Fyffe-Collins
    Software AG (UK) Ltd.


    #webMethods
    #API-Management
    #webMethods-Tamino-XML-Server-APIs


  • 3.  RE: Delete XML instance with XQuery

    Posted Fri May 02, 2003 01:37 AM

    Thanks for the reply but I thought the _delete only used in X-Query and not XQuery? Is that not so?

    Also, using the Java API, a colleague informed me that the TXMLObjectAccessor can be used to perform inserts and deletes.

    Thanks again.

    Michelle


    #webMethods-Tamino-XML-Server-APIs
    #webMethods
    #API-Management


  • 4.  RE: Delete XML instance with XQuery

    Posted Fri May 02, 2003 12:36 PM

    The TXMLObjectAccessor has delete() and insert() methods but these take an X-Query(based on Xpath) query and a complete document to insert respectively. Only the xquery() method takes an XQuery or XQuery-Update expression. With XQuery-Update the updates effect the current document (in the same respect as node level update) and so you cannot delete the root element.

    Hope this helps.

    Stuart Fyffe-Collins
    Software AG (UK) Ltd.


    #API-Management
    #webMethods-Tamino-XML-Server-APIs
    #webMethods


  • 5.  RE: Delete XML instance with XQuery

    Posted Fri June 27, 2003 03:08 AM

    Hello Everyone,

    just a few days ago someone told me how to delete an entire document using an XQuery Update statement (thanks Christine!).
    The key thing to know is that you must delete on the document root, not on the root element.

    So this expression will delete the document:

       declare namespace tf="http://namespaces.softwareag.com/tamino/TaminoFunction" 
    update for $i in input()/genericData[name='Dummy']
    where tf:getInoId($i) = 2036
    do delete $i/..


    In this expression $i refers to the root node “genericData” and we need to have the document root - which is the parent node of the root node, so “/…” will get that.

    I hope this tip helps!
    Trevor.


    #API-Management
    #webMethods
    #webMethods-Tamino-XML-Server-APIs