users@jaxb.java.net

Re: Unmarshal issue with xs:import

From: Wolfgang Laun <wolfgang.laun_at_gmail.com>
Date: Tue, 16 Jun 2009 16:40:13 +0200

On 6/16/09, jyoti chhabra <jyoti.chhabra_at_gmail.com> wrote:
>
> I've tried giving different name space for Common.xsd
> "http://abc.xyz.com/Common", but still it's not getting the elements
> from Object1.


You'll have to change the XML file - but see below...



> The Adapter error i was getting was after adding this line in my xjb file:
> <jaxb:globalBindings generateIsSetMethod="true">
> <jaxb:javaType name="java.util.Calendar" xmlType="xs:date"
> parseMethod="javax.xml.bind.DatatypeConverter.parseDate"
> printMethod="javax.xml.bind.DatatypeConverter.printDate" />
> </jaxb:globalBindings>
>
> And the error message was :
> package org.w3._2001.xmlschema does not exist
> [javac] import org.w3._2001.xmlschema.Adapter1;


This error is due to not including the package/directory in your javac call.
Otherwise than this, it would compile OK, and the Adapter1 would be used by
JAXB.

But you can redirect Adapter1 into some other package, according to the
hack:

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
  targetNamespace="http://www.w3.org/2001/XMLSchema"
  xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
  jaxb:version="2.0">
  <xs:annotation><xs:appinfo>
    <jaxb:schemaBindings>
      <jaxb:package name="com.abc.def.main"/>
    </jaxb:schemaBindings>
  </xs:appinfo></xs:annotation>
</xs:schema>

Put this on a file, let's call it Org.xsd, and import this with an
<xs:import namespace=http://www.w3.org/2001/XMLSchema
 schemaLocation="Org.xsd"/> in your Main.xsd.

Do no add anything to this file. If you have Common definitions, put
them on *another* Schema, and import this too.

-W



Regards,
> Jyoti
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
> For additional commands, e-mail: users-help_at_jaxb.dev.java.net
>
>