views:

142

answers:

2

I have a web service and client that are passing around strings containing character references such as  (0x1A). These are invalid in XML 1.0 but valid in XML 1.1. Axis's XML parser is throwing exceptions because of these character references. Is there a way to force it to parse the response as XML 1.1, or to insert the XML declaration? (There currently isn't one.) I looked into using handlers, but my understanding is that they get invoked after the XML is already parsed.

A: 

I think you're going to have a pretty tough time with this. My understanding is that the WSDL 2.0 standard is built on XML 1.0. So what kind of service are you calling that describes itself with WSDL (assuming XML 1.0) and then starts sending you messages with XML 1.1 characters in it?

When you define an Axis2 service, you can define what handlers it has in the services.xml file. For example on this page they've got a service that used the org.apache.axis2.receivers.RawXMLINOutMessageReceiver...I know that's not what you're trying to do but maybe it's a place to start looking or thinking.

Michael Sharek
There's a whole stack of issues. Basically, it comes down to the fact that MS Word "Smart Quotes" and EBCDIC don't mix. *shudder*It's not supposed to return 0x1A characters, but it is. We should be able to handle it more gracefully by just having one funny character rather than dying entirely.
Adam Crume
A: 

Are you passing in an InputStream or Reader? If so, you could wrap the source in another class (like BufferedReader works) but use it to drop the unnecessary characters.

lavinio