There's a typo, for "books" it should be
books : {http://books}books
though
books : {http://books}books
is a valid pairtoo provided one needs to change the name too
Hi
Please see [1], specifically, check an inElementsMap property.
So you can configure a provider with a map containing a pair like this :
books : {http://books}book
where {http://books}book is a QName in the expanded form. What will happen is
that if you have say
<books>
<book id="1"/>
</books>
coming in then JAXB Unmarshaller will end up seeing
<ns1:books xmlns:ns1="http://books">
<book id="1"/>
</books>
this will let you to validate it with a complex type with an unqualified elementFormDefault...There's no way to configure the
provider so that it adds a default namespace, but if you need a fully qualified instance and you have a not very large XMl coming
in then, assuming for example you have the above XML coming in, you can configure "inElementsMap" as follows :
books : {http://books}book
book : {http://books}book
Ideally, one would just do
* : {http://books}*
I'll look into is a bit later
Sergey
[1]
http://cwiki.apache.org/CXF20DOC/jax-rs.html#JAX-RS-CustomizingJAXBXMLandJSONinputandoutput
----- Original Message -----
From: "Sertic Mirko, Bedag" <[email protected]>
To: <[email protected]>
Sent: Wednesday, January 27, 2010 10:05 AM
Subject: Default XML namespace for validation with jaxrs
h...@all
I want to know if ist possible to specify a default namespace for
incoming REST requests.
I have a haxrs:server with a special JAXBElementProvider with configured
XML validation. Now comes the tricky point. There are some legacy
clients
sending requests without an XML namespace. Now I need to configure a
default namespace for those requests, and make it working with
validation again.
At the moment every request without a namespace runs into a
SAXParserException.
Is there a clever solution for this problem without much coding?
Thanks in advance
Mirko