title: jaxb how to reference an element to http://www.w3.org/2001/XMLSchema like <xs:element ref="xs:schema"/>
body: <p>I have this wsdl.  The key point is the line with <code>&lt;xs:element ref="xs:schema"/&gt;</code>.  It's an element that refers back to <a href="http://www.w3.org/2001/XMLSchema" rel="nofollow">http://www.w3.org/2001/XMLSchema</a>.  JAXB does not appear to like it, so I had to import <a href="http://www.w3.org/2001/XMLSchema" rel="nofollow">http://www.w3.org/2001/XMLSchema</a> namespace, but I get error (bottom).</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;wsdl:definitions name="GetSomethingWS" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:getsome="urn://schema.com/services/GetSomething" xmlns:ws="urn://schema.com/services/GetSomething" targetNamespace="urn://schema.com/services/GetSomething"&gt;
      &lt;wsdl:types&gt;
          &lt;xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:getsome="urn://schema.com/services/GetSomething" targetNamespace="urn://schema.com/services/GetSomething" elementFormDefault="qualified" attributeFormDefault="unqualified"&gt;
              &lt;xs:import namespace="http://www.w3.org/2001/XMLSchema" schemaLocation="http://www.w3.org/2001/XMLSchema"/&gt;
              &lt;xs:element name="getSomething" type="getsome:GeneticType"/&gt;
              &lt;xs:complexType name="GeneticType"&gt;
                  &lt;xs:sequence&gt;
                      &lt;xs:element ref="xs:schema"/&gt;
                      &lt;xs:any/&gt;
                  &lt;/xs:sequence&gt;
              &lt;/xs:complexType&gt;
          &lt;/xs:schema&gt;
      &lt;/wsdl:types&gt;
      &lt;wsdl:message name="getSomething"&gt;
          &lt;wsdl:part name="parameters" element="getsome:getSomething"/&gt;
      &lt;/wsdl:message&gt;
      &lt;wsdl:portType name="GetSomethingWS"&gt;
          &lt;wsdl:operation name="getSomething"&gt;
              &lt;wsdl:input message="ws:getSomething"/&gt;
          &lt;/wsdl:operation&gt;
      &lt;/wsdl:portType&gt;
      &lt;wsdl:binding name="GetSomethingWSPortBinding" type="ws:GetSomethingWS"&gt;
          &lt;soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/&gt;
          &lt;wsdl:operation name="getSomething"&gt;
              &lt;soap:operation soapAction="urn:getSomething" style="document"/&gt;
              &lt;wsdl:input&gt;
                  &lt;soap:body parts="parameters" use="literal"/&gt;
              &lt;/wsdl:input&gt;
          &lt;/wsdl:operation&gt;
      &lt;/wsdl:binding&gt;
      &lt;wsdl:service name="GetSomethingWSService"&gt;
          &lt;wsdl:port name="GetSomethingWSPort" binding="ws:GetSomethingWSPortBinding"&gt;
              &lt;soap:address location="http://host:port/my.getSomethingWS"/&gt;
          &lt;/wsdl:port&gt;
      &lt;/wsdl:service&gt;
  &lt;/wsdl:definitions&gt;
  </code></pre>
  
  <p>And I attempt to generate Java code using JAXB and ant build script:</p>
  
  <pre><code>&lt;project default="wsimport"&gt;
  &lt;target name="wsimport"&gt;
  &lt;echo&gt;java home=${java.home}&lt;/echo&gt;
  &lt;property name="wsdl.path" value="./"/&gt;
  &lt;property name="wsdl.name" value="GetSomethingWS.wsdl"/&gt;
  &lt;exec executable="${java.home}/../bin/wsimport"&gt;
  &lt;arg line="-keep -s ./src -p ./ -d ./bin -wsdllocation classpath:${wsdl.path}/${wsdl.name} src/${wsdl.path}/${wsdl.name}" /&gt;
  &lt;/exec&gt;
  &lt;copy file = "src/${wsdl.path}/${wsdl.name}" todir="./bin/${wsdl.path}" overwrite="true"/&gt;
  &lt;/target&gt;
  &lt;/project&gt;
  </code></pre>
  
  <p>I get these warnings and error:</p>
  
  <pre><code>wsimport:
       [echo] java home=C:\SoftwareAG32\jvm\jvm160_32\jre
       [exec] parsing WSDL...
       [exec] [WARNING] s4s-elt-character: Non-whitespace characters are not allowed in schema elements other than 'xs:appinfo' and 'xs:documentation'. Saw 'XML Schema'.
       [exec]   line 5 of http://www.w3.org/2001/XMLSchema
       [exec] [WARNING] s4s-elt-character: Non-whitespace characters are not allowed in schema elements other than 'xs:appinfo' and 'xs:documentation'. Saw 'XML Schema'.
       [exec]   line 8 of http://www.w3.org/2001/XMLSchema
       [exec] [WARNING] s4s-elt-character: Non-whitespace characters are not allowed in schema elements other than 'xs:appinfo' and 'xs:documentation'. Saw '12 September 2005'.
       [exec]   line 10 of http://www.w3.org/2001/XMLSchema
       [exec] [WARNING] s4s-elt-character: Non-whitespace characters are not allowed in schema elements other than 'xs:appinfo' and 'xs:documentation'. Saw 'Table of contents'.
       [exec]   line 13 of http://www.w3.org/2001/XMLSchema
       [exec] [WARNING] s4s-elt-character: Non-whitespace characters are not allowed in schema elements other than 'xs:appinfo' and 'xs:documentation'. Saw 'Introduction'.
       [exec]   line 15 of http://www.w3.org/2001/XMLSchema
       [exec] [WARNING] s4s-elt-character: Non-whitespace characters are not allowed in schema elements other than 'xs:appinfo' and 'xs:documentation'. Saw 'Resources'.
       [exec]   line 16 of http://www.w3.org/2001/XMLSchema
       [exec] [WARNING] s4s-elt-character: Non-whitespace characters are not allowed in schema elements other than 'xs:appinfo' and 'xs:documentation'. Saw 'Introduction'.
       [exec]   line 20 of http://www.w3.org/2001/XMLSchema
       [exec] [WARNING] s4s-elt-character: Non-whitespace characters are not allowed in schema elements other than 'xs:appinfo' and 'xs:documentation'. Saw 'This document describes the '.
       [exec]   line 21 of http://www.w3.org/2001/XMLSchema
       [exec] [WARNING] s4s-elt-character: Non-whitespace characters are not allowed in schema elements other than 'xs:appinfo' and 'xs:documentation'. Saw 'XML Schema'.
       [exec]   line 21 of http://www.w3.org/2001/XMLSchema
       [exec] [WARNING] s4s-elt-character: Non-whitespace characters are not allowed in schema elements other than 'xs:appinfo' and 'xs:documentation'. Saw 'namespace.
       [exec] It also contains a directory of links to these related resources, using '.
       [exec]   line 22 of http://www.w3.org/2001/XMLSchema
       [exec] [WARNING] s4s-elt-character: Non-whitespace characters are not allowed in schema elements other than 'xs:appinfo' and 'xs:documentation'. Saw 'Resource Directory Description Language'.
       [exec]   line 23 of http://www.w3.org/2001/XMLSchema
       [exec] [WARNING] s4s-elt-character: Non-whitespace characters are not allowed in schema elements other than 'xs:appinfo' and 'xs:documentation'. Saw '.'.
       [exec]   line 23 of http://www.w3.org/2001/XMLSchema
       [exec] [WARNING] s4s-elt-character: Non-whitespace characters are not allowed in schema elements other than 'xs:appinfo' and 'xs:documentation'. Saw 'Related Resources for XML Schema'.
       [exec]   line 26 of http://www.w3.org/2001/XMLSchema
       [exec] [WARNING] s4s-elt-character: Non-whitespace characters are not allowed in schema elements other than 'xs:appinfo' and 'xs:documentation'. Saw 'Schemas for XML Schema'.
       [exec]   line 28 of http://www.w3.org/2001/XMLSchema
       [exec] [WARNING] s4s-elt-character: Non-whitespace characters are not allowed in schema elements other than 'xs:appinfo' and 'xs:documentation'. Saw 'DTD'.
       [exec]   line 31 of http://www.w3.org/2001/XMLSchema
       [exec] [WARNING] s4s-elt-character: Non-whitespace characters are not allowed in schema elements other than 'xs:appinfo' and 'xs:documentation'. Saw 'A (non-normative) DTD '.
       [exec]   line 32 of http://www.w3.org/2001/XMLSchema
       [exec] [WARNING] s4s-elt-character: Non-whitespace characters are not allowed in schema elements other than 'xs:appinfo' and 'xs:documentation'. Saw 'XMLSchema.dtd'.
       [exec]   line 32 of http://www.w3.org/2001/XMLSchema
       [exec] [WARNING] s4s-elt-character: Non-whitespace characters are not allowed in schema elements other than 'xs:appinfo' and 'xs:documentation'. Saw 'for XML Schema.  It
       [exec] incorporates an auxiliary DTD, '.
       [exec]   line 33 of http://www.w3.org/2001/XMLSchema
       [exec] [WARNING] s4s-elt-character: Non-whitespace characters are not allowed in schema elements other than 'xs:appinfo' and 'xs:documentation'. Saw 'datatypes.dtd'.
       [exec]   line 33 of http://www.w3.org/2001/XMLSchema
       [exec] [WARNING] s4s-elt-character: Non-whitespace characters are not allowed in schema elements other than 'xs:appinfo' and 'xs:documentation'. Saw '.'.
       [exec]   line 33 of http://www.w3.org/2001/XMLSchema
       [exec] [WARNING] s4s-elt-character: Non-whitespace characters are not allowed in schema elements other than 'xs:appinfo' and 'xs:documentation'. Saw 'XML Schema'.
       [exec]   line 38 of http://www.w3.org/2001/XMLSchema
       [exec] [WARNING] s4s-elt-character: Non-whitespace characters are not allowed in schema elements other than 'xs:appinfo' and 'xs:documentation'. Saw 'An '.
       [exec]   line 39 of http://www.w3.org/2001/XMLSchema
       [exec] [WARNING] s4s-elt-character: Non-whitespace characters are not allowed in schema elements other than 'xs:appinfo' and 'xs:documentation'. Saw 'XML Schema schema document'.
       [exec]   line 39 of http://www.w3.org/2001/XMLSchema
       [exec] [WARNING] s4s-elt-character: Non-whitespace characters are not allowed in schema elements other than 'xs:appinfo' and 'xs:documentation'. Saw 'for XML Schema
       [exec] schema documents.  Last updated with release of XML Schema 2nd edition'.
       [exec]   line 40 of http://www.w3.org/2001/XMLSchema
       [exec] [WARNING] s4s-elt-character: Non-whitespace characters are not allowed in schema elements other than 'xs:appinfo' and 'xs:documentation'. Saw 'in July 2004.'.
       [exec]   line 41 of http://www.w3.org/2001/XMLSchema
       [exec] [WARNING] s4s-elt-character: Non-whitespace characters are not allowed in schema elements other than 'xs:appinfo' and 'xs:documentation'. Saw 'Normative References'.
       [exec]   line 48 of http://www.w3.org/2001/XMLSchema
       [exec] [WARNING] s4s-elt-character: Non-whitespace characters are not allowed in schema elements other than 'xs:appinfo' and 'xs:documentation'. Saw 'XML Schema Part 1:
       [exec]           Structures'.
       [exec]   line 53 of http://www.w3.org/2001/XMLSchema
       [exec] [WARNING] s4s-elt-character: Non-whitespace characters are not allowed in schema elements other than 'xs:appinfo' and 'xs:documentation'. Saw '(2nd Edition)'.
       [exec]   line 53 of http://www.w3.org/2001/XMLSchema
       [exec] [WARNING] s4s-elt-character: Non-whitespace characters are not allowed in schema elements other than 'xs:appinfo' and 'xs:documentation'. Saw 'XML Schema Part 2:
       [exec]           Datatypes'.
       [exec]   line 56 of http://www.w3.org/2001/XMLSchema
       [exec] [WARNING] s4s-elt-character: Non-whitespace characters are not allowed in schema elements other than 'xs:appinfo' and 'xs:documentation'. Saw '(2nd Edition)'.
       [exec]   line 56 of http://www.w3.org/2001/XMLSchema
       [exec] [WARNING] s4s-elt-character: Non-whitespace characters are not allowed in schema elements other than 'xs:appinfo' and 'xs:documentation'. Saw 'XML Schema Part 0:
       [exec]           Primer'.
       [exec]   line 59 of http://www.w3.org/2001/XMLSchema
       [exec] [WARNING] s4s-elt-character: Non-whitespace characters are not allowed in schema elements other than 'xs:appinfo' and 'xs:documentation'. Saw '(2nd Edition)'.
       [exec]   line 59 of http://www.w3.org/2001/XMLSchema
       [exec] [WARNING] s4s-elt-schema-ns: The namespace of element 'html' must be from the schema namespace, 'http://www.w3.org/2001/XMLSchema'.
       [exec]   line 3 of http://www.w3.org/2001/XMLSchema
       [exec] [WARNING] s4s-elt-invalid: Element 'html' is not a valid element in a schema document.
       [exec]   line 3 of http://www.w3.org/2001/XMLSchema
       [exec] [WARNING] src-import.2: The root element of document 'http://www.w3.org/2001/XMLSchema' has to have the namespace name 'http://www.w3.org/2001/XMLSchema' and the local name 'schema'.
       [exec]   line 3 of http://www.w3.org/2001/XMLSchema
       [exec] [WARNING] src-resolve: Cannot resolve the name 'xs:schema' to a(n) 'element declaration' component.
       [exec]   line 9 of file:/C:/Users/yanja001/Documents/tools/workspace/WsdlValidation/src/GetSomethingWS.wsdl#types?schema1
       [exec] [ERROR] Unexpected &lt;html&gt; appears at line 3 column 135
       [exec]   line 3 of http://www.w3.org/2001/XMLSchema
  </code></pre>
  
  <p>Is there problem with JAXB or my WSDL?</p>