Posted: Thu Jul 10, 2003 1:21 am Post subject: Control Charachters in XML
Apprentice
Joined: 04 Jun 2003 Posts: 45
Hi,
I have a java client that receives XML from a a 3rd party which contains control characters ie (<LF> <CR>) this doesn't map properly to the message set i have constructed and causes the filter in the flow not to read the root node in the right place. I.e. if the root tag is suppose to be x and the message comes in <CR> <LF> <x> then the filter assumes <CR> is the root tag.
is there any way in which I can remove the control characters from the XML message before sending it through the rest of my flow?
Joined: 13 Jun 2002 Posts: 2607 Location: The Netherlands (Amsterdam)
is this on all messages coming into that flow? you could decide to get the data of the queue as a BLOB, check for the <CR> <LF> in the first positions, if present, remove them and do an RCD node to XML...
The ideal thing is for instead of checking every message for control characters, catch the parser exception, and have a sub flow to take care of this scenario. The ideal steps be
Catch the exception
Use a Reset content descriptor to convert the message to Blob
In a compute node parse the messages for Control characters and remove/replace them
Use again a Reset content descriptor to convert this message back to XML.
Pass the message back to the message flow.
There are two things to consider in this process.
Do you need a hard loop in your flow to handle this. I would suggest an altenate way of doing this is put the message back in the input queue of message flow with greater priority so that the message flow reads that message next thus maintaining the message order.
Secondly there can be other errors like incomplete XML which you can not fix. So make sure you have a check for the priority of the message so that if a message arrives to the subflow with priority set high instead of looping it through put it to a error queue or so....
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum