jaxb - Use JAXWS enableWrapperStyle while generating Java source with XJC -


i'm trying generate java source xsd , have disable wrapper style jaxws. i've written custom binding seems jaxws doesn't work xjc. binding use pretty simple.

<jaxb:bindings xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc" xmlns:xs="http://www.w3.org/2001/xmlschema" xmlns:jaxws="http://java.sun.com/xml/ns/jaxws" xmlns="http://java.sun.com/xml/ns/jaxws" version="2.1" jaxb:extensionbindingprefixes="xjc">  <jaxb:bindings>     <jaxb:globalbindings typesafeenummaxmembers="2000" generateelementproperty="false" >          <jaxws:enablewrapperstyle>false</jaxws:enablewrapperstyle>     </jaxb:globalbindings> </jaxb:bindings> 

if i'm trying run ant script i'm getting following error messages.

 [xjc] [error] unsupported binding namespace "http://java.sun.com/xml/ns/jaxws". perhaps meant "http://java.sun.com/xml/ns/jaxb/xjc"?   [xjc]   line 2 of file:/d:/xxxxxxxxxx/xxxxx/xxxx.xsd   [xjc] [error] cvc-complex-type.2.4.a: invalid content found starting element 'jaxws:enablewrapperstyle'. 1 of '{"http://java.sun.com/xml/ns/jaxb":javatype, "http://java.sun.com/xml/ns/jaxb":serializable, "http://java.sun.com/xml/ns/jaxb/xjc":serializable, "http://java.sun.com/xml/ns/jaxb/xjc":superclass, "http://java.sun.com/xml/ns/jaxb/xjc":superinterface, "http://java.sun.com/xml/ns/jaxb/xjc":typesubstitution, "http://java.sun.com/xml/ns/jaxb/xjc":smartwildcarddefaultbinding, "http://java.sun.com/xml/ns/jaxb/xjc":simple, "http://java.sun.com/xml/ns/jaxb/xjc":treatrestrictionlikenewtype, "http://java.sun.com/xml/ns/jaxb/xjc":javatype, "http://java.sun.com/xml/ns/jaxb/xjc":generateelementproperty, "http://java.sun.com/xml/ns/jaxb/xjc":nomarshaller, "http://java.sun.com/xml/ns/jaxb/xjc":nounmarshaller, "http://java.sun.com/xml/ns/jaxb/xjc":novalidator, "http://java.sun.com/xml/ns/jaxb/xjc":novalidatingunmarshaller}' expected.   [xjc]   line 8 of file:/d:/xxxxxxxxxx/xxxxx/xxxx/xsd/xsd-binding.xml 

i have tryed use jaxws, xjc extpects jaxb main binding. binding:

<bindings xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"     xmlns:xs="http://www.w3.org/2001/xmlschema" xmlns="http://java.sun.com/xml/ns/jaxws"     jaxb:version="2.1" extensionbindingprefixes="xjc annox">     <enablewrapperstyle>false</enablewrapperstyle>     <jaxb:bindings>         <jaxb:globalbindings typesafeenummaxmembers="2000" generateelementproperty="false" />     </jaxb:bindings> </bindings> 

i'm getting error:

[xjc] [error] not external binding file. root element must {http://java.sun.com/xml/ns/jaxb}bindings {http://java.sun.com/xml/ns/jaxws}bindings       [xjc]   line ? of file:/d:/xxxxxx/xsd-binding.xml       [xjc] [error] unexpected <bindings> appears @ line 4 column 61       [xjc]   line 4 of file:/d:/xxxxxx/xsd-binding.xml 

is possible use jaxws:enablewrapperstyle inside of jaxb? if yes, have overlooked? thank in advance!

i've found solution. jaxws-element has inside of jaxb-element , has declared follows:

<?xml version="1.0"?> <jaxb:bindings xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"     xmlns:xs="http://www.w3.org/2001/xmlschema" version="2.1" jaxb:extensionbindingprefixes="xjc annox">     <jaxws:bindings xmlns:jaxws="http://java.sun.com/xml/ns/jaxws">         <jaxws:enablewrapperstyle>false</jaxws:enablewrapperstyle>     </jaxws:bindings>     <jaxb:bindings>         <jaxb:globalbindings typesafeenummaxmembers="2000" generateelementproperty="false"/>     </jaxb:bindings> </jaxb:bindings> 

Comments

Popular posts from this blog

sql - invalid in the select list because it is not contained in either an aggregate function -

Angularjs unit testing - ng-disabled not working when adding text to textarea -

How to start daemon on android by adb -