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.  Remove Empty attributes and elements

    Posted Thu May 04, 2006 12:49 AM

    I have an xml document with null attributes and elements… how do i remove these from the document in webMethods

    Document example

    [COLOR=#008080]<?xml version="1.0"?>
    <LOAN_PRODUCT_DATA>
    <LOAN_FEATURES NameDocumentsDrawnInType=“” AssumabilityIndicator=“” BalloonIndicator=“1” />
    <Loan_data/>
    </LOAN_PRODUCT_DATA>

    I want the above xml to be converted to

    <?xml version="1.0"?>
    <LOAN_PRODUCT_DATA>
    <LOAN_FEATURES BalloonIndicator=“1” />
    </LOAN_PRODUCT_DATA>
    [/COLOR]


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


  • 2.  RE: Remove Empty attributes and elements

    Posted Thu May 04, 2006 01:31 AM

    I believe we cant remove the attributes as long as they exist in your document structure (DTD or Schema).But if you are creating xml string then try not to map the attributes when attribute value is null.If the xml is passed to you by other source then as a crude solution you can using with replace service?? map xmldata to replace string and specify search criteria and replace with nothing.

    HTH,
    RMG


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


  • 3.  RE: Remove Empty attributes and elements

    Posted Thu May 04, 2006 05:29 AM

    If you are producing the first document in webMethods, just add logic to not map any values to the attributes if the source is null.

    You can also try converting the xml string to a document built from a document reference and then back to a string.

    Mark


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