What you mainly need to do is remove the scheme binding from your xsd files. I've copied and tested your files and it worked. However, I changed the reference to ContactAM
to ContactLM
assuming it was a typo.
Here are my files:
ContactM.xsd
<?xml version="1.0"?>
<xsd:schema
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:gw="http://w.com/xsd"
xmlns="http://w.com/location.contactm"
targetNamespace="http://w.com/location.contactm"
elementFormDefault="qualified"
xmlns:ns0="http://w.com/location.contactam"
xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
jaxb:version="2.1">
<xsd:annotation>
<xsd:appinfo>
<!-- <jaxb:schemaBindings> -->
<!-- <jaxb:package name="location.contactm"/> -->
<!-- </jaxb:schemaBindings> -->
</xsd:appinfo>
</xsd:annotation>
<xsd:import namespace="http://w.com/location.contactlm"
schemaLocation="ContactLM.xsd"/>
<xsd:element name="Contact" type="Contact" nillable="true"/>
<xsd:complexType name="Contact">
<xsd:sequence>
<xsd:element name="RefID" minOccurs="0" nillable="true"
type="xsd:string" gw:type="java.lang.String"/>
<xsd:element name="WorkPhone" minOccurs="0" nillable="true"
type="xsd:string" gw:type="java.lang.String"/>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
ContactLM.xsd
<?xml version="1.0"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:gw="http://w.com/xsd"
xmlns="http://w.com/location.contactlm"
xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
targetNamespace="http://w.com/location.contactlm"
elementFormDefault="qualified" jaxb:version="2.1">
<xsd:annotation>
<xsd:appinfo>
<!-- <jaxb:schemaBindings> -->
<!-- <jaxb:package name="location.contactm"/> -->
<!-- </jaxb:schemaBindings> -->
</xsd:appinfo>
</xsd:annotation>
<xsd:element name="Contact" type="Contact" nillable="true"/>
<xsd:complexType name="Contact">
<xsd:sequence>
<xsd:element name="RefID" type="xsd:string" nillable="true"
minOccurs="0" gw:type="java.lang.String"/>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
and finally the binding file:
bind.xjb
<jaxb:bindings
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:gw="http://w.com/xsd"
xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified"
xmlns="http://w.com/location.contactlm"
targetNamespace="http://w.com/location.contactlm"
jaxb:version="2.1">
<jaxb:bindings schemaLocation="ContactM.xsd">
<jaxb:bindings node=".//xs:element[@name='Contact']">
<jaxb:class name="ContactM"/>
</jaxb:bindings>
<jaxb:schemaBindings>
<jaxb:package name="location.contactm" />
</jaxb:schemaBindings>
</jaxb:bindings>
<jaxb:bindings schemaLocation="ContactLM.xsd">
<jaxb:bindings node=".//xs:element[@name='Contact']">
<jaxb:class name="ContactCLM"/>
</jaxb:bindings>
<jaxb:schemaBindings>
<jaxb:package name="location.contactlm" />
</jaxb:schemaBindings>
</jaxb:bindings>
</jaxb:bindings>
And for completeness, here's my command and its output
D:\stackoverflow\sample>xjc ContactM.xsd -b bind.xjb
parsing a schema...
compiling a schema...
location\contactm\Contact.java
location\contactm\ContactM.java
location\contactm\ObjectFactory.java
location\contactm\package-info.java
location\contactlm\Contact.java
location\contactlm\ContactCLM.java
location\contactlm\ObjectFactory.java
location\contactlm\package-info.java
Hope this helps.