Skip Headers

Oracle TopLink Developer's Guide 10g Release 3 (10.1.3) B13593-01 |
| Home | Solution Area | Contents | Index

Previous | Next |

# Configuring for Complex Type of anyType

This attribute applies only to TopLink Workbench. Use this option to solve "No schema context is specified" problems (see "Using the Problems Window") for an XML descriptor that does not represent an element in your XML schema.

In general, TopLink Workbench assumes that every XML descriptor must have a schema context (see "Configuring Schema Context for an XML Descriptor"). However, if a class in your project does not relate to an element in your schema, then it does not have a schema context.

For example, consider the schema that Example 32-2 shows.

Example 32-2 Schema Using xsd:anyType

    <?xml version="1.0" encoding="UTF-8"?>
    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
        <xsd:element name="customer" type="customer-type"/>
        <xsd:complexType name="customer-type">
            <xsd:sequence>
                <xsd:element name="contact-method" type="xsd:anyType"/>
            </xsd:sequence>
        </xsd:complexType>
        <xsd:element name="address">
            <xsd:complexType>
                <xsd:sequence>
                    <xsd:element name="street" type="xsd:string"/>
                    <xsd:element name="city" type="xsd:string"/>
                </xsd:sequence>
            </xsd:complexType>
        </xsd:element>
        <xsd:element name="phone-number" type="xsd:string"/>
    </xsd:schema>

Because element `contact-method` is of type `xsd:anyType`, your project requires a class to represent that type, such as class `AnyTypeImpl` shown in Figure 32-3. Because this class does not relate to any complex type in your schema, it has no schema context. In this example, you would select this option for the `AnyTypeImpl` class.

Figure 32-3 Class Representing xsd:anyType

Description of "Figure 32-3 Class Representing xsd:anyType"

Note: See also "Configuring Maps to Wildcard".

For more information, see "xs:any and xs:anyType Support".

## Using TopLink Workbench

Complex Type of anyType Option

To specify that the descriptor represents a complex type of `anyType`, use this procedure:

1. Select a descriptor in the Navigator. Its properties appear in the Editor.

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

   Figure 32-4 Descriptor Info Tab, Descriptor Represents Complex Type "anyType" Option

   Description of "Figure 32-4 Descriptor Info Tab, Descriptor Represents Complex Type "anyType" Option"

Select the Descriptor Represents Complex Type "anyType" option to specify this descriptor as the root element.