XML namespaces are a real pain!
Some of the posts you probably found are mine, I have run into these problems before. I recently worked out a new simpler way to "ignore" namespaces on incoming files so that bots never sees them, using a simple preprocessing script. Using this method, your grammars and mapping scripts are simpler and no namespage is used in the output :-))
Of course if your partner requires namespaces in the output you need to deal with them and can't do it this way!
#-------------------------------------------------------------------------------
# preprocess - Replace 'xmlns=' with 'xmlns:NOTUSED=' to simplify grammar and mapping
# Generally Bots does not need to use the xmlns for incoming files
# Also replace named prefix 'ENV:' used in HIWG xml orders
# Import this into routescript like this:
# from routelib import postincommunication_remove_xmlns as postincommunication
def postincommunication_xmlns(routedict):
def _preprocess(ta_from,endstatus,**argv):
# copy ta for preprocessing
ta_to = ta_from.copyta(status=endstatus)
# open the files
infile = botslib.opendata(ta_from.filename,'r')
tofile = botslib.opendata(str(ta_to.idta),'wb')
for line in infile:
tofile.write(line.replace('xmlns=','xmlns:NOTUSED=').replace('<ENV:','<').replace('</ENV:','</'))
# close files and update outmessage transaction
infile.close()
tofile.close()
ta_to.update(statust=OK,filename=str(ta_to.idta))
preprocess.preprocess(routedict,_preprocess)
Kind Regards,
Mike