Take a look at the jwsdp samples inline-customizatio
and external-customization. Below is the inline
sample. Use use the xml schema <annotation> to specify
the class name to bind to (POType in this example.
--Hank
<xsd:complexType name="PurchaseOrderType">
<xsd:annotation>
<xsd:appinfo>
<jxb:class name="POType">
<jxb:javadoc>
A <b>Purchase Order</b> consists of addresses and items.
</jxb:javadoc>
</jxb:class>
</xsd:appinfo>
</xsd:annotation>
----- Original Message -----
From: "Steve Maring" <steve_at_maring.org>
To: <JAXB-INTEREST_at_JAVA.SUN.COM>
Sent: Thursday, June 26, 2003 9:14 PM
Subject: custom binding for single element XML
> I have an XML file like this:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <MY_ELEMENT>text</MY_ELEMENT>
>
>
> I'd like to have that bound to a classname of MyElement with a single
> property called Value.
>
> The XSD looks like this:
>
> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
> <xsd:element name="MY_ELEMENT" type="xsd:string"/>
> </xsd:schema>
>
> I've tried this but it does not work:
>
> <jaxb:bindings version="1.0"
> xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema">
> <jaxb:bindings schemaLocation="MyElement.xsd" node="/xsd:schema">
> <jaxb:bindings node="//xsd:element[@name='MY_ELEMENT']">
> <jaxb:class name="MyElement"/>
> </jaxb:bindings>
> </jaxb:bindings>
> </jaxb:bindings>
>
>
> I keep ending up with a class named MY_ELEMENT!
>
> Any thoughts would be greatly appreciated. I've got the complicated XML
> licked!
>
> Steve Maring
> Tarpon Springs, FL
>