Author |
Message
|
pcelari |
Posted: Wed Dec 16, 2009 12:25 pm Post subject: binary text in xml cause parser failure, how to cope? |
|
|
Chevalier
Joined: 31 Mar 2006 Posts: 411 Location: New York
|
I have a set of aggregated flows. each flow get result from a stored procedure in different database. when all are done, the fan-in flow combines them all to create a aggregated result tree.
Recently I noticed failure in the fan-in flow upon retrieving a message from one of the sub result tree. A closer look shows the failure is due to the resultset text containing one binary character 'Â', probably accidentally typed in by a user.
When I assign the resultset to a XML tree, I got no complain in the flow putting the msg to the output queue.
How should I cope with such situation?
Is there anything I can do in my upstream processing flow to prevent binary characters from being included in the xml output content? Is this the right thing to do?
Or how can I make the fan-in flow to tolerate binary content in the XML tree during parsing?
 _________________ pcelari
-----------------------------------------
- a master of always being a newbie |
|
Back to top |
|
 |
smdavies99 |
Posted: Wed Dec 16, 2009 2:31 pm Post subject: |
|
|
 Jedi Council
Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
|
Are you sure it is binary? Could it not be a valid character in a different characterset? Perhaps the app that is sending it uses a different default character set (CCSID)? What does the info in the MQMD that relates to this message say?
you could probably parse exach field with a regexp to filter out invalid chars but it might not be possible and it is a case of GIGO and if it is rare enough, it might not be financially viable to code for this situation. _________________ WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995
Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions. |
|
Back to top |
|
 |
pcelari |
Posted: Thu Dec 17, 2009 7:13 am Post subject: |
|
|
Chevalier
Joined: 31 Mar 2006 Posts: 411 Location: New York
|
thanks for responding!
yes, the parser exception complaint about "Invalid character (unicode: 0x1D)."
apparently, this should have been filtered out by the data entry application. But it wasn't. Now I'll have to deal with it.
You're probably right that it isn't a viable solution to filter it out with ESQL. I just want to prevent parser from failing.
So, the question becomes: Is it possible for a XML tree to contain BLOB as content?
 _________________ pcelari
-----------------------------------------
- a master of always being a newbie |
|
Back to top |
|
 |
smdavies99 |
Posted: Thu Dec 17, 2009 8:12 am Post subject: |
|
|
 Jedi Council
Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
|
It is possible for XML to contain a BLOB. I have used the xs:Base64Binary datatype in the message model. _________________ WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995
Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions. |
|
Back to top |
|
 |
Vitor |
Posted: Thu Dec 17, 2009 9:40 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
pcelari wrote: |
So, the question becomes: Is it possible for a XML tree to contain BLOB as content? |
CDATA? _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
smdavies99 |
Posted: Thu Dec 17, 2009 10:22 am Post subject: |
|
|
 Jedi Council
Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
|
Vitor wrote: |
pcelari wrote: |
So, the question becomes: Is it possible for a XML tree to contain BLOB as content? |
CDATA? |
IIRC, XML in a CDATA section is parsed as being valid. I think it was discussed here a long time ago. Otherwise, a BLOB is a BLOB is a BLOB and is ignored by the xml (of whichever flavour you use) parser. _________________ WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995
Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions. |
|
Back to top |
|
 |
kimbert |
Posted: Thu Dec 17, 2009 2:48 pm Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
A CData section allows you to put the < and " characters (and others) into the content of a tag without escaping them using < and "
All the characters in the content of the CData section must still be valid XML characters, so CData is not the solution to pcelari's problem. |
|
Back to top |
|
 |
Vitor |
Posted: Thu Dec 17, 2009 3:01 pm Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
 _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
Vitor |
Posted: Thu Dec 17, 2009 3:02 pm Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
 _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
|