# How Do I: Guide XMLBeans Type Naming During Schema Compilation?

By compiling your schema with an xsdconfig file, you can control how names are chosen for the generated types. An xsdconfig file is designed to map schema type names to generated Java type names. Coercing type naming in this way does not change the names for the underlying schema types — it merely determines the names for corresponding Java types. Selecting your own names for compiled types can be useful when you want to control type name length, locale, capitalization, and so on.

This procedure assumes you are compiling schemas using a WebLogic Workshop schema project.

Note: Due to a Windows operating system limitation on file path lengths (256 characters), you might have trouble compiling schemas in which the generated types are nested in a very deep package hierarchy. This may result in an error message stating that a particular class couldn't be found. To work around this limiitation, try using your xsdconfig file to guide the naming of generated packages so that the hierarchy is less deep, package names are shorter, etc.

To Guide Type Naming During Compilation

1. Determine the names you want for each of the named types in your schema, including elements and attributes.

   For example, you might decide that a PURH_ORDER element and CUST type should be called PurchaseOrder and Customer as Java types.

2. Add a new XSDCONFIG file to your project.
   1. Right-click the folder in which you want to author your XSDCONFIG file, then click New -> Other File Types.
   2. In the New File dialog, click XML File, give the file a name with an XSDCONFIG extension, then click Create.
3. Replace the contents of the new XML file with code such as in the following example:

   >     <!-- An xsdconfig file must begin with a "config" element in the
   >             http://www.bea.com/2002/09/xbean/config namespace. Also, be sure
   >             to declare any namespaces used to qualify types in your schema (here,
   >             the namespace corresponding to the pol prefix. -->
   >     <xb:config xmlns:pol="http://openuri.org/easypoLocal"
   >         xmlns:xb="http://www.bea.com/2002/09/xbean/config">

   >         <!-- Use the "namespace" element to map a namespace to the Java package
   >             name that should be generated. -->
   >         <xb:namespace uri="http://openuri.org/easypoLocal">
   >             <xb:package>org.openuri.easypo.xsdconfig</xb:package>
   >         </xb:namespace>

   >         <!-- Use the "qname" element to map schema type names to generated
   >             Java type names. In these examples, the name attribute's value is the
   >             XML element name; the javaname attribute's value is the Java type
   >             that should be generated. -->
   >         <xb:qname name="pol:CUST" javaname="Customer"/>
   >         <xb:qname name="pol:PURCH_ORDER" javaname="PurchaseOrder"/>
   >     </xb:config>

4. Put the finished XSDCONFIG file into the schema project with the XSD file containing your schema.

   When you build the schema project, the compiler will use the XSDCONFIG file to define names for generated Java types.

## Related Topics

Getting Started with XMLBeans

How Do I: Use XML Schema in WebLogic Workshop