users@jaxb.java.net

Using javaType to map custom classes

From: Dan Lange <dlange02_at_HARRIS.COM>
Date: Fri, 21 Feb 2003 08:03:31 -0700

I am trying to represent a data type as a string in my XML file, and as a custom class in my java code. This appears to be supported by the javaType tag in section 6.9 of the spec, as shown in the following example:

<xsd:simpleType name="MyName">
   <xsd:annotation>
      <xsd:appinfo>
         <jxb:javaType name="com.harris.MyName"
                       parse="new"
         print="toString" />
      </xsd:appinfo>
   </xsd:annotation>
   <xsd:restriction base="xsd:string" />
</xsd:simpleType>

When I do this, I get the following error:
Unable to load "com.harris.MyName" Is this class available in the classpath?

I get this error even after including com.harris.MyName.

So, as a test, I changed the name attribute to "java.lang.String"
In which case, I get the following error:
   Specified conversion customization is not used.

Is this feature supported?
Am I just getting the syntax wrong, or having classpath problems?

If the source code were available, I could figure this out for myself. Is there any way that I can get access to it?

Has anyone been successful in binding a simple type to a java class? Example code would be very helpful.