views:

453

answers:

1

I have used the Jaxme 2 libraries before to generate Java code from .XSD files without a problem. I'm currently encountering a problem generating Java from an XSD file that contains a http://schemas.microsoft.com/2003/10/Serialization/ namespace.

Some sample code from my .XSD is:

<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:tns="http://schemas.datacontract.org/2004/07/MyMessagingTypes"
       xmlns:ser="http://schemas.microsoft.com/2003/10/Serialization/"
       elementFormDefault="qualified"
       xmlns:xs="http://www.w3.org/2001/XMLSchema"&gt;

  <xs:import namespace="http://schemas.microsoft.com/2003/10/Serialization/" />
  <xs:complexType name="MyMessage">
    <xs:sequence>
      ...
      <xs:element minOccurs="0" name="MyPlanID" type="ser:guid" />
      ...
    </xs:sequence>
  </xs:complexType>
  <xs:element name="MyMessage" nillable="true" type="tns:MyMessage" />
</xs:schema>


The Error I'm getting is:

Invalid element: The type {http://schemas.microsoft.com/2003/10/Serialization/}guid is not defined.

Any ideas what the problem is or how I can generate Java code from this xsd?

+1  A: 

I don't know where the schema for http://schemas.microsoft.com/2003/10/Serialization/ is located, but you would have to find it, and make sure that Java sees both schemas. Alternatively, you could edit the XSD to include your own GUID type instead.

John Saunders