users@jaxb.java.net

Re: Ignoring Namespace URI on Unmarshalling

From: Aleksei Valikov <valikov_at_gmx.net>
Date: Fri, 14 Jan 2005 17:18:53 +0100

Hi.

> Is there a way to tell JAXB to ignore the namespace URI on
> unmarshalling? Here is my problem:
>
> I have a schema supplied by a vendor. They give a namespace URI in
> the xsd file. I've generated the JAXB classes from this. When I
> receive xml responses from this vendor, they don't include the
> namespace URI in their xml, so I get this error when unmarshalling:
>
> org.xml.sax.SAXParseException: unexpected root element (uri:"",
> local:"PoweredHotel_SingleAvailabilityReply"). Expected elements are
> <{http://www.amadeus.net}PoweredHotel_SingleAvailabilityReply>,<{http://www.amadeus.net}MessagesOnly_Reply>,<{http://www.amadeus.net}PoweredHotel_SingleAvailability>
>
> I think I can remove the namespace URI from the schema, but I don't
> really want to do this, because if the schema changes I will have to
> do this every time. Is there a way to have JAXB not throw this error
> when a namespace isn't present in the xml document?

Why don't you simply pre-process the incoming document to add the
namespace appropriately?
There are different ways tto do this: XSL, SAX filter etc.

Bye.
/lexi

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
For additional commands, e-mail: users-help_at_jaxb.dev.java.net