xsd - JAXB generated Java classes has the namespace issue on the rootelment -


i have single xsd file created below no errors in eclipse:

<?xml version="1.0"?> <xs:schema id="build-summaries"             xmlns:xs="http://www.w3.org/2001/xmlschema"             elementformdefault="qualified">   <xs:element name="build-summaries" >     <xs:complextype>       <xs:choice minoccurs="0"                   maxoccurs="unbounded">         <xs:element name="build">           <xs:complextype>             <xs:sequence>               <xs:element name="project-name"                            type="xs:string"                            minoccurs="0" />               <xs:element name="label"                             type="xs:string"                            minoccurs="0" />               <xs:element name="build-date"                             type="xs:string"                             minoccurs="0" />               <xs:element name="log-file"                             type="xs:string"                             minoccurs="0" />               <xs:element name="label-dirty"                             minoccurs="0"                             maxoccurs="unbounded">                 <xs:complextype>                   <xs:sequence>                     <xs:element name="message"                                   type="xs:string"                                   minoccurs="0" />                   </xs:sequence>                 </xs:complextype>               </xs:element>               <xs:element name="tests"                             minoccurs="0"                             maxoccurs="unbounded">                 <xs:complextype>                   <xs:sequence>                     <xs:element name="total"                                   type="xs:string"                                   minoccurs="0" />                     <xs:element name="failed"                                   type="xs:string"                                   minoccurs="0" />                     <xs:element name="error"                                   type="xs:string"                                   minoccurs="0" />                     <xs:element name="clean"                                   type="xs:string"                                   minoccurs="0" />                     <xs:element name="time"                                   type="xs:string"                                   minoccurs="0" />                   </xs:sequence>                 </xs:complextype>               </xs:element>               <xs:element name="summary"                             minoccurs="0"                             maxoccurs="unbounded">                 <xs:complextype>                   <xs:sequence>                     <xs:element name="total-tasks"                                   type="xs:string"                                   minoccurs="0" />                     <xs:element name="failures"                                   type="xs:string"                                   minoccurs="0" />                     <xs:element name="status"                                   type="xs:string"                                   minoccurs="0" />                   </xs:sequence>                 </xs:complextype>               </xs:element>               <xs:element name="families"                             minoccurs="0"                             maxoccurs="unbounded">                 <xs:complextype>                   <xs:sequence>                     <xs:element name="family"                                   minoccurs="0"                                   maxoccurs="unbounded">                       <xs:complextype>                         <xs:sequence>                           <xs:element name="name"                                         type="xs:string"                                         minoccurs="0" />                           <xs:element name="success"                                         type="xs:string"                                         minoccurs="0" />                           <xs:element name="failure"                                         type="xs:string"                                         minoccurs="0" />                           <xs:element name="notvalid"                                        type="xs:string"                                         minoccurs="0" />                           <xs:element name="sar-total"                                         type="xs:string"                                         minoccurs="0" />                           <xs:element name="sar-fails"                                         type="xs:string"                                         minoccurs="0" />                           <xs:element name="cbuild-tasks"                                         type="xs:string"                                         minoccurs="0" />                           <xs:element name="cbuild-fails"                                         type="xs:string"                                         minoccurs="0" />                         </xs:sequence>                       </xs:complextype>                     </xs:element>                   </xs:sequence>                 </xs:complextype>               </xs:element>             </xs:sequence>           </xs:complextype>         </xs:element>       </xs:choice>     </xs:complextype>   </xs:element> </xs:schema> 

i have created jaxb classes using xjc jaxb java classes generator. generated jaxb files having error on root element:

"cannot resolve xml element declaration namespace '' , name 'build-summaries' in context"  @xmlrootelement(name = "build-summaries") public class buildsummaries { 

can me resoving this? when create single xsd file, need create namespace?

if want build-summaries element in namespace, need add targetnamespace="http://example.com/mynamespace" xs:schema element's start-tag (substituting name of namespace want http://example.com/mynamespace).


Comments

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

Function that returns a formatted array in VBA -