Skip Headers
Oracle TopLink Developer's Guide
10g Release 3 (10.1.3)
B13593-01
  Go To Documentation Library
Home
Go To Product List
Solution Area
Go To Table Of Contents
Contents
Go To Index
Index

Previous
Previous
Next
Next
 

Configuring Schema Context for an XML Descriptor

TopLink Workbench uses the schema context to associate the XML descriptor reference class with a simple or complex type in one of the schemas associated with the XML project (see "Configuring XML Schema Reference"). This allows TopLink Workbench to display the appropriate attributes available for mapping in that context.

You must configure the schema context for an XML descriptor regardless of whether or not you are using TopLink Workbench.

The TopLink runtime uses the schema context to validate XML fragments.

Using TopLink Workbench

To associate an XML descriptor with a specific schema complex type, use this procedure:

  1. Select an XML descriptor in the Navigator. Its properties appear in the Editor.

  2. Click the Descriptor Info tab. The Descriptor Info tab appears.

    Figure 32-1 Descriptor Info Tab, Schema Context Option

    Description of Figure 32-1  follows
    Description of "Figure 32-1 Descriptor Info Tab, Schema Context Option"

Click Browse to select the schema element to associate with this descriptor. For more information, see "Choosing a Schema Context".

Choosing a Schema Context

Use the Choose Schema Context dialog box to select a specific schema element (such as when mapping an element).

Figure 32-2 Choose Schema Context Dialog Box

Choose a Schema Context

Select a schema element and click OK.

Using Java

To configure an XML descriptor with a schema context using Java, create a descriptor amendment method (see "Configuring Amendment Methods") that uses XMLSchemaReference method setSchemaContext, as Example 32-1 shows.

Example 32-1 Configuring Schema Context

public void addToDescriptor(ClassDescriptor descriptor) {
    descriptor.getSchemaReference().setSchemaContext(xPath);
}