Skip navigation.
Downloads | Product Documentation | Support

Data Services Developer's Guide

# Using Source View

This chapter describes BEA Aqualogic Data Services Platform (DSP) Source View. It includes the following topics:

- What is Source View?
- Using Source View

# What is Source View?

The underlying XQuery source of a data service typically:

- References a schema as the data service's XML type
- Defines one or several read functions and, optionally, one or several relationship functions
- Declares namespaces for referenced services
- Contains various pragma directives to the XQuery engine

In addition, data services created from physical data sources contain metadata related to the physical sources. For example, data services based on relational data describe the XML field type (such as xs:string), the xpath, native size, native type, nullability setting and so forth.

In developing data services there are many occasions when it is more convenient or necessary to modifying source.

There are times when it may be preferable to develop or troubleshoot data services by working directly in source. The Source View tab allows you to directly edit data service source code, as well as schemas. Changes to source are immediately reflected in other data service modes such as the XQuery Editor; similarly, source is immediately updated when changes are made through the XQuery Editor View or Design View.

## XQuery Support

Data Services Platform supports the XQuery language as specified in XQuery 1.0: An XML Query Language, W3C Working Draft of July, 23, 2004. You can use any feature of the language described by the specification.

DSP supplements the base XQuery syntax with a set of elements and directives that appear in the source view as pragmas. Pragmas are a standard XQuery feature that give implementors and vendors a way to include custom elements and directives within XQuery code.

The BEA implementation of XQuery also contains some extensions to the language and additional functions. BEA extensions to XQuery and links to W3C documentation are described in the Data Services Platform XQuery Developer's Guide.

Figure 8-1 Source View Showing Pragmas, Namespace Declarations, and a Function

# Using Source View

You can view a file in Source View by clicking the Source View tab. To open Source View to a particular query function, first select the function from Design View or XQuery Editor View, then click the Source View tab.

## Finding Text

You can search for specific text strings in Source View using is open you can access file search using WebLogic Workshop's Edit —> Find command option or <Ctrl-f>. Complete search and replace facilities are available including specifying case, whole words only, wildcard search patterns, and limited search. You also have the option to mark all occurrences of found strings.

Found items are highlighted in yellow. This makes it easy to trace the use of variables, for example.

Figure 8-2 Source View Search Dialog Box

## Code Editing Features

WebLogic Workshop contains a rich code editing environment.

### Color Coding

XQuery documents in Source View are color-coded to highlight the various elements of the source code. By default keywords are blue and bold, comments (including pragmas) are colored grey, and variables are colored magenta.

Figure 8-3 Color Coding in Source View

You can customize color coding through the Preferences dialog (Tools —> Preferences).

### Code Auto Complete

When working with Source View you can use WebLogic Workshop auto-complete facilities to complete Xpath expressions. To do this:

1. Position your cursor at the end of the existing path expression.
2. Press the key combination of Ctrl-Space.
3. Select the appropriate element from the pop-up list (Figure 8-4).

Figure 8-4 XPath Code Completion in Source View

### Error Identification

Syntax errors that occur in source either as a result of editing or as a result of changes made in the XQuery Editor are flagged on Source View scroll bar (Figure 8-5). Clicking on the error mark takes the cursor to that line of code.

The actual code in question is underlined in red. Mouse-over the text to see the complete error message.

For additional information on editing the WebLogic Workshop properties configuration file see:

http://e-docs.bea.com/workshop/docs70/help/reference/configfiles/conWorkshop_propertiesConfigurationFile.html

Figure 8-5 Syntax Errors Are Flagged and Mouse-over Text Provides Details

If you would like Source View to provide code completion and error highlighting for additional classes, edit the Workshop.properties file to add class files or JAR files to the paths.classPath property, then restart WebLogic Workshop.