How to generate Java files from WSDL when 'lang' already defined?
<p>I'm trying to turn a WSDL file into Java code using <code>wsimport</code> by running this command (which should work from anyone's machine):</p>

<pre><code>wsimport https://webservices-uatprod.dhisco.com/OTAHotelDescriptiveInfo/web_services?WSDL -J-Djavax.xml.accessExternalDTD=all -J-Djavax.xml.accessExternalSchema=all -B-XautoNameResolution -Xnocompile
</code></pre>

<p>However, I keep getting this error:</p>

<pre><code>[ERROR] 'lang' is already defined
  line 93 of http://www.w3.org/2001/03/xml.xsd

[ERROR] (related to above error) the first definition appears here
  line 43 of http://www.w3.org/2001/xml.xsd

[ERROR] 'space' is already defined
  line 102 of http://www.w3.org/2001/03/xml.xsd

[ERROR] (related to above error) the first definition appears here
  line 89 of http://www.w3.org/2001/xml.xsd

[ERROR] 'base' is already defined
  line 109 of http://www.w3.org/2001/03/xml.xsd

[ERROR] (related to above error) the first definition appears here
  line 113 of http://www.w3.org/2001/xml.xsd

[ERROR] 'specialAttrs' is already defined
  line 117 of http://www.w3.org/2001/03/xml.xsd

[ERROR] (related to above error) the first definition appears here
  line 157 of http://www.w3.org/2001/xml.xsd
</code></pre>

<p>I've spent hours googling this to try and find the solution.  I'm relatively convinced I need to specify a binding file with the <code>-b binding.xml</code> flag.</p>

<p>However, I'm having a very hard time figuring out how to create that binding file.  Here's what I've attempted:</p>

<p><strong>binding.xml</strong></p>

<pre><code>&lt;jaxb:bindings xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
              xmlns:xsd="http://www.w3c.org/2001/XMLSchema"
              xmlns:xs="http://www.w3.org/2001/03/xml.xsd"
              jaxb:version="2.0"&gt;
  &lt;jaxb:bindings schemaLocation="http://www.w3.org/2001/xml.xsd"&gt;
    &lt;jaxb:bindings node="//xs:attribute[@name='lang']"&gt;
        &lt;jaxb:property name="langAttribute"/&gt;
    &lt;/jaxb:bindings&gt;
  &lt;/jaxb:bindings&gt;
&lt;/jaxb:bindings&gt;
</code></pre>

<p>Then with this in place, I try running with the binding file by:</p>

<pre><code>wsimport https://webservices-uatprod.dhisco.com/OTAHotelDescriptiveInfo/web_services?WSDL -J-Djavax.xml.accessExternalDTD=all -J-Djavax.xml.accessExternalSchema=all -B-XautoNameResolution -Xnocompile -b binding.xml
</code></pre>

<p>And now I get:</p>

<pre><code>[ERROR] XPath evaluation of "//xs:attribute[@name='lang']" results in empty target node
  line 6 of file:/Users/name/git/foo/bar/src/main/resources/wsdl/binding.xml
</code></pre>

<p>I've tried many other combinations of the binding file's XPath... I figure I need to rename the attribute of all elements from 'lang' to something else, but I really have been having a hard time figuring it out.</p>

<p>Thanks in advance for any help!</p>

<p><strong>Solution Update</strong>:
I got past this error by downloading the schemas locally, and wherever there was a reference to <code>schemaLocation="http://www.w3.org/2001/03/xml.xsd"</code> and <code>schemaLocation="http://www.w3.org/2001/xml.xsd"</code>, I edited the XML to point to my local copy of the file on the file system.</p>

<p>I.e. opened up each *.xsd file where there was reference to these files, and updated each line from something like this:</p>

<pre><code>&lt;xsd:import namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="http://www.w3.org/2001/xml.xsd"/&gt;
</code></pre>

<p>To this:</p>

<pre><code>&lt;xsd:import namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="./xml.xsd"/&gt;
</code></pre>

<p>After that, it was able to generate the Java classes using the <code>wsimport</code> syntax above (did require one small binding file, but that was related to an vendor-defined class).</p>