Using Custom URI Resolvers

Stylus Studio supports several URI types, such as http://, file://, and ftp://. If you use the DataDirect XQuery processor to process your XQuery, you can also create custom URI resolvers that allow the DataDirect processor to recognize custom URI types. Custom URI resolvers can be created for use with DataDirect XQuery doc and collection functions, and import module statements.

The process for using custom URI resolvers in Stylus Studio involves:

1. Using the DataDirect XQuery and Java APIs to implement a Java interface for each of the custom URI resolver types you intend to use.
2. Registering the Java class for each custom URI resolver with Stylus Studio. You can do this on a per-XQuery basis using the XQuery Scenario Properties dialog box, or as a default setting for all XQuery code you write in Stylus Studio using the Processor Settings page of the Options dialog box.

Implementing a Custom URI Resolver Interface

You use either the DataDirect XQuery API or the Java API to implement a custom URI resolver interface, as summarized in the following table.

For more information on implementing a custom URI resolver interface, see the DataDirect XQuery User's Guide and Reference.

Registering a Custom URI Resolver

Use this procedure to register a custom URI resolver for an individual XQuery.

To register a custom URI resolver for an XQuery:
1. Open the XQuery for which you want to register a custom URI resolver in the Stylus Studio XQuery Editor.
2. Click the Edit scenario properties button ( .
The Scenario Properties dialog box appears.
3. Click the Processor tab.
4. If DataDirect XQuery is not specified as the processor, use the Processor drop-down field to change it.
5. Click the Settings button.
The DataDirect XQuery Options dialog box appears.
6. Click the more button ( ) for the custom URI resolver type you want to register.
The Java Class Browser dialog box appears.
7. Navigate the available folders to locate the file that implements the interface for the type of custom URI resolver you are registering.
8. Click OK to register the custom URI resolver.
9. Click OK to close the Scenario Properties dialog box.

Registering a Default Custom URI Resolver

Use this procedure when you want to register a custom URI resolver that will be used by default for all XQuery code you create in Stylus Studio. You can always override the default setting for individual XQuery.

To register a default custom URI resolver:
1. In Stylus Studio, click Tools > Options on the menu bar.
The Options dialog box appears.
2. Navigate to the Module Settings > XQuery > Processor Settings folder.
 
Free Stylus Studio XML Training: