Working
with XMetaL Customizations
What
is a Customization?
Let's recall
what we learned about XMetaL customizations in Lesson 1:
- An XMetaL
customization is an instance of what Visual Studio .NET calls a "Solution".
- Customizations are
logical containers for projects, project files, and project-independent files
saved in the Solution Items folder within Visual Studio .NET.
In XML terms,
a customization is a schema-based configuration of XMetaL that helps create a
user-friendly authoring workflow. By schema-based, we mean that customizations
are based either upon a DTD or an XML Schema (XSD) file.
To view or
create XMetaL customizations, you work within the VS .NET environment. You can
see objects associated with the customization in the Solution Explorer window.
When you click
on an object in the Solution Explorer window, you'll see the object's
properties listed in the Properties window below.
In this
lesson, we'll learn how to perform some common activities with existing
customizations.
This lesson
will take about 20 minutes to complete.
Opening
an Existing Customization
Let's walk
through opening an existing customization, and learn how to make a few changes
to it.
Remember that
XMetaL customizations are stored in Visual Studio .NET Solution files, which
have a ".sln" suffix. SLN files are really a set of pointers to the various
files that make up a customization.
- In Visual Studio
.NET, choose File>Open Solution.
- Find the directory
in which XMetal is installed, go to Developer>Samples>MiniJournalist, and
open the file called MiniJournalist.sln.
You'll see a
screen similar to the one below:
Customization Objects: The CSS File
Let's take a
closer look at the MiniJournalist customization.
In the
Solution Explorer window, you'll see one project, called MiniJournalist. Open
this project by double-clicking it, and you'll see several files (or "objects")
within it.
Select the
first object, called "MiniJournalist.css". The XMetaL icon for Cascading Style
Sheet (CSS) files is a picture of a paintbrush, reflecting the fact that CSS
files are used mainly to set up the visual look & feel of a
customization.
Notice that
when you single-click an object in the Solution Explorer, its file properties
are displayed in the Properties window below.
Now
double-click on "MiniJournalist.css". A form opens in the Developer workspace,
allowing you to see and change the properties of the CSS file if you wish. Try
clicking some of the tabs, and you'll see how easy it is to edit CSS files
within XMetaL Developer.
Customization Objects: The CTM File
Now click on
the object called, "MiniJournalist.ctm". Again, you'll see file properties for
this customization file in the Properties window.
MiniJournalist.ctm
is a Customization (CTM) file. CTM files are valid XML documents that contain a
set of instructions describing the appearance and behaviour of your
customization.
If you
double-click on MiniJournalist.ctm, you'll see a form showing the elements of
the CTM file in the XMetaL Developer window. In later lessons, we'll learn how
to tailor this file to suit the needs of your implementation.
Customization Objects: The DTD File
Now
double-click the object in the project called, "MiniJournalist.dtd". The
elements of the MiniJournalist DTD file will be listed in the XMetaL Developer
window. If you are familiar with XML, you'll know that a DTD file defines
elements used in XML files.
Double-click
on the "graphic" element in the MiniJournalist DTD. You'll see the attributes
of this element displayed in the Properties window.
Every
customization must include either a DTD file or an XML schema (XSD) file.
Valid
Customization Objects
A
customization can include almost any type of file. However, not all proprietary
filetypes will deploy correctly. Here is a list of the most useful types of
objects you may want to include in your projects:
- DTD or XSD - an
XML or SGML Document Type Definition or XML Schema file.
- RLX, RLS or RLD -
compiled rules files associated with the DTD or Schema.
- Script files.
- MCR - a Macro file
is a valid XML document that contains scripts (macros) to be executed as a part
of your customization.
- CTM - a
Customization File (CTM) is a valid XML document that identifies customization
objects.
- CSS - a cascading
style sheet.
- XFT - the XMetaL
Forms Toolkit (XFT) is a set of form creation and form layout tools that
developers can use to design and implement embedded forms and modal dialog
boxes quickly and easily. Files with an .xft suffix were created with this
toolkit.
- Structure View CSS
- a CSS file that defines the look and feel of the DTD structure for the XMetal
Author Structure View. This view helps content developers better understand the
structure of their documents, and serves as an outline view. If you don't
create a Structure View CSS, XMetal will create one for you, based on the DTD.
- DLL - a Dynamic
Link Library (DLL) is a collection of small programs or device drivers that can
be called upon by a larger program without having to reside in RAM.
- XML Template.
Adding
an Object to an Existing Customization
Now let's add
an object to our customization.
- In Visual Studio
.NET, right-click the MiniJournalist solution name.
- Click
Add>Add New Item...
- Name your new item
"WebForm.XFT".
- Double-click the
XFT Form icon.
- Click
Open.
- Click
OK to the scripting language.
You should see
the object "WebForm.XFT" added to your customization in the Solution Explorer
window.
Now
double-click on WebForm.xft. The XMetaL Form Layout tool appears, displaying a
blank form layout on which you can design an XML form.
NOTE: Items you've added to a project,
although they appear in the Solution Explorer, may not reside physically in
your solution folder. These are considered source files, and may exist in
another folder, or even on another system. The only files that truly form a
part of your customization are output files from the build process. We'll learn
how to "build" a customization in later lessons.
Go ahead and
play with the XFT tools, but don't try to create a complete form just yet. In
upcoming lessons, we'll learn how to create valid XML forms using the XMetaL
Form Layout Tool.
Moving
between Customization Objects
By now you
should have at least three files open in the XMetaL Developer workspace. If you
look at the top of the working area, just below the menu bars, you'll see a set
of tabs, one for each open document.
Click each of
the tabs in turn to move between XMetaL customization objects. See how the
integrated development environment puts a variety of different project
filetypes at your fingertips?
Now close all
the files in turn.
Removing
a Customization Object
XMetaL Developer allows you to remove objects from a customization. Removing
objects does not delete them. You can remove objects from one project and add
them to another, or remove them temporarily and add them back later.
You can also
delete an object, which will both remove the object from your customization and
delete it from its physical location on disk.
To remove an
object from a customization:
- Right-click the
object.
- From the pop-up
menu, choose Remove.
Saving
a Customization
Although you
will be prompted any time you exit VS .NET to save any changes, it's always
best practice to save frequently.
You can save
the object that's currently open by choosing Edit>Save [objectname], or
Edit>Save [objectname]
as.
To save the
whole project, select the project in the Solution Explorer window and choose
File>Save [projectname], or
File>Save [projectname] as.
To save the
whole project, including build output, choose File>Save All.
Go on to the next lesson: Building an XMetaL
Customization...
Last modified: Thursday, May 20, 2004 12:53:49 PM