ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Character reference "" is an invalid

Post new topic  Reply to topic
 Character reference "" is an invalid « View previous topic :: View next topic » 
Author Message
chenna.hari
PostPosted: Tue Jun 08, 2010 10:32 am    Post subject: Character reference "" is an invalid Reply with quote

Centurion

Joined: 21 Mar 2009
Posts: 103

I have in input xml and need to parse this xml and iam getting the error

Character reference "" is an invalid XML character.

Can anyone help how to solve this error?
Back to top
View user's profile Send private message
mqjeff
PostPosted: Tue Jun 08, 2010 10:33 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

Tell the sending system to send you valid XML data.
Back to top
View user's profile Send private message
chenna.hari
PostPosted: Tue Jun 08, 2010 10:37 am    Post subject: Reply with quote

Centurion

Joined: 21 Mar 2009
Posts: 103

But can you tell me the possbility to access the element containing this data
Back to top
View user's profile Send private message
mqjeff
PostPosted: Tue Jun 08, 2010 10:50 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

If a fruit vendor offers you a rotten fruit, do you look for ways to cut out the bad spots?

Or do you tell them to give you a piece of fresh fruit?

Current versions of Broker will replace illegal XML values with substitution characters, in at least some circumstances. This could essentially be causing your issue, where the sender has sent you bytes that are illegal in XML and these bad bytes have been turned into a substitution character, but the act of doing so has now rendered the document into an illegal XML document.

Except it was already an illegal XML document because it had illegal XML characters in it.
Back to top
View user's profile Send private message
mqmatt
PostPosted: Tue Jun 08, 2010 11:20 am    Post subject: Reply with quote

Grand Master

Joined: 04 Aug 2004
Posts: 1213
Location: Hursley, UK

A O'D's got a good anecdote on this.
Back to top
View user's profile Send private message
chenna.hari
PostPosted: Tue Jun 08, 2010 11:28 am    Post subject: Reply with quote

Centurion

Joined: 21 Mar 2009
Posts: 103

in message broker, still is there any way to transform this illegal xml document????
Back to top
View user's profile Send private message
kimbert
PostPosted: Tue Jun 08, 2010 11:38 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Please post the actual snippet of XML that is causing the problem. I would like to know whether the string that you quoted is the real string from the input document, so please
a) enclose the snippet in [code] tags and
b) use the preview button before you click submit, and check that it looks exactly like the original document.

Quote:
in message broker, still is there any way to transform this illegal xml document????

No XML parser, in any product, should accept that XML and process it. You can write some custom Java or ESQL to fix up the illegal XML. Nobody can help you with that, because only you can possibly know what kinds of illegal XML you are expecting to receive. The best solution is to ask the sender to send legal XML.
Back to top
View user's profile Send private message
joebuckeye
PostPosted: Tue Jun 08, 2010 11:58 am    Post subject: Reply with quote

Partisan

Joined: 24 Aug 2007
Posts: 365
Location: Columbus, OH

Quote:
in message broker, still is there any way to transform this illegal xml document????


Sure, you could treat it as a string and handle all the parsing yourself. But that way madness lies.
Back to top
View user's profile Send private message
chenna.hari
PostPosted: Tue Jun 08, 2010 12:17 pm    Post subject: Reply with quote

Centurion

Joined: 21 Mar 2009
Posts: 103

I cannot give the full xml document. but here the following sample.


Code:
<element>&#x7;</element>
Back to top
View user's profile Send private message
kimbert
PostPosted: Tue Jun 08, 2010 1:08 pm    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

OK - so here is the rule that is being broken : http://www.w3.org/TR/2006/REC-xml-20060816/#dt-charref
Note that a character reference must still resolve to a valid XML character, and the character 0x07 is not a valid XML character.

It is up to you how you fix it. Almost any *correct* fix-up algorithm will end up looking like an XML parser. If you think you can get away with something simpler, feel free to try. Just parse the message as a BLOB, convert to a string, fix it up, and re-parse.
Back to top
View user's profile Send private message
joebuckeye
PostPosted: Wed Jun 09, 2010 4:41 am    Post subject: Reply with quote

Partisan

Joined: 24 Aug 2007
Posts: 365
Location: Columbus, OH

The problem with fixing the document though is that the sender may consider the 0x07 valid data for that field. They have to be aware that you are changing their data before sending it on.

We've seen these sorts of invalid characters in dealing with mainframe groups creating XML's to send to the broker.

I would say your responsibility is to notify the sender that they are sending you an invalid XML and tell them what the bad character is and where you found it. Then they can fix it.

If you fix this for 0x07, what is to prevent them from sending 0x08 the next day? The sooner the sending group is made aware of what is valid in an XML document the easier your life will be in the long run.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Character reference "&amp;#x7;" is an invalid
Jump to:  



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
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.