![]() |
![]() |
|
|
Working with XML Entities
The following sections explain how to use the Studio to retrieve, compose and save XML entities:
Overview of XML Document Management Tasks
Several workflow actions contain a built-in XML editor you can use to create, edit, and export free-form and type-specified XML documents that are embedded in workflows. The XML Finder helps you locate XML entities from various sources and save them using different to types of storage. Tasks related to managing the content and storage of XML documents are described below.
Alternatively, import previously exported XML entities from existing workflow packages. For details, see the procedures in Importing Workflow Packages.
Note: You may also want to familiarize yourself with the workflow expression language and the Studio's Expression Builder tool before beginning to define XML documents, since the dialog boxes in which you can create XML documents require that you enter XML element values as expressions. Complete information on workflow expressions is available in Using Workflow Expressions.
Composing and Editing XML Documents
The following action dialog boxes contain a built-in XML editor that you can use to compose, import, and edit well-formed XML documents which are saved within the workflow template definition:
Figure 7-1 XML Editor in Action Dialog Boxes
The XML editor presents XML documents in a tree structure consisting of nodes comprising the following standard XML markup:
The left pane displays metadata, such as element and attribute tags, and the right pane displays the actual data values for each tag.
The documents you create and edit in Studio dialog boxes are actually XML document templates that are used to generate XML document instances at run time. This means that you can use workflow expressions for elements and attributes to generate values at run time, and you can invoke the Expression Builder from one of these nodes to help you construct your expression. Element and attribute data must be formulated in workflow expression syntax, so all strings must be enclosed in quotation marks. If the value you enter is not a valid workflow expression, for example, a string not surrounded by quotation marks, or a backslash not preceded by an escape character, the
icon appears in front of it. For information on the workflow expression language, and on using the Expression Builder, see Using Workflow Expressions.
You can create new documents and edit existing ones in two modes: free-form mode and content-type mode. In free-form mode, you simply compose and edit the document with no validation against a content type. Use free-form mode when you want to generate well-formed XML documents that do not need to conform to a specific content type. More information about creating free-form XML documents is provided in Creating Free-Form Documents.
In content-type mode, you specify the content type for a new or existing document by loading an existing external Schema document against which the document is validated. You can check the validity of the document as often as you like during the composing or editing process. Complete information about working with content-type-specified documents is provided in Working with Type-Specified Documents.
You can also import existing free-form and type-specified documents from the repository or a file on disk (see Importing Existing Documents), and add a content type to an existing document (see Setting a New Content Type for Existing Documents).
Finally, you can export document templates created or edited in the Studio to the repository or a file on disk. For more information on exporting XML documents from action dialog boxes, see Exporting XML Entities.
Dialog boxes that allow you to work with XML documents include a toolbar described in the following table. Specific procedures for creating, importing, editing, and setting the content type for XML documents are provided in the following sections.
Table 7-1 XML Editor Toolbar Buttons and Keyboard Shortcuts
Creating Free-Form Documents
To create a free-form document:
Importing Existing Documents
You can import both free-form and content-type-specified XML documents that you have created and exported from the Studio's XML editor or created by any other method. For information about importing type-specified documents, see About Importing Type-Specified Documents.
When you import an existing XML document into a workflow, the XML editor distinguishes between two kinds of XML documents:
Workflow XML document templates created and exported from the Studio contain element and attribute string values enclosed in quotation marks, while other document instances usually do not. Thus, for XML documents not created in a Studio action dialog box, you will be prompted to convert the document to an XML template. The conversion process inserts quotation marks around all element and attribute values where necessary, so that you do not have to do so.
Note: The Studio does not recognize XML documents exported from previous versions of WebLogic Process Integrator as document templates, so you will still be prompted to convert the these XML documents. To prevent the XML editor from inserting an additional set of quotation marks, do not convert the imported document.
To import an existing free-form or type-specified XML document:
Figure 7-2 Enclose Values in Double Quotes Dialog Box
The document is imported into the editor.
Editing XML Documents
The following procedures are generalized for new or imported free-form or content-type-specified documents. For additional procedures on type-specified documents, see Working with Type-Specified Documents.
Table 7-2 Editing XML Documents
Working with Type-Specified Documents
You can create an XML document based on an existing external Schema. Internal DTD declarations are not supported.
You can also import an existing document based on a Schema, and you can set the content type for a document already loaded into the XML editor.
About Storing Referenced Schemas
Because theWebLogic Integration server needs to be able to access a Schema document associated with the XML document template at run time to create an XML document instance, Schemas to be referenced by Studio XML documents must exist as XSD files in a location that can be accessed by a URL, or as entities in the repository.
Warning: Keep in mind that if the URL points to a location not on the same machine as the WebLogic Integration server, there is always a risk that the system referenced by the URL may not be available at run time when the process engine generates the XML document instance. In such an occurrence, server exceptions will result. You should take care to store your XSD files in locations that can be reliably accessed at run time, such as on the file system of the WebLogic Integration server. Also ensure that the URLs you use remain valid at run time and point to the correct location of the required resources.
You may find that storing Schema resources in the repository is a convenient way to retrieve commonly accessed documents. For procedures on importing resources into the repository, see Managing Entities in the Repository.
On the other hand, you should also keep in mind that if you are planning to export newly created documents, or re-export imported documents, references to Schemas held in the repository are only identified by the entity name in the content type declaration, and will not be resolved by third-party XML parsers. Thus, you will want to ensure that your XSDs are placed in an appropriate location depending on whether an exported XML document will be used outside of WebLogic Integration or not. If they are to be used outside of WebLogic Integration, we recommend storing resources on a disk file and accessing them via URLs. If they are not going to be used outside WebLogic Integration, we recommend storing resources in the XML repository.
About Importing Type-Specified Documents
You can import an existing document that contains a document type declaration to an external Schema document, but not to an internal one. However, you must ensure that the referenced Schema is available for the WebLogic Integration server to access at design time, and that the document type declaration uses a valid URL to specify the document location. If the declaration only includes the name of the document, but not the full location, the WebLogic Integration server will not be able to resolve the reference, and the document cannot be imported.
Another option is to store referenced Schema resources in the XML repository. In this case, you may simply specify the name of the repository entity in the document type declaration, and the WebLogic Integration server will resolve the reference. For procedures on importing resources into the repository, see Managing Entities in the Repository.
If you are planning to re-export the document you have imported, the run-time considerations mentioned above also apply.
For procedures for importing type-specified documents, see Importing Existing Documents.
Creating Type-Specified Documents
When you create a new XML document based on a Schema, the XML editor creates a default document consisting of the following:
To create a new type-specified document:
Figure 7-3 Generate Default Document Dialog Box
Figure 7-4 Select Root Element Dialog Box
Setting a New Content Type for Existing Documents
You can apply a content type definition to a document after you have created it or to an existing document after import. You can also remove a content type from a type-specified document, or change the content type for a new or existing type-specified document.
To apply a content type definition to a free-form document:
Figure 7-5 Generate Default Document Dialog Box
To remove a content type definition from a type-specified document:
To change the content type for a type-specified document:
Validating Type-Specified Documents
While composing or editing a new or imported type-specified documents, you can view the content of an Schema document set as the current content type, and you can take advantage of the Studio validation feature that allows you to view the source of errors and edit them simultaneously.
To view the content of the associated Schema:
Figure 7-6 Content Type Definition Window
To validate a new or imported type-specified document against the content type definition:
Figure 7-7 Validation Errors Dialog Box
Using the XML Finder to Retrieve and Export XML Entities
The XML Finder dialog box allows you to retrieve from and save XML entities to the repository, the local file system, or a URL. The dialog box also maintains a list of the XML entities you used most recently, so you do not have to search for them if you want to use them again.
XML entities can be XML documents, Document Type Definitions (DTD), Schema documents (XSD), Message Language Format (MFL) files, and Extensible Stylesheet Language (XSL) template documents.
You can access the XML Finder several ways. Different operations are available depending on the way you access the XML Finder, and whether you are retrieving or saving a document. These topics are described in the following sections.
Retrieving XML Entities
You can retrieve and load XML entities into the following dialog boxes:
Retrieving the Most Recently Used XML Entities
The XML Finder maintains a list of the XML entities you used most recently on your workstation. You can re-use the entities in the list without having to search for them again.
To retrieve an entity from the most recently used list:
Note: The Recent tab is unavailable from the XSL Transform dialog box, and from dialog boxes where you can open a Schema document, because these actions create an XML document instance at run time. Specifying a recent entity is not appropriate in these cases because the process engine cannot access the file at run time.
Figure 7-8 XML Finder: Recent Tab
Retrieving from the Repository
To retrieve an entity from the repository:
Figure 7-9 XML Finder: Repository Tab
Retrieving from the File System
You can retrieve content from a file on a local disk drive or any network drive mapped to the local machine.
To retrieve an entity from the local file system:
Note: The File tab is unavailable from the XSL Transform dialog box, and from dialog boxes where you can open a Schema document, because these actions create an XML document instance at run time. Specifying a file on the local file system is not appropriate in these cases because the process engine cannot access the local file system at run time.
Figure 7-10 XML Finder: File Tab
Retrieving from a URL
You can use a URL to specify a location on a local machine, remote machine on a network, or other external systems. Remote locations must be mapped to a drive on the local machine.
To retrieve an entity from a URL:
Figure 7-11 XML Finder: URL Tab
Exporting XML Entities
You can save XML documents created within the Studio from the following dialog boxes:
Documents exported from action dialog boxes are formatted with the standard XML escape sequences (") representing quotation marks around element and attribute values. For content-type-specified documents, a prolog including the DOCTYPE and an epilog indicating the validity are also inserted.
Exporting to the Repository
When you export an XML document template from an action dialog box to the repository, the entry is created in two steps. First, an empty entity is created. Then, the entity is populated with the content of the document template. For this reason, it is not possible to preview the document until after it has actually been populated with content, which occurs when you exit the XML Finder.
To save an entity from an Action dialog box to the repository:
Figure 7-12 Add Entity Dialog Box
Exporting to the File System
From action dialog boxes, you can save the XML documents you create or edit as .xml files on a local disk drive or any remote drive mapped on the local machine.
To save an entity to a file on disk:
Figure 7-13 XML Finder: File Tab
Exporting to a Recently Accessed File
You can only use the Recent tab to export to and overwrite an already existing file.
To save an entity to a recently accessed file:
Exporting to a File Located by a URL
You can only use the URL tab to export to and overwrite an already existing file that can be located by a URL.
To save an entity to an existing file located by a URL:
![]() |
![]() |
![]() |
|
Copyright © 2001 BEA Systems, Inc. All rights reserved.
|