Just fyi, few extra options have been added, examples :
1. {http://books}* : *
strip a namespace from all the in/out qualified elements (with namespace'
http://books')
2. * : {http://books}*
add an "http:books" namespace to all the in/out elements
3. {http://books}* : {http://superbooks}*
change namespaces, in->out or out->in
cheers, Sergey
Sorry...It is a bit lame, when I'm documenting I'm just type fast without re-checking the actual property names..."inElementsMap"
is the private field's name... Another typo to fix...
cheers, Sergey
----- Original Message -----
From: "Sertic Mirko, Bedag" <[email protected]>
To: <[email protected]>
Sent: Wednesday, January 27, 2010 1:10 PM
Subject: AW: Default XML namespace for validation with jaxrs
Hi
Thank you so much.
But i think the property should be "inTransformElements" for CXF 2.2.5
Anyway, thanks in advance
Mirko
-----Ursprüngliche Nachricht-----
Von: Sergey Beryozkin [mailto:[email protected]]
Gesendet: Mittwoch, 27. Januar 2010 11:18
An: [email protected]
Betreff: Re: Default XML namespace for validation with jaxrs
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