Groovy web console

subscribe to the feed Subscribe
to this
site
xmledit (via #groovywebconsole)
tweet this snippet Tweet
this
script

xmledit

Published 1 month ago by nmrao with tags xmledit
Actions  ➤ Edit in console Back to console Show/hide line numbers View recent scripts
import groovy.xml.*
def xmltext = '''<node><name short="yes">tim</name><fun>maybe</fun></node>'''

def builder = new StreamingMarkupBuilder()
builder.encoding = 'UTF-8'
def xml = builder.bind {
    mkp.xmlDeclaration()    
    namespaces << [cre:'http://xmlns.oracle.com/apps/ar/soaprovider/plsql/ar_invoice_api_pub/create_single_invoice/']
    xml.cre.InputParamters{
        xml.cre.P_P_TRX_HEADER_TBL {
            xml.cre.P_TRX_HEADER_TBL_ITEM {
                cre.TRX_HEADER_ID ('')
                cre.TRX_DATE ('2017-02-17')
                cre.TRX_CURRENCY( 'USD')
                cre.TRX_CLASS('INV')
                cre.CUST_TRX_TYPE_ID( '1034')
                cre.BILL_TO_CUSTOMER_ID( '147055')
            }
        }
        mkp.yieldUnescaped xmltext
    }
}

println XmlUtil.serialize(xml)