User Manual and Programmers' Reference
User Manual and Programmers' Reference
All rights reserved. No parts of this work may be reproduced in any form or by any means
- graphic, electronic, or mechanical, including photocopying, recording, taping, or
information storage and retrieval systems - without the written permission of the publisher.
Products that are referred to in this document may be either trademarks and/or registered
trademarks of the respective owners. The publisher and the author make no claim to
these trademarks.
While every precaution has been taken in the preparation of this document, the publisher
and the author assume no responsibility for errors or omissions, or for damages resulting
from the use of information contained in this document or from the use of programs and
source code that may accompany it. In no event shall the publisher and the author be
liable for any loss of profit or any other commercial damage caused or alleged to have
been caused directly or indirectly by this document.
Published: 2010
Welcome to XMLSpy 3
User Manual 6
1 New Features 8
2 Introduction 9
2.1 .........................................................................................................................................10
The Graphical User Interface (GUI)
2.1.1 Main Window ............................................................................................................................11
2.1.2 Project Window............................................................................................................................12
2.1.3 Info Window ............................................................................................................................14
2.1.4 Entry Helpers ............................................................................................................................14
2.1.5 Output Window:............................................................................................................................15
Messages
2.1.6 Output Window:............................................................................................................................16
XPath
2.1.7 Output Window:............................................................................................................................21
XSL Outline
2.1.8 Output Window:............................................................................................................................21
Find in Files
2.1.9 Output Window:............................................................................................................................23
Find in Schemas
2.1.10 Output Window:............................................................................................................................23
Find in XBRL
2.1.11 Output Window:............................................................................................................................24
Charts
2.1.12 Menu Bar, ............................................................................................................................26
Toolbars, Status Bar
2.2 .........................................................................................................................................28
The Application Environment
2.2.1 Settings, ............................................................................................................................28
Customization, and Menus
2.2.2 Tutorials,............................................................................................................................30
Projects, Examples
2.2.3 XMLSpy............................................................................................................................30
Features and Help, and Altova Products
3 XMLSpy Tutorial 32
3.1 XMLSpy .........................................................................................................................................33
Interface
3.2 .........................................................................................................................................34
XML Schemas: Basics
3.2.1 Creating ............................................................................................................................34
a New XML Schema File
3.2.2 Defining............................................................................................................................37
Namespaces
3.2.3 Defining............................................................................................................................38
a Content Model
4 Editing Views 96
4.1 Text View.........................................................................................................................................97
4.1.1 Formatting ............................................................................................................................97
in Text View
4.1.2 Displaying ............................................................................................................................99
the Document
4.1.3 Editing ............................................................................................................................102
in Text View
4.1.4 Entry Helpers
............................................................................................................................104
in Text View
4.2 .........................................................................................................................................106
Grid View
4.2.1 Editing ............................................................................................................................107
in Grid View
4.2.2 Grid View ............................................................................................................................108
Tables
4.2.3 Entry Helpers
............................................................................................................................112
in Grid View
4.3 .........................................................................................................................................114
Schema View
4.3.1 Schema............................................................................................................................114
Overview
4.3.2 Content............................................................................................................................118
Model View
4.3.3 Entry Helpers
............................................................................................................................129
in Schema View
4.3.4 Identity............................................................................................................................132
Constraints
4.3.5 Smart Restrictions
............................................................................................................................136
5 XML 179
5.1 Creating,.........................................................................................................................................180
Opening, and Saving XML Documents
5.2 .........................................................................................................................................182
Assigning Schemas and Validating
5.3 .........................................................................................................................................184
Editing XML in Text View
5.4 .........................................................................................................................................186
Editing XML in Grid View
5.5 .........................................................................................................................................189
Editing XML in Authentic View
5.6 .........................................................................................................................................191
Entry Helpers for XML Documents
5.7 .........................................................................................................................................193
Processing with XSLT and XQuery
5.8 Charts .........................................................................................................................................195
5.8.1 Creating............................................................................................................................196
a Chart
5.8.2 Source XPath............................................................................................................................200
5.8.3 X-Axis ............................................................................................................................203
Selection
5.8.4 Y-Axis ............................................................................................................................207
Selection
5.8.5 Chart Data ............................................................................................................................211
5.8.6 Chart Type ............................................................................................................................212
5.8.7 Chart Appearance
............................................................................................................................213
5.8.8 Export ............................................................................................................................214
5.8.9 Chart Example:
............................................................................................................................215
Simple
5.8.10 Chart Example:
............................................................................................................................217
Advanced
5.9 .........................................................................................................................................224
Additional Features
8 Authentic 324
8.1 .........................................................................................................................................326
Authentic View Tutorial
8.1.1 Opening............................................................................................................................327
an XML Document in Authentic View
8.1.2 The Authentic
............................................................................................................................328
View Interface
8.1.3 Node Operations
............................................................................................................................330
8.1.4 Entering............................................................................................................................333
Data in Authentic View
8.1.5 Entering............................................................................................................................335
Attribute Values
8.1.6 Adding ............................................................................................................................335
Entities
8.1.7 Printing............................................................................................................................336
the Document
8.2 .........................................................................................................................................338
Editing in Authentic View
8.2.1 Basic Editing
............................................................................................................................338
8.2.2 Tables in ............................................................................................................................341
Authentic View
– SPS Tables............................................................................................................................ 341
– XML............................................................................................................................
Tables 342
............................................................................................................................
– XML Table Editing Icons 345
8.2.3 Editing ............................................................................................................................347
a DB
............................................................................................................................
– Navigating a DB Table 348
............................................................................................................................ 348
– DB Queries
............................................................................................................................
– Modifying a DB Table 352
8.2.4 Working ............................................................................................................................353
with Dates
– Date ............................................................................................................................
Picker 354
– Text Entry............................................................................................................................ 354
8.2.5 Defining............................................................................................................................355
Entities
8.2.6 Images ............................................................................................................................356
in Authentic View
8.2.7 Keystrokes ............................................................................................................................357
in Authentic View
8.3 .........................................................................................................................................358
Authentic Scripting
11 XBRL 392
11.1 .........................................................................................................................................393
Taxonomies: New and Existing
11.2 Taxonomy.........................................................................................................................................394
Files Overview
11.3 .........................................................................................................................................396
Creating a New Taxonomy
11.4 .........................................................................................................................................401
Namespaces in the Taxonomy
11.5 .........................................................................................................................................403
Importing a Taxonomy
11.6 .........................................................................................................................................405
Setting Up the Taxonomy Files
11.7 .........................................................................................................................................408
Adding Elements to a Taxonomy
11.8 .........................................................................................................................................412
Relationships and Linkroles
11.9 Creating.........................................................................................................................................414
Relationships: Part 1
11.10 Creating.........................................................................................................................................417
Relationships: Part 2
11.11 .........................................................................................................................................420
Find in XBRL
11.11.1 Search Term
............................................................................................................................420
11.11.2 Command ............................................................................................................................422
Execution
11.11.3 Results ............................................................................................................................424
and Information
15 Projects 459
15.1 Creating.........................................................................................................................................460
and Editing Projects
.........................................................................................................................................463
15.2 Using Projects
2 Scripting 847
2.1 .........................................................................................................................................849
Overview
2.1.1 Scripting ............................................................................................................................849
Projects in XMLSpy
2.1.2 The Scripting
............................................................................................................................851
Editor GUI
2.1.3 Components ............................................................................................................................854
of a Scripting Project
2.2 Creating.........................................................................................................................................856
a Scripting Project
2.3 .........................................................................................................................................857
Global Declarations
2.4 Forms .........................................................................................................................................859
2.4.1 Creating............................................................................................................................859
a New Form
2.4.2 Form Design ............................................................................................................................860
and Form Objects
2.4.3 Form Events ............................................................................................................................862
2.5 Events .........................................................................................................................................865
2.6 Macros .........................................................................................................................................868
2.6.1 Creating............................................................................................................................868
and Editing a Macro
2.6.2 Running............................................................................................................................869
a Macro
2.6.3 Debugging ............................................................................................................................871
a Macro
2.7 .........................................................................................................................................872
Programming Points
2.7.1 Built-in............................................................................................................................872
Commands
– Form............................................................................................................................
usage and commands 874
2.8 .........................................................................................................................................876
Migrating to Scripting Editor 2010 and Later
3 Plugins 879
3.1 .........................................................................................................................................880
Registration of IDE PlugIns
3.2 ActiveX.........................................................................................................................................881
Controls
3.3 .........................................................................................................................................882
Configuration XML
3.4 .........................................................................................................................................885
ATL sample files
Appendices 1282
Index 1369
Welcome to XMLSpy
3
Welcome to XMLSpy
Altova XMLSpy® 2011 Enterprise Edition is the industry standard XML Development
Environment for designing, editing and debugging enterprise-class applications involving XML,
XML Schema, XSLT, XQuery, SOAP, WSDL and Web service technologies. It is the ultimate
productivity enhancer for J2EE, .NET and database developers. XMLSpy is available in 64-bit
and 32-bit versions.
User Manual
6
User Manual
The User Manual part of this documentation contains all the information you need to get started
using XMLSpy and to learn the various XMLSpy features. It is organized into four broad parts:
(i) an Introduction; (ii) a Tutorial; (iii) a Working With part; and (iv) a User Reference.
We suggest that you start by reading the Introduction in order to get a feel for the GUI and to
understand key application settings. If you are new to XML, the XMLSpy tutorial will help you not
only to get to know XMLSpy but also to easily create and use your first XML documents. After
that, you should read the Editing Views section and then the sections in the Working With part
that are of most interest to you. The User Reference part can be used thereafter as a reference.
Introduction
The introduction describes the GUI, important settings in the Options dialog, and the application
environment.
Tutorial
The XMLSpy tutorial helps you get started and shows you how to use the most common
XMLSpy features.
Working With
The Working With part of the documentation describes the functionality that XMLSpy offers for
working with various XML and XML-related technologies. It starts with a description of XMLSpy
's multiple editing views. The sections that immediately follow explain the functionality for each
technology separately. The Working With part concludes with a series of descriptions of
application-wide XMLSpy features, such as Altova Global Resources and projects. The sections
in the Working With part are:
Editing Views: Describes the various editing views in XMLSpy
XML: Explains the various features available for working with XML documents in
XMLSpy
DTDs and XML Schemas: Shows how schemas (DTDs and XML Schemas) can be
edited and leveraged in XMLSpy
XSLT and XQuery: Presents the range of features available for XSLT and XQuery
development
Authentic: Explains the utility of Altova's graphical XML editor, and shows how it is used
HTML, CSS, and JSON: Explores XMLSpy's support for HTML, CSS, and JSON
WSDL and SOAP: Describes XMLSpy's mechanisms for working with these protocols
XBRL: Describes how to work with the Taxonomy Editor in the XBRL View of XMLSpy
Office Open XML and ZIP files: Presents and explains Archive View, in which
documents using these standards can be edited and managed
Databases: Explores the wide range of features XMLSpy offers for interfacing XML with
databases
Global Resources: Describes a unique Altova mechanism that can be used to boost
development efficiency when using Altova products, especially as a suite of products
Projects: Explains XMLSpy's project mechanism, which enables increased efficiency
and additional development options
File/Directory Comparisons: Presents XMLSpy's inbuilt comparison engine
XMLSpy in Visual Studio: Describes integration in the Visual Studio developer platform
XMLSpy in Eclipse: Describes integration in the Eclipse developer platform
Code Generator: Explains the working of the built-in code-generator, which produces
program code for schema definitions
User Reference
The User Reference part is organized according to the menus in XMLSpy and describes each
menu command in detail.
1 New Features
Features that are new in XMLSpy Version 2011 are listed below. Features that were new in
older versions are listed further below.
Version 2011
In Schema View, creating Schema Subsets from the components of a single schema
file. A schema file can therefore easily be split up into subsets. The reverse process of
assimilating components from included schema subsets into the active file that is also
supported.
Charts (such as pie charts and bar charts) that represent data in an XML document can
be generated for documents viewed in Text View and Grid View (Enterprise edition only
). Also, XSLT/XQuery Profiler results can also be reported in the form of charts (
Enterprise edition only).
Validation of SOAP messages against WSDL. SOAP messages can be checked for
validity not only against the SOAP specification but as well as against any XML
Schemas referenced in the corresponding WSDL definition (Enterprise edition only).
2 Introduction
This introduction describes:
The application GUI, and
The application environment.
The GUI section starts off by presenting an overview of the GUI and then goes on to describe
each of the the various GUI windows in detail. It also shows you how to re-size, move, and
otherwise work with the windows and the GUI.
The Application Environment section points out the various settings that control how files are
displayed and can be edited. It also explains how and where you can customize your
application. In this section, you will learn where important example and tutorial files have been
installed on your machine, and, later in the section, you are linked to the Altova website, where
you can explore the feature matrix of your application, learn about the multiple formats of your
user manual, find out about the various support options available to you, and discover other
products in the Altova range.
The main window and sidebars are described in the sub-sections of this section.
The GUI also contains a menu bar, status bar, and toolbars, all of which are described in a
subsection of this section.
A window can be made to float or dock using one of the following methods:
Right-click the title bar of a window and choose the required command (Floating or
Docking).
Double-click the title bar of the window. If docked, the window will now float. If floating,
the window will now dock in the last position in which it was docked.
Drag the window (using its title bar as a handle) out of its docked position so that it
floats. Drag a floating window (by its title bar) to the location where it is to be docked.
Two sets of blue arrows appear. The outer set of four arrows enables docking relative
to the application window (along the top, right, bottom, or left edge of the GUI). The
inner set of arrows enables docking relative to the window over which the cursor is
currently placed. Dropping a dragged window on the button in the center of the inner set
of arrows (or on the title bar of a window) docks the dragged window as a tabbed
window within the window in which it is dropped.
To float a tabbed window, double-click its tab. To drag a tabbed window out of a group of
tabbed windows, drag its tab.
Auto-hiding sidebars
The Auto-hide feature enables you to minimize docked sidebars to buttons along the edges of
the application window. This gives you more screen space for the Main Window and other
sidebars. Scrolling over a minimized sidebar rolls out that sidebar.
To auto-hide and restore sidebars click the drawing pin icon in the title bar of the sidebar
window (or right-click the title bar and select Auto-Hide).
minimized, the Maximize, Restore, and Close buttons are located in the title bar of the
document window.
When you maximize one file, all open files are maximized.
Open files can be cascaded or tiled using commands in the Window menu.
You can also activate open files in the sequence in which they were opened by using
Ctrl+Tab or Ctrl+F6.
Right-clicking a document tab opens a context-menu with a selection of File
commands, such as Print and Close.
Note: The default view for individual file extensions can be customized in the Tools | Options
dialog: in the Default View pane of the File Types tab.
Projects thus enable you to gather together files that are used together and to access them
quicker. Additionally, you can define schemas and XSLT files for individual folders, thus
enabling the batch processing of files in a folder.
Project operations
Commands for folder operations are available in the Project menu, and some commands are
available in the context menus of the project and its folders (right-click to access).
One project is open at a time in the Project Window. When a new project is created or
an existing project opened, it replaces the project currently open in the Project Window.
After changes have been made to a project, the project must be saved (by clicking the
Project | Save Project command).
The project has a tree structure composed of folders, files, and other resources. Such
resources can be added at any level and to an unlimited depth.
Project folders are semantic folders that represent a logical grouping of files. They do
not need to correspond to any hierarchical organization of files on your hard disk.
Folders can correspond to, and have a direct relationship to, physical directories on
your file system. We call such folders external folders, and they are indicated in the
Project Window by a yellow folder icon (as opposed to normal project folders, which are
green). External project folders must be explicitly synchronized by using the Refresh
command.
A folder can contain an arbitrary mix of file-types. Alternatively, you can define file-type
extensions for each folder (in the Properties dialog of that folder) to keep common files
in one convenient place. When a file is added to the parent folder, it is automatically
added to the sub-folder that has been defined to contain files of that file extension.
In the Project Window, a folder can be dragged to another folder or to another location
within the same folder, while a file can be dragged to another folder but cannot be
moved within the same folder (within which files are arranged alphabetically).
Additionally, files and folders can be dragged from Windows File Explorer to the Project
Window.
Each folder has a set of properties that are defined in the Properties dialog of that
folder. These properties include file extensions for the folder, the schema by which to
validate XML files, the XSLT file with which to transform XML files, etc.
Batch processing of files in a folder is done by right-clicking the folder and selecting the
relevant command from the context menu.
Note: The display of the Project Window can be turned on and off in the Window menu.
Information is available in the Info Window in Text View, Grid View, and Authentic View.
Note: The display of the Info Window can be turned on and off in the Window menu.
cursor location point, so the entry helper is designed to insert an element when the
element is double-clicked. But in Grid View, an element can be inserted before the
selected node, appended after it, or added as a child node, so the Elements entry
helper in Grid View has three tabs for Insert, Append, and Add as Child, with each tab
containing the elements available for that particular operation.
A general description of entry helpers in each type of view is given in Editing Views. Further
document-type-related differences within a view are noted in the description of the individual
document types, for example XML entry helpers and XQuery entry helpers.
Otherwise, a message that describes the error (screenshot below) is displayed. Notice that
there are links (black link text) to nodes and node content in the XML document, as well as links
(blue link text) to the sections in the relevant specification on the Internet that describe the rule
in question. Clicking the purple Def buttons, opens the relevant schema definition in Schema
View.
The Messages Window is enabled in all views, but clicking a link to content in an XML
document highlights that node in the XML document in Text View. However, when an XML
Schema has been validated in Schema View, clicking a Def button does not change the view.
Note: The Validate command (in the XML menu) is normally applied to the active document.
But you can also apply the command to a file, folder, or group of files in the active
project. Select the required file or folder in the Project Window (by clicking on it), and
click XML | Validate or F8. Invalid files in a project will be opened and made active in
the Main Window, and the File Is Invalid error message will be displayed.
The XPath Window shows, in a single view: (i) the XML document; (ii) the XPath expression;
and (iii) the result of evaluating the XPath expression on the active XML document. The benefits
are that you can: (i) navigate the XML document while keeping the XPath expression and its
results in view; (ii) navigate the XML document by clicking items in the result; and (iii) modify the
XPath expression while keeping the XML document in view.
If Current file is selected, the file that is currently active is used. Selecting Open files
causes the XPath expression to be evaluate against all the files currently open in
XMLSpy. Project refers to the currently active XMLSpy project. The external folders in
a XMLSpy project can be excluded by checking the Skip external folders check box.
The Folder option enables you to browse for the required folder; the XPath expression
will be evaluated against XML files in this folder.
2. Select the XPath version you wish to use (1.0 or 2.0) by clicking the appropriate icon in
the toolbar of the output window (see screenshot below).
3. Select the type of XPath expression from the dropdown list in the combo box. Allow
Complete XPath is the usually required option. The XML Schema Selector and XML
Schema Field options can be used for a narrow subset of specific XPath 1.0 cases and
are useful when unique identity constraints have been defined in the XML Schema.
When either of these options is selected, only name tests (and the wildcard *) are
allowed in the XPath expression, and predicates and XPath functions may not be used.
Furthermore, for the XML Schema Selector option, only expressions on the child axis
are allowed; for the XML Schema Field option, expressions on the child axis and
attribute axis are allowed. For more information, see the W3C's XML Schema:
Structures Recommendation.
4. Toggle the Evaluate XPath Expression On Typing icon on if you want the XPath
expression to be evaluated while you are typing it in. If this icon is toggled off, the
expression will be evaluated only when you click the Evaluate XPath Expression icon
.
5. Toggle the Show Header In Output icon on if, in the output, you wish to show the
location of the XML file and the XPath expression (as in screenshot below).
6. If the XPath expression will returns nodes—such as elements or attributes—you can
select whether the entire contents of the selected nodes should be shown. This is done
by switching the Show Complete Results icon on. In the screenshot below, both the
element and its content are displayed (in the right-hand column).
7. To set an XPath expression relative to a selection in the XML document, toggle the Set
Current Selection As Origin icon on.
8. Enter the XPath expression. The intelligent XPath editing feature will pop up a list of
XPath functions, XPath axes, and document elements and attributes, from which you
can choose. If you wish to create the expression over multiple lines, press the Return
key.
9. To evaluate the expression (if Evaluate on Typing is toggled off or when a new XML
document is made active), click the Evaluate XPath Expression icon.
Please note: To summarize the namespace issue: If you use constructors or types from the
XML Schema namespace, you must declare the XML Schema namespace in the XML
document and use the correct namespace prefixes in the XPath expression. You do not need to
use a prefix for XPath functions.
In some cases, however, it is necessary to explicitly convert to the required datatype. For
example, if you have two elements, startDate and endDate, that are defined as being of
type xs:date in the XML Schema, then using the XPath 2.0 expression endDate -
startDate will show an error. On the other hand, if you use xs:date(endDate) -
xs:date(startDate) or (endDate cast as xs:date) - (startDate cast as
xs:date), the expression will correctly evaluate to a singleton sequence of type
xs:dayTimeDuration.
Please note: The XPath Engines used by the XPath Evaluator are also used by the Altova
XSLT Engine, so XPath 2.0 expressions in XSLT stylesheets that are not implicitly converted to
the required datatype must be explicitly constructed as or cast to the required datatype.
Troubleshooting
If your XPath expression returns an error, do the following:
1. Check whether the options have been correctly set (XPath version, origin, etc).
2. Check that the spelling of function names, constructor names, node names, etc., are
correct.
3. Check whether prefixes are required and correctly set on functions, constructors, and
arguments in the XPath expression.
4. If namespaces are declared in the XML document check that they are correct. The
correct namespaces are:
XML Schema: http://www.w3.org/2001/XMLSchema
XPath 2.0 Functions: http://www.w3.org/2005/xpath-functions
The XSL Outline Window provides information about templates and functions in the stylesheet.
This information can be sorted and searched, and the window's toolbar contains commands
that enable you to easily insert calls to named templates and to set named templates as the
starting point of transformations. How to work with the XSL Outline Window is described in the
section XSLT and XQuery | XSLT | XSL Outline | XSL Outline Window.
Note: File-related information about the stylesheet and file-related commands are available in
the XSLT tab of the Info Window. How to use these commands is described in the
section XSLT and XQuery | XSLT | XSL Outline | Info Window.
Find criteria
There are two broad find criteria: (i) what to find, and (ii) where to look?
What to find: The string to find is entered in the Find What text box. If that string must match a
whole word, then the Match Whole Word check box must be clicked. For example, for the find
string fit, with Match Whole Word checked, only the word fit will match the find string; the
fit in fitness, for example, would not. You can specify whether casing is significant using the
Match Case check box. If the text entered in the Find What text box is a regular expression,
then the Regular Expression check box must be checked. An entry helper for regular
expressions can be accessed by clicking the button. The use of regular expressions for
searching is explained in the section, Find. The More button opens the Find in Files dialog,
where you can set advanced search conditions and actions. For more information, see Edit |
Find in Files.
Where to look: The search can be conducted in: (i) all the files that are open in the GUI; (ii) the
files of the current project; and (iii) the files of a selected folder. You can set additional
conditions in the Find in Files dialog (accessed by clicking More).
Replace with
The string with which the found string is to be replaced is entered in the Replace With text box.
Note that if the Replace With text box is empty and you click the Replace button, the found text
will be replaced by an empty string.
The results
After you click the Find or Replace buttons, the results of the find or replace are displayed in the
Find in Files output window. The results are divided into four parts:
A summary of the search parameters, which lists the search string and what files were
searched.
A listing of the found or replaced strings (according to whether the Find or Replace
button was pressed). The items in this listing are links to the found/replaced text in the
Text View of the document. If the document is not open, it will be opened in Text View
and the found/replaced text will be highlighted.
A list of the files which were searched but in which no matches were found.
A summary of statics for the search action, including the number of matches and
number of files checked.
Note: Note that the Find in Files feature executes the Find and the Replace commands on
multiple files at once and displays the results in the Find in Files output window. To do a
find so that you go from one found item to the next, use the Find command.
The results of the Find and Replace in Schema View feature (i.e. each time a Find or Replace
command is executed) are displayed in the Find in Schemas window. The term that was
searched for is displayed in green; (in the screenshot above, it can be seen that email was the
search term, with no case restriction specified). Notice that the location of the schema file is
also given.
Results are displayed in nine separate tabs (numbered 1 to 9). So you can keep the results of
one search in one tab, do a new search in a new tab, and compare results. To show the results
of a new search in a new tab, select the new tab before starting the search. Clicking on a result
in the Find In Schemas window pops up and highlights the relevant component in the Main
Window of Schema View. In this way you can search and navigate quickly to the desired
component, as well as copy messages to the clipboard. For more details, see the Results and
Information section in the description of the Find in Schemas feature.
The Find in XBRL can be performed when an XBRL taxonomy document is open in XBRL View.
How to carry out the search is described in the section Find in XBRL in the XBRL section of the
user manual.
The Find button pops up the Search dialog. The Find Next button finds the next instance of the
search term in the document starting from the cell immediately after the cell in XBRL View in
which the cursor is currently placed.
For more information, see the section Charts in the XML section of the user manual.
Export: the chart can be exported as an image file, or as an XSLT or XQuery fragment
to the clipboard. The XSLT or XQuery fragment can be used in an XSLT or XQuery
document, which when processed with the Altova XSLT 2.0 Engine or the Altova
XQuery Engine, will correctly render the chart.
Reload/Auto: If the Auto button is toggled on, then any change in the underlying XML
document will automatically refresh a chart in the Charts Window that is based on the
XML document. Otherwise a chart will only be updated when the Reload button is
pressed.
Toolbars
The toolbars (see illustration) contain icons that are shortcuts for selecting menu commands.
The name of the command appears when you place your mouse pointer over the icon. To
execute the command, click the icon.
Toolbar buttons are arranged in groups. In the Tools | Customize | Toolbars dialog, you can
specify which toolbar groups are to be displayed. These settings apply to the current view. To
make a setting for another view, change to that view and then make the setting in the Tools |
Customize | Toolbars. In the GUI, you can also drag toolbar groups by their handles (or title
bars) to alternative locations on the screen. Double-clicking the handle causes the toolbar to
undock and to float; double-clicking its title bar causes the toolbar to dock at its previous
location.
Status Bar
The Status Bar is located at the bottom of the application window (see illustration) and displays
(i) status information about the loading of files, and (ii) information about menu commands and
command shortcuts in the toolbars when the mouse cursor is placed over these. If you are
using the 64-bit version of XMLSpy, this is indicated in the status bar with the suffix (x64) after
the application name. There is no suffix for the 32-bit version.
Settings
Several important XMLSpy settings are defined in different tabs in the Options dialog (
screenshot below, accessed via the menu command Tools | Options). You should look
through the various options to familiarize yourself with what's available.
Given below is a summary of the most important settings. For details, see the description of the
Options dialog in the User Reference section.
File types and default views: In the File Types tab, you can add a file type that XMLSpy
will recognize. You do this by adding a file extension to the list of file extensions. For
each file type, you can then specify to what specification files of this file type should
conform and in what XMLSpy view files of this file type should open (the default view for
this file type).
File validation: In the File tab, you can specify whether files should be validated
automatically on opening and/or saving. In the File Types tab, file validation can then be
disabled for specific file types.
Editing features: In the Editing tab, you can specify how entry helpers should be
organized, how new elements are generated, and whether auto-completion is enabled.
Additional options are available for individual views in the View tab. In the Fonts tabs for
various views, you can specify the font characteristics of individual node types in each
of these views.
XSLT and FO Engines: In the XSL tab, you can specify that an external XSL engine be
used for transformations made from within the GUI. You must also specify the location
of the FO processor executable to be used for FO processing within XMLSpy. For more
information, see the XSLT Processing section.
Encoding: Default encodings for XML and non-XML files are specified in the Encoding
tab.
Customization
You can also customize various aspects of XMLSpy, including the appearance of the GUI.
These customization options are available in the Customize dialog (screenshot below, accessed
via the menu command Tools | Customize).
The various customization options are described in the User Reference section.
Menus
Menu commands are enabled/disabled depending upon three factors: (i) file type, (ii) active
view, and (iii) current cursor location or current document status. For example:
File type: The command DTD/Schema | Include Another DTD is enabled only when
the active file is a DTD. Similarly, commands in the WSDL menu will be enabled only
when a WSDL file is active.
Active view: Most commands in the Schema Design menu will be active only when the
active view is Schema View.
Current cursor location, document status: In Grid View, whether the command to add
an attribute as a child node (XML | Add Child | Attribute) is enabled will depend on
whether the selected item in Grid View is an element or not (current cursor location).
When an XSLT document is active the Stop Debugger command will not be active till
after a debugger session has been started (current document status).
Note also that you can customize menus (Tools | Customize) as well as drag and reorganize
them within the GUI (see Menu Bar, Toolbars, Status Bar).
XMLSpy Help
This documentation is the Altova-supplied Help for XMLSpy. It is available as the built-in Help
system of XMLSpy, which is accessible via the Help menu or by pressing F1. Additionally, the
user manuals for all Altova products are available in the following formats:
Online HTML manuals, accessed via the Support page at the Altova website
Printable PDFs, which you can download from the Altova website and print locally
Printed books that you can buy via a link at the Altova website
Support options
If you require additional information to what is available in the user manual (this documentation)
or have a query about Altova products, visit our Support Center at the Altova website. Here you
will find:
Links to our FAQ pages
Discussion forums on Altova products and general XML subjects
Online Support Forms that enable you to make support requests, should you have a
support package. Your support request will be processed by our support team.
Altova products
For a list of all Altova products, see the Altova website.
3 XMLSpy Tutorial
This tutorial provides an overview of XML and takes you through a number of key XML tasks. In
the process you will learn how to use some of XMLSpy's most powerful features.
The Template folder in the application folder (typically in c:\Program Files\Altova) contains
all the XML template files that are used whenever you select the menu option File | New. These
files supply the necessary data (namespaces and XML declarations) for you to start working
with the respective XML document immediately.
The details of the interface are explained as we go along. Note that the interface changes
dynamically according to the document that is active in the Main Window and according to the
view selected.
The structure and syntax of an XML Schema document is complex, and being an XML
document itself, an XML Schema must be valid according to the rules of the XML Schema
specification. In XMLSpy, Schema View enables you to easily build valid XML Schemas by
using graphical drag-and-drop techniques. The XML Schema document you construct is also
editable in Text View and Grid View, but is much easier to create and modify in Schema View.
Objective
In this section of the tutorial, you will learn how to edit XML Schemas in Schema View.
Specifically, you will learn how to do the following:
Create a new schema file
Define namespaces for the schema
Define a basic content model
Add elements to the content model using context menus and drag-and-drop
Configure the Content Model View
After you have completed creating the basic schema, you can go to the next section of the
tutorial, which teaches you how to work with the more advanced features of XML Schema in
XMLSpy. This advanced section is followed by a section about schema navigation and
documentation in XMLSpy.
Display Diagram (or Display Content Model View). This icon is located to the left of all
global components in Schema Overview. Click this icon to display the content model of
the associated global component.
Starting XMLSpy
To start XMLSpy, double-click the XMLSpy icon on your desktop or use the Start | All
Programs menu to access the XMLSpy program. XMLSpy is started with no documents open
in the interface.
Note the four main parts of the interface: (i) the Project and Info Windows on the left; (ii) the
Main Window in the middle; (iii) the Entry Helpers on the right; and (iv) the Output Windows at
the bottom.
2. In the dialog, select the xsd entry (the document description and the list in the window
might vary from that in the screenshot) and confirm with OK. An empty schema file
appears in the Main Window in Schema View. You are prompted to enter the name of
the root element.
3. Double-click in the highlighted field and enter Company. Confirm with Enter. Company
is now the root element of this schema and is created as a global element. The view
you see in the Main Window (screenshot below) is called the Schema Overview. It
provides an overview of the schema by displaying a list of all the global components in
the top pane of the Main Window; the bottom pane displays the attributes and identity
constraints of the selected global component. (You can view and edit the content model
of individual global components by clicking the Display Diagram icon to the left of that
global component.)
4. In the Annotations field (ann) of the Company element, enter the description of the
element, in this case, Root element.
5. Click the menu option File | Save, and save your XML Schema with any name you like
(AddressFirst.xsd, for example).
In the XML Schema you are creating, you will define a target namespace for XML document
instances. (The required reference to the XML Schema namespace is created automatically by
XMLSpy when you create a new XML Schema document.)
Please note:
The XML Schema namespace is automatically created by XMLSpy and given a prefix
of xs:.
When the XML document instance is created, it must have the target namespace
defined in the XML Schema for the XML document to be valid.
In XMLSpy, the content model of a global component is displayed in the Content Model View of
Schema View. To view and edit the content model of a global component, click the Display
Diagram icon located to the left of the global component.
In this section, you will create the content model of the Company element.
This inserts the Sequence compositor, which defines that the components that follow
must appear in the specified sequence.
3. Right-click the Sequence compositor and select Add Child | Element. An unnamed
element component is added.
4. Enter Address as the name of the element, and confirm with Enter.
5. Right-click the Sequence compositor again, select Add Child | Element. Name the
newly created element component Person.
You have so far defined a schema which allows for one address and one person per
company. We need to increase the number of Person elements.
6. Right-click the Person element, and select Unbounded from the context menu. The
Person element in the diagram now shows the number of allowed occurrences: 1 to
infinity.
Alternatively, in the Details Entry Helper, you can edit the minOcc and maxOcc fields to
specify the allowed number of occurrences, in this case 1 and unbounded, respectively.
Do this as follows:
1. Right-click the Address element to open the context menu, and select Add Child |
Sequence. This adds the Sequence compositor.
2. Right-click the Sequence compositor, and select Add Child | Element. Name the newly
created element component Name.
<xs:element name="Company">
<xs:annotation>
<xs:documentation>Root element</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element name="Address">
<xs:complexType>
<xs:sequence>
<xs:element name="Name"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Person"/>
</xs:sequence>
</xs:complexType>
</xs:element>
Simple type elements, on the other hand, contain only text and have no attributes. Text can be
strings, dates, numbers, etc. We want the Name child of Address to contain only text. It is a
simple type, the text content of which we want to restrict to a string. We can do this using the
XML Schema data type xs:string.
3. In the Details Entry Helper, from the dropdown menu of the type combo box, select
the xs:string entry.
Note that both minOcc and maxOcc have a value of 1, showing that this element
occurs only once.
Please note: A simple type element can have any one of several XML Schema data types. In
all these cases, the icon indicating text-content appears in the element box.
2. Release the mouse button to create the new element in the Address sequence. If the
new element appears at an incorrect location, drag it to a location below the Name
element.
3. Double-click in the element box, and type in Street to change the element name.
4. Use the same method to create a third element called City. The content model should
now look like this:
The Address element has a sequence of a Name, a Street, and a City element, in
that order.
1. Select the Content Model View (click the Content Model View icon ) of a component
in order to enable the Configure view command.
2. Select the menu option Schema Design | Configure view. The Schema Display
Configuration dialog appears.
3. Click the Append icon (in the Element tab) to add a property descriptor line for
each element box.
4. From the dropdown menu, select type (or double-click in the line and enter "type").
This will cause the data type of each element to be displayed in the Content Model
View.
5. In the Single Line Settings pane, select Hide Line If No Value. This hides the description
of the datatype in the element box if the element does not have a datatype (for
example, if the element is a complex type).
Notice that the type descriptor line appears for the Name, Street, and City elements,
which are simple types of type xs:string, but not for the complex type elements. This
is because the Hide Line If No Value toggle is selected.
6. In the Single Line Settings group, select the Always Show Line radio button.
7. Click OK to confirm the changes.
Notice that the descriptor line for the data type is always shown—even in element
boxes of complex types, where they appear without any value.
Please note:
The property descriptor lines are editable, so values you enter in them become part of
the element definition.
The settings you define in the Schema display configuration dialog apply to the schema
documentation output as well as the printer output.
4. Select the xs:string entry from the dropdown list or enter it into the type value field.
5. Use the drag-and-drop method to create four more elements. Name them Last, Title
, PhoneExt, and Email, respectively.
Please note: You can select multiple elements by holding down the Ctrl key and clicking each
of the required elements. This makes it possible to, e.g., copy several elements at once.
element box changes from solid to dashed; this is a visual indication that an element is
optional.
In the Details Entry Helper, you will see that minOcc=0 and maxOcc=1, indicating that the
element is optional. Alternatively to using the context menu to make an element optional, you
can set minOcc=0 in order to make the element optional.
This defines that all phone extensions up to, and including 99, are valid.
3. Select the menu option File | Save to save the changes to the schema.
Please note:
Selecting an XML Schema datatype that is a simple type (for example, xs:string or
xs:date), automatically changes the content model to simple in the Details Entry
Helper (content = simple).
Adding a compositor to an element (sequence, choice, or all), automatically
changes the content model to complex in the Details Entry Helper (content =
complex).
The schema described above is available as AddressFirst.xsd in the
C:\Documents and Settings\<username>\My Documents\Altova\XMLSpy2011\\
Examples\Tutorial folder of your XMLSpy application folder.
Objective
In this section, you will learn how to:
Work with complex types and simple types, which can then be used as the types of
schema elements.
Create global elements and reference them from other elements.
Create attributes and their properties, including enumerated values.
You will start this section with the basic AddressFirst.xsd schema you created in the first
part of this tutorial.
Display Diagram (or Display Content Model View). This icon is located to the left of all
global components in Schema Overview. Clicking the icon causes the content model of
the associated global component to be displayed.
Display All Globals. This icon is located at the top left-hand corner of the Content Model
View. Clicking the icon switches the view to Schema Overview, which displays all global
components.
Append. The Append icon is located at the top left-hand corner of the Schema
Overview. Clicking the icon enables you to add a global component.
3. Click the Display All Globals icon. This takes you to the Schema Overview, in which
you can view all the global components of the schema.
4. Click the expand icons for the element and complexType entries in the Components
entry helper, to see the respective schema constructs.
The Schema Overview now displays two global components: the Company element and
the complex type AddressType. The Components Entry Helper also displays the
AddressType complex type.
5. Click on the Content Model View icon of AddressType to see its content model (
screenshot below). Notice the shape of the complex type container.
6. Click the Display All Globals icon to return to the Schema Overview.
country-specific addresses. For this purpose we will define a new complex type based on the
basic AddressType component, and then extend that definition.
Do this as follows:
1. Switch to Schema Overview. (If you are in Content Model View, click the Display All
Globals icon .)
2. Click the Append icon at the top left of the component window. The following
menu opens:
3. Select ComplexType from the menu. A new line appears in the component list, and the
cursor is set for you to enter the component name.
4. Enter US-Address and confirm with Enter. (If you forget to enter the hyphen character
"-" and enter a space, the element name will appear in red, signalling an invalid
character.)
5. Click the Content Model View icon of US-Address to see the content model of the
new complex type. The content model is empty (see screenshot below).
6. In the Details entry helper, click the base combo box and select the AddressType
entry.
The Content Model View now displays the AddressType content model as the content
model of US-Address (screenshot below).
7. Now we can extend the content model of the US-Address complex type to take a ZIP
Code element. To do this, right-click the US-Address component, and, from the
context menu that appears, select Add Child | Sequence. A new sequence compositor
is displayed outside the AddressType box (screenshot below). This is a visual
indication that this is an extension to the element.
8. Right-click the new sequence compositor and select Add Child | Element.
9. Name the newly created element Zip, and then press the Tab key. This places the
cursor in the value field of the type descriptor line.
10. Select xs:positiveInteger from the dropdown menu that appears, and confirm
with Enter.
You now have a complex type called US-Address, which is based on the complex type
AddressType and extends it to contain a ZIP code.
5. In the Details Entry Helper (screenshot below), place the cursor in the value field of
restr and enter xs:string, or select xs:string from the dropdown menu in the
restr value field.
This creates a simple type called US-State, which is of datatype xs:string. This
global component can now be used in the content model of US-Address.
Do the following:
Do the following:
1. In Schema Overview, create a global complex type called UK-Address, and base it on
AddressType (base=AddressType).
2. In the Content Model View of UK-Address, add a Postcode element and give it a
type of xs:string.
Your UK-Address content model should look like this:
Please note: In this section you created global simple and complex types, which you then used
in content model definitions. The advantage of global types is that they can be reused in
multiple definitions.
4. Click the Display All Globals icon to return to Schema Overview. The Person
element is now listed as a global element. It is also listed in the Components Entry
Helper.
5. In the Components Entry Helper, double-click the Person element to see the content
model of the global Person element.
Notice that the global element box does not have a link arrow icon. This is because it is
the referenced element, not the referencing element. It is the referencing element that
has the link arrow icon.
Please note:
An element that references a global element must have the same name as the global
element it references.
A global declaration does not describe where a component is to be used in an XML
document. It only describes a content model. It is only when a global declaration is
referenced from within another component that its location in the XML document is
specified.
A globally declared element can be reused at multiple locations. It differs from a globally
declared complex type in that its content model cannot be modified without also
modifying the global element itself. If you change the content model of an element that
references a global element, then the content model of the global element will also be
changed, and, with it, the content model of all other elements that reference that global
element.
2. Click the Append icon , in the top left of the Attributes/Identity Constraints tab group
(in the lower part of the Schema Overview window), and select the Attribute entry.
Do the following:
1. In the Schema Overview, click the Person element to make it active.
2. Click the Append icon in the top left of the Attributes window, and select the
Attribute entry.
3. Enter Degree as the attribute name, and select xs:string as its type.
4. With the Degree attribute selected, in the Facets Entry Helper, click the Enumerations
tab (see screenshot).
The previously defined attributes are visible in the Content Model View. Clicking the
expand icon displays all the attributes defined for that element. This display mode and
the Attributes tab can be toggled by selecting the menu option Schema Design |
Configure view, and checking and unchecking the Attributes check box in the Show
in diagram pane.
9. Click the Display all Globals icon to return to the Schema Overview.
Please note: Before saving your schema file, rename the AddressLast.xsd file that is
delivered with XMLSpy to something else (such as AddressLast_original.xsd), so as not
to overwrite it.
Save the completed schema with any name you like (File | Save as). We recommend you save
it with the name AddressLast.xsd since the XML file you create in the next part of the tutorial
will be based on the AddressLast.xsd schema.
Display Diagram (or Display Content Model View). This icon is located to the left of all
global components in Schema Overview. Clicking the icon causes the content model of
the associated global component to be displayed.
In Schema Overview, click the Display Diagram icon to the left of the component
name.
In either Schema Overview or Content Model View, double-click the element, complex
type, or element group in the Components Entry Helper (screenshot below).
If you double-click any of the other global components (simple type, attribute, attribute
group) in the Components Entry Helper, that component will be highlighted in Schema
Overview (since they do not have a content model).
In the Components Entry Helper, the double-clicking mechanism works from both the By Type
and By Namespace tabs.
For example, while viewing the Company content model, holding down Ctrl while
double-clicking Last opens the Person content model and highlights the Last element in it.
When the Last element is highlighted, all its properties are immediately displayed in the
relevant entry helpers and information window.
This takes you to the Content Model View of the complex type.
Please note: Just as with referenced global elements, you can go directly to an element within
the complex type definition by holding down Ctrl and double-clicking the required element in the
content model that contains the complex type.
In this section, we will generate documentation for the AddressLast.xsd XML Schema.
Do the following:
1. Select the menu option Schema design | Generate documentation. This opens the
Schema Documentation dialog.
2. For the Output Format option, select HTML, and click OK.
3. In the Save As dialog, select the location where the file is to be saved and give the file a
suitable name (say AddressLast.html). Then click the Save button.
The HTML document appears in the Browser View of XMLSpy. Click on a link to go to
the corresponding linked component.
The diagram above shows the first page of the schema documentation in HTML form.
If components from other schemas have been included, then those schemas are also
documented.
The diagram above shows how elements and simple types are documented.
You can now try out the MS Word output option. The Word document will open in MS Word. To
use hyperlinks in the MS Word document, hold down Ctrl while clicking the link.
Objective
The objectives of this section are to learn how to do the following:
Create a new XML document based on the AddressLast.xsd schema.
Specify the type of an element so as to make an extended content model for that
element available to the element during validation.
Insert elements and attributes and enter content for them in Grid View and Text View
using intelligent entry helpers.
Copy XML data from XMLSpy to Microsoft Excel; add new data in MS Excel; and copy
the modified data from MS Excel back to XMLSpy. This functionality is available in the
Database/Table View of Grid View.
Sort XML elements using the sort functionality of Database/Table View.
Validate the XML document.
Modify the schema to allow for three-digit phone extensions.
F8. Validates the XML document against the associated DTD or Schema.
2. Select the Extensible Markup Language entry (or generic XML document entry) from
the dialog, and confirm with OK. A prompt appears, asking if you want to base the XML
document on a DTD or Schema.
3. Click the Schema radio button, and confirm with OK. A further dialog appears, asking
you to select the schema file your XML document is to be based on.
4. Use the Browse or Window buttons to find the schema file. The Window button lists all
files open in XMLSpy and projects. Select AddressLast.xsd (see Tutorial
introduction for location), and confirm with OK. An XML document containing the main
elements defined by the schema opens in the main window.
5. Click the Grid tab to select Grid View.
6. In Grid View, notice the structure of the document. Click on any element to reduce
selection to that element. Your document should look something like this:
7. Click on the icon next to Address, to view the child elements of Address. Your
document should look like this:
We would, however, like to use a specific US or UK address type rather than the generic
address type. You will recall that, in the AddressLast.xsd schema, we created global
complex types for US-Address and UK-Address by extending the AddressType complex
type. The content model of US-Address is shown below.
In the XML document, in order to specify that the Address element must conform to one of the
extended Address types (US-Address or UK-Address) rather than the generic
AddressType, we must specify the required extended complex type as an attribute of the
Address element.
Do the following:
1. In the XML document, right-click the Name element, and select Insert | Attribute from
the context menu.
Please note: The xsi prefix allows you to use special XML Schema related commands in your
XML document instance. Notice that the the namespace for the xsi prefix was automatically
added to the document element when you assigned a schema to your XML file. In the above
case, you have specified a type for the Address element. See the XML Schema specification
for more information.
Do the following:
1. Double-click in the Name value field (or use the arrow keys) and enter US dependency
. Confirm with Enter.
2. Use the same method to enter a Street and City name (for example, Noble Ave
and Dallas).
3. Click the Person element and press Delete to delete the Person element. (We will
add it back in the next section of the tutorial.) After you do this, the entire Address
element is highlighted.
4. Click on any child element of the Address element to deselect all the child elements of
Address except the selected element. Your XML document should look like this:
large sections of text easy. These features can be switched on and off in the Text View Settings
dialog (View | Text View Settings, screenshot below).
Additionally, visual aids such as indentation guides, end-of-line markers, and whitespace
markers can be switched on and off, by checking and unchecking, respectively, their check
boxes in the Visual Aid pane of the Text View Settings dialog (see screenshot above).
The bookmark feature is useful for setting up markers in your document. To insert a bookmark,
use the command Edit | Insert/Remove Bookmark. Once bookmarks have been inserted you
can navigate these bookmarks using commands in the Edit menu.
The screenshot below shows the current XML file in Text View with all structural editing features
enabled. For the sake of clarity, none of the line numbers, indentation guides, etc, will be shown
in Text View in rest of this tutorial. Please see the User Manual for more information on Text
View.
Do the following:
1. Select the menu item View | Text view, or click on the Text tab. You now see the XML
document in its text form, with syntax coloring.
2. Place the text cursor after the end tag of the Address element, and press Enter to add
a new line.
3. Enter the less-than angular bracket < at this position. A dropdown list of all elements
allowed at that point (according to the schema) is displayed. Since only the Person
element is allowed at this point, it will be the only element displayed in the list.
4. Select the Person entry. The Person element, as well as its attribute Manager, are
inserted, with the cursor inside the value-field of the Manager attribute.
5. From the dropdown list for the Manager attribute, select true.
that point. Also, in the Attributes Entry Helper, the available attributes are listed in red.
The Manager attribute is grayed out because it has already been used.
7. Select Degree with the Down arrow key, and press Enter. This opens another list box,
from which you can select one of the predefined enumerations (BA, MA, or PhD).
8. Select BA with the Down arrow key and confirm with Enter. Then move the cursor to
the end of the line (with the End key), and press the space bar. Manager and Degree
are now grayed out in the Attributes Entry Helper.
9. Select Programmer with the Down arrow key and press Enter.
You could now enter the Person data in Text View, but let's move to Grid View to see the
flexibility of moving between views when editing a document.
Now let us validate the document and correct any errors that the validation finds.
If either of these checks fails, we will have to modify the document appropriately.
Checking well-formedness
An XML document is well-formed if starting tags match closing tags, elements are nested
correctly, there are no misplaced or missing characters (such as an entity without its semi-colon
delimiter), etc.
You can do a well-formedness check in any editing view. Let us select Text View. To do a
well-formedness check, select the menu option XML | Check well-formedness, or press the
F7 key, or click . A message appears in the Messages window at the bottom of the Main
Window saying the document is well-formed.
Notice that the output of the Messages window has 9 tabs. The validation output is always
displayed in the active tab. Therefore, you can check well-formedness in Tab1 for one schema
file and keep the result by switching to Tab2 before validating the next schema document
(otherwise Tab1 is overwritten with the validation result ).
Please note: This check does not check the structure of the XML file for conformance with the
schema. Schema conformance is evaluated in the validity check.
Checking validity
An XML document is valid according to a schema if it conforms to the structure and content
specified in that schema.
To check the validity of your XML document, first select Grid View, then select the menu option
XML | Validate, or press the F8 key, or click . An error message appears in the Messages
window saying the file is not valid. Mandatory elements are expected after the City element in
Address. If you check your schema, you will see that the US-Address complex type (which
you have set this Address element to be with its xsi:type attribute) has a content model in
which the City element must be followed by a Zip element and a State element.
Now look at the Elements Entry Helper (at top right). Notice that the Zip element is prefixed
with an exclamation mark, which indicates that the element is mandatory in the current context.
3. In the Elements Entry Helper, double-click the State element. Then press Tab and
enter the name of the state (Texas). Confirm with Enter. The Elements Entry Helper
now contains only grayed-out elements. This shows that there are no more required
child elements of Address.
Do the following:
1. Click the value field of the element First, and enter a first name (say Fred). Then
press Enter.
2. In the same way enter data for all the child elements of Person, that is, for Last,
PhoneExt, and Email. Note that the value of PhoneExt must be an integer with a
maximum value of 99 (since this is the range of allowed PhoneExt values you defined
in your schema). Your XML document should then look something like this in Grid View:
3. Click again to check if the document is valid. A message appears in the Messages
window stating that the file is valid. The XML document is now valid against its schema.
4. Select the menu option File | Save and give your XML document a suitable name (for
example CompanyFirst.xml). Note that the finished tutorial file CompanyFirst.xml
is in the Tutorial folder, so you may need to rename it before you give that name to
the file you have created.
Please note: An XML document does not have to be valid in order to save it. Saving an invalid
document causes a prompt to appear warning you that you are about to save an invalid
document. You can select Save anyway, if you wish to save the document in its current invalid
state.
1. Click the gray sidebar to the left of the Address element to collapse the Address
element. This clears up some space in the view.
2. Select the entire Person element by clicking on or below the Person element text in
Grid View. Notice that the Person element is now available in the Append tab of the
Elements Entry Helper.
3. Double-click the Person element in the Elements Entry Helper. A new Person
element with all mandatory child elements is appended (screenshot below). Notice that
the optional Title child element of Person is not inserted.
4. Switch to Grid View and then press F12 to switch the new Person element from Table
View to normal Grid View.
5. Click on the Manager attribute of the new Person element. Take a look at the
Attributes Entry Helper. The Manager entry is grayed out because it has already been
entered. Also look at the Info Window, which now displays information about the
Manager attribute. It is a required attribute and has therefore been added. The
Programmer attribute has not been added.
6. In the Append tab of the Attributes Entry Helper, double-click the Programmer entry.
This inserts an empty Programmer attribute after the Manager attribute.
The Programmer attribute is now grayed out in the Attributes Entry Helper.
You could enter content for the Person element in this view, but let's switch to the
Database/Table View of Grid View since it is more suited to editing a structure with multiple
occurrences, such as Person.
To display an element type as a table, you select any one of the element type occurrences and
click the Display as Table icon in the toolbar (XML | Table | Display as table). This causes
that element type to be displayed as a table. Descendant element types that have multiple
occurrences are also displayed as tables. Table View is available in Enhanced Grid View, and
can be used to edit any type of XML file (XML, XSD, XSL, etc.).
2. Select the menu option XML | Table | Display as table, or click the Display as Table
icon. Both Person elements are combined into a single table. The element and
attribute names are now the column headers, and the element occurrences are the
rows of the table.
3. Select the menu option View | Optimal widths, or click the Optimal Widths icon,
to optimize the column widths of the table.
Please note: Table View can be toggled off for individual element types in the document by
selecting that table (click the element name in the table) and clicking the Display As Table
icon. Note however that child elements which were displayed as tables will continue to be
displayed as tables.
Please note: The Entry Helpers are active also for the elements and attributes displayed as a
table. Double-clicking the Person entry in the Elements Entry Helper, for example, would add a
new row to the table (i.e., a new occurrence of the Person element).
Do the following:
1. Click on the row label 1, hold down the Ctrl key, and click on row label 2. This selects
both rows of the table.
2. Select the menu option Edit | Copy as Structured text. This command copies
elements to the clipboard as they appear on screen.
3. Switch to Excel and paste (Ctrl+V) the XML data in an Excel worksheet.
4. Enter a new row of data in Excel. Make sure that you enter a three digit number for the
PhoneExt element (say, 444).
5. Mark the table data in Excel, and press Ctrl+C to copy the data to the clipboard.
6. Switch back to XMLSpy.
7. Click in the top left data cell of the table in XMLSpy, and select Edit | Paste.
2. Select the menu option XML | Table | Ascending sort or click on the Ascending Sort
icon . The column, and the whole table with it, are now sorted alphabetically. The
column remains highlighted.
The table is sorted not just in the display but also in the underlying XML document. That
is, the order of the Person elements is changed so that they are now ordered
alphabetically on the content of Last. (Click the Text tab if you wish to see the changes
in Text View.)
3. Select the menu option XML | Validate or press F8. An error message appears
indicating that the value '444' is not allowed for a PhoneExt element (see screenshot).
The invalid PhoneExt element is highlighted .
Expand "Details" to see that PhoneExt is not valid because it is not less than or equal
to the maximum value of 99.
Please Note: You can click on the links in the error message to jump to the spot in the
XML file where the error was found.
Since the value range we set for phone extension numbers does not cover this
extension number, we have to modify the XML Schema so that this number is valid.
You will do this in the next section.
Do the following:
1. Select the menu option DTD/Schema | Go to definition or click the Go To Definition
2. Click the Display Diagram icon of the global Person element, and then click the
PhoneExt element. The facet data in the Facets tab is displayed.
3. In the Facets tab, double-click the maxIncl value field, change the value 99 to 999,
and confirm with Enter.
A message that the file is valid appears in the Validation window. The XML document
now conforms to the modified schema.
7. Select the menu option File | Save As... and save the file as CompanyLast.xml.
(Remember to rename the original CompanyLast.xml file that is delivered with
XMLSpy to something else, like CompanyLast_orig.xml).
Please note: The CompanyLast.xml file delivered with XMLSpy is in the in the Tutorial
folder.
Method
The method used to carry out the transformation is as follows:
Assign a predefined XSL file, Company.xsl, to the XML document.
Execute the transformation within the XMLSpy interface using one of the two built-in
Altova XSLT engines. (See note below.)
XSL/XQuery | Assign XSL, which assigns an XSL file to the active XML document.
XSL/XQuery | Go to XSL, opens the XSL file referenced by the active XML document.
XSL/XQuery | XSL Transformation (F10), or the toolbar icon , transforms the active
XML document using the XSL stylesheet assigned to the XML file. If an XSL file has not been
assigned then you will be prompted for one when you select this command.
Please note: XMLSpy has two built-in XSLT engines, the Altova XSLT 1.0 Engine and Altova
XSLT 2.0 Engine. The Altova XSLT 1.0 Engine is used to process XSLT 1.0 stylesheets. The
Altova XSLT 2.0 Engine is used to process XSLT 2.0 stylesheets. The correct engine is
automatically selected by XMLSpy on the basis of the version attribute in the xsl:stylesheet
or xsl:transform element. In this tutorial transformation, we use XSLT 1.0 stylesheets. The
Altova XSLT 1.0 Engine will automatically be selected for transformations with these stylesheets
when the XSL Transformation command is invoked.
Please note: Should you only see a table header and no table data in the output file,
make sure that you have defined the target namespace for your schema as detailed in
Defining your own namespace at the beginning of the tutorial. The namespace must be
identical in all three files (Schema, XML, and XSL).
Do the following:
1. Click the CompanyLast.xml tab to make it the active document, and make sure you
are in Grid View.
2. Select the menu option XSL/XQuery | Go to XSL.
The command opens the Company.xsl file referenced in the XML document.
3. Find the line <table border="1" bgcolor="lime">, and change the entry
bgcolor="lime" to bgcolor="yellow".
4. Select the menu option File | Save to save the changes made to the XSL file.
5. Click the CompanyLast.xml tab to make the XML file active, and select XSL/XQuery |
XSL Transformation, or press F10. A new XSL Output.html file appears in the
XMLSpy GUI in Browser View. The background color of the table is yellow.
6. Select the menu option File | Save, and save the document as Company.html.
All the above project settings can be defined using the menu option Project | Project
Properties.... In the next section, you will create a project using the Project menu.
2. Click the CompanyLast.xml tab to make the CompanyLast.xml file the active file in
the Main Window.
3. Select the menu option Project | Add active and related files to project. Two files are
added to the project: CompanyLast.xml and AddressLast.xsd. Note that files
referenced with Processing instructions (such as XSLT files) do not qualify as related
files.
4. Select the menu option Project | Save Project and save the project under the name
Tutorial.
Please note: Alternatively, you can right-click a project folder and select Add Active File to add
the active file to that specific folder.
3.8 That's It
If you have come this far congratulations, and thank you!
We hope that this tutorial has been helpful in introducing you to the basics of XMLSpy. If you
need more information please use the context-sensitive online help system, or print out the PDF
version of the tutorial, which is available as tutorial.pdf in your XMLSpy application folder.
4 Editing Views
XMLSpy contains powerful editing views. In addition to a Text View with intelligent editing
features, there are graphical views that greatly simplify the editing of documents. Depending on
what type of document is currently active in XMLSpy, the Main Window will have one or more
of XMLSpy's Editing Views. For example, when an Office Open XML file or ZIP file is active, the
Main Window will contain just one editing view: Archive View. When an HTML document is
active, there will be two editing views: Text View and Browser View. When an XML document is
active, there will be seven editing views: Text View, Grid View, Schema View, WSDL View,
XBRL View, Authentic View, and Browser View; of these Schema View will be enabled only for
XML Schema documents, and WSDL View only for WSDL documents.
In this section, we describe general Text View features that are available for all kinds of
documents. Specific document types, such as XML, XQuery, and CSS have certain
type-specific features, which are described in the respective sections for those document types.
For example, additional XML-specific features of Text View are described in the section XML |
Editing XML in Text View.
Fonts
The font-family, font-size, font-style, and text background-color can be customized separately
for the following groups of documents: (i) generic XML documents (including HTML); (ii) XQuery
documents; and (iii) CSS documents.
Text items in a document that have different semantics, can be colored differently. For example,
you can color element names, attribute names, and element content differently. When you set
different colors for different text items, the syntax-coloring feature is enabled. Text fonts are
customized in the Text Fonts tab of the Options dialog, and how to do this is described in the
section, User Reference | Options | Text Fonts section of this documentation.
Indentation
Well-formed XML documents can be pretty-printed. This means that the document can be
formatted so that the hierarchical structure of the document is displayed using new lines and
indentations (see screenshot below).
3. Click the Edit | Pretty-Print XML Text command or the Pretty Print icon in the Text
toolbar. This will cause the document text to be displayed (i) with or without indentation
as specified in the View Tab of the Options dialog; and (ii) if indentation is specified in
the View Tab of the Options dialog, then the the indentation is determined by the
settings in the Tabs pane of the Text View Settings dialog. Clicking the Pretty Print
command removes unnecessary leading or trailing whitespace.
Note: Pretty-printing is also used in the background when you save the document or switch
views. If the document is not well-formed, you will get an error message to that effect.
Correct the error and then pretty-print. The extent of indentation of a line is indicated by
indentation guides, which are vertical dotted lines (see screenshot at the start of this
section) that are toggled on and off with the Indentation Guides check box in the Visual
Aid pane of the Text View Settings dialog (see screenshot above).
Word-wrapping
Lines of text that are longer than the breadth of the Main Window can be made to wrap by
toggling the View | Word Wrap command on; the corresponding icon is in the Text toolbar.
The Text View Settings dialog is accessed via the View | Text View Settings command or the
Text View Settings button in the Text toolbar. Settings in the Text View Settings dialog apply to
Line numbers
Line numbers are displayed in the line numbers margin (screenshot below), which can be
toggled on and off In the Text View Settings dialog (see screenshot above). When a section of
text is collapsed, the line numbers of the collapsed text are also hidden. A related command is
the Go-to-Line/Character command.
Bookmarks
Lines in the document can be separately bookmarked for quick reference and access. If the
bookmarks margin is toggled on, bookmarks are displayed in the bookmarks margin; otherwise,
bookmarked lines are highlighted in cyan.
The bookmarks margin can be toggled on or off in the Text View Settings dialog (screenshot
above).
You can edit and navigate bookmarks using commands in the Edit menu and Text toolbar.
Bookmarks can be inserted with the Edit | Insert/Remove Bookmark command, enabling you
to mark a line in the document for reference. A bookmark can be removed by selecting the
bookmarked line and then selecting the Edit | Insert/Remove Bookmark command. To
navigate through the bookmarks in a document, use the Edit | Next Bookmark and Edit |
Previous Bookmark commands. These bookmark commands are also available as icons in
the Text toolbar (screenshot above).
Source folding
Source folding refers to the ability to expand and collapse nodes (screenshot below) and is
displayed in the source folding margin. The margin can be toggled on and off in the Text View
Settings dialog (see screenshot above). In the screenshot below, notice how the line numbering
at Lines 14 and 24 has been collapsed together with the collapsed nodes.
The Toggle All Folds command in the Text toolbar toggles all nodes to their expanded forms
or collapses all nodes to the top-level document element. After a node has been expanded, the
following options are available when clicking on the node's toggle icon (+/- icon):
Plain click: Collapses the node. Clicking on it again expands the node so that
descendant nodes are shown expanded or collapsed according to how they were
before the node was collapsed.
Ctrl+Click: Expands all descendant nodes recursively. This means that all descendant
nodes are expanded.
Shift+Click: Collapses descendant nodes, but keeps the node itself open.
Indentation guides
Indentation guides are vertical dotted lines that indicate the extent of a line's indentation (see
screenshot above). They can be toggled on and off in the Text View Settings dialog.
keeping the Ctrl key pressed. This enables you to magnify and reduce the size of text in Text
View. If you wish to increase the size of fonts, do this in the Options dialog.
Go to line/character
This command in the View menu and Text toolbar enables you to go to a specific line and
character in the document text.
For some document types (such as XML and XQuery) additional specialized features are
available, and these are described, respectively, in the sections that deal with those document
types.
Note: For large files, Auto-completion and entry helpers can be disabled, thus enabling faster
loading and editing. The threshold file size is specified by the user. For more details,
see the reference section, Options | Editing.
Syntax coloring
Syntax coloring is applied according to the semantic value of the text. For example, in XML
documents, depending on whether the XML node is an element, attribute, content, CDATA
section, comment, or processing instruction, the node name (and in some cases the node's
content) is colored differently. Four groups of document type are distinguished: (i) generic XML
(which includes HTML); (ii) XQuery; (iii) CSS; and (iv) JSON. The text properties (including
color) of each group can be set in the Text Fonts tab of the Options dialog (Tools | Options).
Intelligent Editing
If you are working with an XML document based on a schema, XMLSpy provides you with
various intelligent editing capabilities in Text View. These allow you to quickly insert the correct
element, attribute, or attribute value according to the content model defined for the element you
are currently editing. For example, when you start typing the start tag of an element, the names
of all the elements allowed by the schema at this point are shown in a pop-up (screenshot
below). Selecting the required element name and pressing Enter inserts that element name in
Auto-completion
Editing in Text View can easily result in XML and other marked-up documents (such as HTML)
that are not well-formed. For example, closing tags may be missing, mis-spelled, or structurally
mismatched. XMLSpy automatically completes the start and end tags of elements, as well as
inserts all required attributes as soon as you finish entering the element name on your
keyboard. The cursor is also automatically positioned between the start and end tags of the
element, so that you can immediately continue to add child elements or contents: <img src=""
alt=""> </img>
XMLSpy makes use of the XML rules for well-formedness and validity to support
auto-completion. The information about the structure of the document is obtained from the
schema on which the document is based. (In the case of well-used schemas, such as HTML
and XSLT, the schema information is built into XMLSpy.) Auto-completion uses not only
information about the structure of the document, but also the values stored in the document. For
example, enumerations and schema annotations in an XML Schema are actively used by the
Auto-Completion feature. If, in the schema, values are enumerated for a particular node, then
those enumerations will be displayed as auto-completion options when that node comes to be
edited. Similarly, if, for a node, annotations exist in the schema, then these annotations are
displayed when the node name is being typed in the document (screenshot below). (First
(given) name of person is the schema annotation of the First element.)
Auto-completion can be switched on and off in the Editing tab of the Options dialog (Tools |
Options | Editing).
Unlimited Undo
XMLSpy offers unlimited levels of Undo and Redo for all editing operations.
Note that several document types, such as XSD, XSLT, XHTML, and RDF, are essentially XML
documents and will therefore have the Elements, Attributes, and Entities entry helpers.
Note: For large files, Auto-completion and entry helpers can be disabled, thus enabling faster
loading and editing. The threshold file size is specified by the user. For more details,
see the reference section, Options | Editing.
A hierarchical item (such as the XML declaration, document type declaration, or element
containing child elements) is represented with a gray bar on the left side containing a small
upwards-pointing arrow at the top. Clicking the side bar expands or collapses the item. An
element is denoted with the icon, an attribute with the icon.
Please note: If you mark data in Grid View and switch to Text View, that data will be marked
also in Text View.
Intelligent editing
Grid View enables intelligent editing when the XML document is based on a schema. See
Editing in Grid View for details. The Entry Helpers used in Grid View are described below.
You will notice that the various Entry Helpers are constantly updated depending on the current
selection in the Grid View. The Info Window constantly shows important information regarding
the selected element or attribute.
defined by the schema. A similar popup is displayed if the contents of an element or attribute
are restricted by an enumeration or choice of some sort.
The document element is article, and article has the following sequence of child
elements: one title element, four sect1 elements, and one appendix element. Each
sect1 and appendix element has one title element followed by any number of para or
simpara elements.
Now here is the Table View of this document—more correctly, that of the article element.
(To get this view: select the article element in normal Grid View (by clicking on it) and click
the Display as Table icon . Alternatively, select the menu item XML | Table | Display as
Table (F12).)
Notice that each child element of article (the element displayed as a table)—that is, title,
sect1, and appendix—has been assigned a column and that each occurrence of each
child-type is listed in the appropriate column. Note also that the table structure extends only to
the child level (the sect1 elements themselves are not displayed as a table). In order to
display sect1 elements as a table, select any of the sect1 elements in the sect1 column,
and click . The sect1 elements are now displayed in a table (see screenshot below): each of
their child elements is assigned a column in the sect1 table.
In each column, if a child element (title, simpara, or para) exists for one of the four
occurrences of sect1, then that cell has a white background (e.g. simpara in the first sect1).
If a child does not exist for an occurrence then the corresponding cell has a gray background
(e.g. para in first sect1). It should be apparent, therefore, that columns were assigned by
taking a union of all child elements of all sect1 occurrences, and creating a column for each
unique child-type.
Please note:
Attributes are also considered child nodes, and columns are also created for attributes.
You can switch between normal Grid View and Table View by selecting the desired
element and clicking or F12.
If you are viewing the document in Table View and you switch to Text View, when you
switch back to Grid View the document will display in normal Grid View.
Table View and a spreadsheet application. To move data from Table View to another
application, select the required nodes in the table and use the Copy as Structured Text option to
copy/paste the data directly into, say, an Excel sheet. (You can select nodes in Table View by
clicking the cells themselves, column headers, row headers (shown below), or the entire table.
If you click the entire table or column headers, then the text of the column headers is also
copied; otherwise it is not.)
The screenshot above shows 11 book elements displayed as a table in Table View. To copy the
entire table into an Excel sheet, you would select the book (11) element, copy it as structured
text, and paste it into an Excel sheet. If you were to select cell A1 and paste, the result would be
as shown below.
Data exchange works in both ways. So you can copy data from any spreadsheet-like application
and insert it directly into a table in Table View. Do this as follows:
1. Select a range in the external application and copy it (to the clipboard, in Windows
systems with Ctrl+C)
2. Select a single cell in Table View of your XML document.
3. Paste the copied data with Ctrl+V.
The data will be pasted into the table in XMLSpy with a cell structure corresponding to the
original structure and starting from the cell selected in Table View. The following points need to
be noted:
If data already exists in these cells in Table View, the new data overwrites the original
data.
If more rows are required to accommodate the new data, these are created.
If more columns are required to accommodate the new data, these are not created.
The data in the cells becomes the contents of the elements represented by the
respective cells.
For more complex data exchange tasks, XMLSpy also offers a set of unique conversion
functions that let you directly import or export XML data from any text file, Word document or
database.
To insert an element, select the appropriate tab and double-click the required element. Note
that mandatory elements are indicated with an exclamation mark. Siblings of allowed elements
that cannot themselves be inserted at the cursor point are unavailable.
Please note: In the Options dialog (Tools | Options | Editing), you can specify that
mandatory child elements are inserted when an element is inserted.
To use the attributes in the Append and Insert tabs, select, in Grid View, an existing
attribute or an element that is a child of the attribute's parent element, and double-click
the required attribute in the Entry Helper.
To use the attributes in the Add Child tab, select the attribute's parent element in Grid
View and double-click the required attribute in the Entry Helper.
Please note: Existing attributes, which cannot legally be added to the current element a second
time, are shown in gray.
To use the cursor to insert an entity in Grid View, place the cursor at the required position in a
text field or select the required field; then select the appropriate tab, and double-click the entity.
Note the following rules:
If the cursor is placed within a text field (including an attribute value field), the entity is
inserted at the cursor insertion point.
If an element with a text-only child (i.e. #PCDATA or simpleType) is selected but the
cursor is not placed in the text field, then any existing text content is replaced by the
entity.
If a non-text field is selected, then the entity is created as text at a location
corresponding to the Entry Helper tab that you select.
Please note: If you add an internal entity, you will need to save and reopen your document
before the entity appears in the Entities Entry Helper.
You can switch from Schema Overview to the content model of a specific global component by
clicking the icon of that global component. To return to Schema Overview, click the Show
Globals icon in Content Model View.
Connecting to SchemaAgent
From XMLSpy you can also connect to SchemaAgent in order to display components from other
schemas in the GUI and to use these components in the schema being currently edited. How to
work with SchemaAgent in XMLSpy is described in the section Working with SchemaAgent.
Find in schemas
The Find in Schemas features enables intelligent searches in schemas, i.e., searches that are
restricted by various schema-related criteria. For example, searches may be restricted to
certain component types, thus making the search more efficient. Find in Schemas is described
in the DTDs and XML Schemas section.
You can insert, append, or delete global components, as well as modify their properties. To
insert, append, or delete, use the respective buttons at the top of Schema Overview. To modify
properties, select the required component in the Schema Overview list, and edit its properties in
either the entry helpers (at right of view) or the Attributes/Identity Constraints pane (at bottom of
view).
You can edit the content model of a global component in Content Model View, which is
accessed by clicking the Content Model View icon at the left of the global component.
These components are called global components. The Schema Overview displays a list of all
global components in your schema in a tabular form. Some global components (such as
complex types, element declarations, and model groups) can have a content model which
describes the component's structure and contents. Other global components (such as
annotations, simple types, and attribute groups) do not have a content model. Those
components for which content models are possible have a icon to the left of the component
name. Clicking on this icon opens the Content Model View for that global component.
Key terms
Simple type and complex type. A simple type is used to define all attributes and
elements that contain only text and that have no associated attribute. A simple type,
therefore, has no content model—only text (which can be restricted by the datatype). A
complex type is one that has at least one child element or attribute. Declaring a child
element on an element automatically assigns the element a type of complex.
Global and local components. A global component can be any of the five listed above. A
global component can be defined in Schema Overview, and it then immediately
appears in the list of global components in Schema Overview. If the global component
is a complex type, an element declaration, or a model group, you can subsequently
define its content model by editing it in Content Model View. Once a global component
has been defined, it can be referenced by local components. A local component is
created directly within the content model of some component. Note that, in the Content
Model View, a local component can be converted into a global component (via the
right-click context menu).
1. Click the Insert or Append icon at the top of the Schema Overview. This pops
up a menu listing the various component types (element, simple type, complex type,
model group, etc).
2. Select the type of component you want. An entry of that type is created in the list of
global components.
3. Enter the name of the component in the entry, and press Enter. The name of the new
global component is added to the appropriate list/s (Elm, Grp, Com, Sim, etc.) in the
Component Navigator entry helper. You can edit the content model of the new global
component either by double-clicking the component name in the Component Navigator
or by clicking the icon to the left of the new component's name in the list of global
components.
Please note:
You can also create a global component while editing in Content Model View.
Right-click anywhere in the window and select New Global | Element.
While editing in Content Model View, you can make a local element a global element—
or even a complex type if the element has an element or attribute child. Select the local
element, right-click anywhere in the window, and select Make Global | Element or
Make Global | Complex type.
To define attributes for a global component for which attributes are allowed:
1. Select the global component in the global components list.
3. Click the Append or Insert icon at the top left of the Attribute tab.
4. From the popup that appears, select the attribute type you want to append or insert. An
entry is created in the Attribute list.
5. In the newly created entry, enter the attribute's properties.
Please note: You can also define attributes for global components in Content Model View:
Select the global component, and then define attributes as described above.
The content model is displayed in the Content Model View as a tree (see screenshot below).
You can configure the appearance of the tree in the Schema Display Configuration dialog
(menu item Schema design | Configure view).
These features are explained in detail in the subsections of this section and in the tutorial.
To return to the Schema Overview, click the Show Globals icon or select the menu option
Schema design | Display All Globals.
All other schema components (annotations, attribute declarations, simple types, etc.) do not
have a content model.
In Content Model View, the various parts of the content model are represented graphically,
These parts are organized into two broad groups: compositors and components. Typically a
compositor is added and then the desired child components.
Compositors
A compositor defines the order in which child elements occur. There are three compositors:
sequence, choice, and all.
To insert a compositor:
1. Right-click the element to which you wish to add child elements
2. Select Add Child | Sequence (or Choice or All).
Sequence
Choice
All
To change the compositor, right-click the compositor and select Change Model | Sequence (or
Choice or All). After you have added the compositor, you will need to add child element/s or a
model group.
Details: The rectangle indicates an element and the solid border indicates that the
element is required. The absence of a number range indicates a single element (i.e.
minOcc=1 and maxOcc=1). The name of the element is Country. The blue color
indicates that the element is currently selected; (a component is selected by clicking it).
Details: The rectangle indicates an element and the dashed border means the element
is optional. The absence of a number range indicates a single element (i.e. minOcc=0
and maxOcc=1). Element name is Location.
Note: The context menu option Optional converts a mandatory element into an optional
one.
Details: The rectangle indicates an element and the solid border indicates that the
element is required. The number range 1..5 means that minOcc=1 and maxOcc=5.
Element name is Alias.
Details: The rectangle indicates an element and the solid border indicates that the
element is required. The number range 1..infinity means that minOcc=1 and
maxOcc=unbounded. The plus sign means complex content (i.e. at least one element
or attribute child). Element name is Division.
Note: The context menu option Unbounded changes maxOcc to unbounded.
Clicking on the + sign of the element expands the tree view and shows the child
elements.
Details: The arrow in the bottom-left means the element references a global element.
The rectangle indicates an element and the solid border indicates that the element is
required. The number range 1..infinity means that minOcc=1 and
maxOcc=unbounded. The plus sign indicates complex content (i.e. at least one
element or attribute child). Element name is xs:field.
Note: A global element can be referenced from within simple and complex type
definitions, thus enabling you to re-use a global declaration at multiple locations in your
schema. You can create a reference to a global element in two ways: (i) by entering a
name for the local element that is the same as that of the global element; and (ii) by
right-clicking the local element and selecting the option Reference from the context
menu. You can view the definition of a global element by holding down Ctrl and
double-clicking the element. Alternatively, right-click, and select Go to Definition. If you
create a reference to an element that does not exist, the element name appears in red
as a warning that there is no definition to refer to.
Complex type
Details: The irregular hexagon with a plus sign indicates a complex type. The complex
type shown here has the name keybase. This symbol indicates a global complex type.
A global complex type is declared in the Schema Overview, and its content model is
typically defined in Content Model View. A global complex type can be used either as (i)
the data type of an element, or (ii) the base type of another complex type by assigning it
to the element or complex type, respectively, in the Details entry helper (in either
Content Model View or in Schema Overview).
The keybase complex type shown above was declared in Schema Overview with a
base type of xs:annotated. The base type is displayed as a rectangle with a dashed
gray border and a yellow background color. Then, in Content Model View, the child
elements xs:selector and xs:field were created. (Note the tiny arrows in the
bottom left corner of the xs:selector and xs:field rectangles. These indicate that
both elements reference global elements of those names.)
A local complex type is defined directly in Content Model View by creating a child
element or attribute for an element. There is no separate symbol for local complex
types.
Please note: The base type of a content model is displayed as a rectangle with a
dashed gray border and a yellow background color. You can go to the content model of
the base type by double-clicking its name.
Model group
Details: The irregular octagon with a plus sign indicates a model group. A model group
allows you to define and reuse element declarations.
Note: When the model group is declared (in Schema Overview) it is given a name. You
subsequently define its content mode (in Content Model View) by assigning it a child
compositor that contains the element declarations. When the model group is used, it is
inserted as a child, or inserted or appended within the content model of some other
component (in Content Model View).
Wildcards
Attributes
Details: Indicated with the word 'attributes' in italics in a rectangle that can be expanded.
Each attribute is shown in a rectangle with a (i) dashed border if the attribute is options,
or (ii) a solid border if the attribute is required (mandatory).
Note: Attributes can be edited in the Details Entry Helper. Attributes can be displayed in
the Content Model View diagram or in a pane below the Content Model View. You can
toggle between these two views by clicking the Display Attributes icon. When
attributes are displayed in the Content Model View diagram, all attributes of a single
element are displayed in a rectangle with a dashed border. To change the order of
attributes of an element, drag the attribute outside the containing box and drop when
the arrow appears at the required location.
Identity constraints
Details: Indicated with the word 'constraints' in italics in a rectangle that can be
expanded.
Note: The identity constraints listed in the content model of a component show
constraints as defined with the key and keyref elements, and with the unique
element. Identity constraints defined using the ID datatype are not shown in the content
model diagram, but in the Details Entry Helper. Identity constraints can be displayed
and edited in the Content Model View or in the Identity Constraints tab of Schema
Overview. In Content Model View, you can toggle the Constraints box on and off with
Please note:
Property descriptor lines you have defined in the Schema Display Configuration dialog
can be turned on and off by clicking the Add Predefined Details toolbar icon.
You can toggle Attributes and Identity Constraints to appear either in the diagram of the
content model itself or in a pane below the Content Model View by clicking the Display
in Diagram icons for attributes and constraints, and respectively.
In Content Model View, you can jump to the content model view of any global
component within the current content model by holding down the CTRL key and
double-clicking the required component. You can go to the content model of a base
type by double-clicking the name of the base type.
Changing a compositor
1. Right-click the compositor you want to change.
2. Select the context menu option Change Model and, from the sub-menu, select the
Do this as follows:
1. Right-click the compositor or component for which the occurrence value has to be
changed.
2. Select the context menu option Optional to set minOccurs to 0, deselect Optional to
set minOccurs to 1. Select the context menu option Unbounded to set maxOccurs
to unbounded, deselect Unbounded to set maxOccurs to 1. A check mark appears to
the left of the respective menu item when that menu item is selected.
Do this as follows:
1. Right-click the element.
2. Select the context menu option Reference. If the global element is referenced, then the
menu item is checked. If the local definition is used, the Reference item in the menu is
not checked.
Do this as follows:
1. Right-click the global component. The global component could be the yellow rectangle
of a base type; an element that references a global element; or a model group.
2. Select the context menu option Go to Definition. This opens the Content Model View
of that global component.
Alternatively, double-click the name of the base type, or press Ctrl and double-click the
referencing element or the model group.
Do this as follows:
1. Right-click the compositor or component.
2. Select the context menu option Edit Annotation. This highlights the documentation
space below the compositor/component, in which you can enter descriptive text about
the compositor or component. In Text View, the annotation and
annotation/documentation elements will have been created and the
documentation element will contain the descriptive text you enter.
Alternatively, you can right-click the compositor or component and select Whole Annotation
Data. In the Annotation dialog that opens, you can append or insert a documentation item and
enter content for it.
In order to edit pre-existing documentation text, you can use either of the two methods
described above, but a quicker method is to double-click the annotation in the diagram and edit
directly.
2. Select the context menu option Whole Annotation Data. The Annotation dialog box
opens (see screenshot below). If annotation (either documentation or appinfo) exists for
that element, then this is indicated by a corresponding row in the dialog.
3. To create an appinfo element, click the Append or Insert icon at top left to
append or insert a new row, respectively.
4. In the Kind field of the new row, select the app option from the dropdown menu.
5. In the Content pane of the dialog, enter the script or info that you want to have
processed by a processing application.
6. Optionally, in the Source field, you can enter a source URI where further information
can be made available to the processing application.
Given below is the text of an annotation element. It is based on the example in the description
of creating documentation and application information given above.
<xs:element name="session_date" type="xs:dateTime" nillable="true">
<xs:annotation>
<xs:documentation>Date and time when interview was
held</xs:documentation>
<xs:appinfo
source="http://www.altova.com/datehandlers/interviews">separator =
:</xs:appinfo>
</xs:annotation>
</xs:element>
you have defined can be turned on and off by clicking the Add Predefined Details toolbar
icon. You can toggle between a view containing the defined properties and a view not containing
them.
2. Press Enter to confirm. The Details entry helpers will be updated to reflect your
changes.
Alternatively, you can edit a component's properties in the Details entry helper, and changes will
be reflected in the placeholder fields—if these are configured to be displayed.
Component Navigator
The Component Navigator is an Entry Helper in Schema View. It serves three purposes:
To organize global components in a tree view by component type and namespace (see
screenshots below). This provides organized overviews of all global components.
To enable you to navigate to and display the Content Model View of a global component
—if the component has a content model. If a component does not have a content
model, the component is highlighted in the Schema Overview. Global components that
are included or imported from other schemas are also displayed in the Component
Navigator.
To provide an overview of the identity constraints defined in the schema document. For
a description of the Identity Constraints tab, see Identity Constraints Overview.
In the Globals tab (above) global components are grouped in a tree according to their
component type. In the Namespace tab (below), components are organized first
according to namespace and then according to component type. Note that a
component type is listed in a tree only if at least one component of that type exists in
the schema.
In the tree display, global components are organized into the following six groups:
Element Declarations (Elements)
Model Groups (Groups)
Complex Types
Simple Types
Attribute Declarations (Attributes)
Attribute Groups
Expanding a component-type group in the tree displays all the components in that group (see
screenshot). This enables you to easily navigate to a required component.
To change the properties of the currently selected compositor or component, double-click the
field to be edited and edit or enter text directly. If a combo box is available in the field to be
edited, select the desired value; this value is entered in the field.
Changes you make via the Details Entry Helper are immediately reflected in the content model
diagram.
To change facets, patterns, Sample Values, or enumerations in the Facets Entry Helper:
Note:
You can use the cut, copy and paste shortcuts (CTRL+X, CTRL+C, CTRL+V,
respectively) to copy the patterns and enumerations of one component to another
component. In the Facets Entry Helper, select the pattern/s or enumeration/s to copy,
cut or copy the selection, then click in the Facets Entry Helper window of the target
component, and paste.
Sample values can be used when generating an XML file from the schema (with the
menu command DTD/Schema | Generate Sample XML File).
In this section, we describe these two mechanisms for creating and editing identity constraints.
An overview of all identity constraints in the schema is available in the Identity Constraints tab of
the Components entry helper; this is described further below.
3. Click the Append or Insert icon at the top left of the Identity Constraints tab.
4. From the popup that appears (screenshot below), select the type of identity constraint
you want to append or insert: Unique, Key, or Keyref.
selector and field elements. For each location step in these XPath expression, a
pop-up containing the available nodes appears (see screenshot below). For the refer
element of the keyref kind of identity constraint, a dropdown list shows the available
key elements (see screenshot below).
If you wish to define multiple field elements on an identity constraint, select the identity
constraint, click the Append or Insert icon (see Step 3 above), and select Field. An
empty Field entry box is added to the selected identity constraint. Enter the required
XPath expression in the Field entry box.
Note: An ID can be assigned to any of these elements (that is, to the identity constraint, its
selector, and/or field/s). To assign an ID, select the element and, in the Details entry
helper, enter the ID in the id row.
Note: The Visualize ID Constraints icon switches on ID Constraint editing and validating
functionality in Schema View. If an XPath expression in an ID Constraint does not
locate a node, an error or warning might be displayed. This error or warning is to alert
you to the incorrect XPath expression; the XML Schema document itself is not invalid
because of the incorrect XPath expression. To re-check the validity of the document
without the XPath expression check, switch to Text View or Grid View and validate. You
can also disable validation in Schema View by toggling the Visualize ID Constraints
icon off.
The screenshot below shows the graphical display of identity constraints. There are two identity
constraints in the identity constraints box: TeamKey and TeamKeyRef. The properties of
TeamKeyRef are highlighted with a solid green line (since TeamKeyRef is selected). The
properties of TeamKey (unselected) are shown with a dotted green line. For each identity
constraint the node selected by the XPath expression for selector and field are show with
the icons and respectively. If a node is collapsed, as is the case with the field element
of the TeamKey constraint, the relationship line ends with an ellipsis (see screenshot below).
5. To enter an ID attribute on any element in a constraint, select that element and enter a
value in the id row of the Details entry helper.
Note: Identity constraint information can be toggled on and off with the Enable ID Constraints
Information icon in the Schema Design toolbar. The display of the entire Constraint
box can be toggled on and off in the Schema Display Configuration dialog (Schema
Design | Configure View) or with the Display Constraints icon in the Schema
Design toolbar.
Entries in bold are present in the current schema, while those in normal face are present in
sub-schemas. Double-clicking an entry in the Identity Constraints tab selects that schema
component in Content Model View.
The following context menu commands are available when an item in the Identity Constraints
tab is selected:
Show in Diagram: selects the schema component in Content Model View.
Show Selector/Field Target in Diagram: selects, in Content Model View, the schema
component targeted by the selector or field of the identity constraint. In the case of
multiple fields, a dialog prompts the user for the required field.
Go to Identity Constraint: selects the identity constraint in Schema Overview.
Expand/Collapse All: expands or collapses the tree, respectively.
Smart Restrictions combine and correlate the two content models in the graphical view of the
derived content model. In the derived complex type, all particles of the base complex type, and
how they relate to the derived type, can be seen. Additionally, Smart Restrictions provide visual
hints to show you all possible ways to restrict the base type. This makes it easy to correctly
restrict the derived type.
The following complex type is the base type used in this example:
The complex type "derived" is derived from the "base" type as follows:
1. Create a new complex type in the schema and call it "derived".
2. In the Details Entry Helper select "base" from the base drop-down list and "restriction"
from the derivedBy drop-down list.
With Smart Restrictions switched on, the new derived type looks like this:
Notice the following controls that can be used to restrict the derived type in this example:
Use this icon to remove elements that are in the base type from the derived type.
Here, elem1 has been deleted. To add it again, click this icon .
Click the down arrow on the Choice compositor to get the following list, which allows
you to change the Choice model group to a Sequence model group:
It is also possible to change wildcards in the same way, as seen in this example:
For a complete list of which particles can be replaced by which other particles, see the
XML schema specification.
Change the number of occurrences of the model group using the following control
Here you can see that the minimum occurrence for this element has been changed to
2. Notice that the model group now has a blue background, which means that it is no
longer the same as the model group in the base complex type. Also, the permitted
occurrence range of the model group in the base particle is now displayed in
parentheses.
It is possible to change the data types of attributes or elements if the new data type is a
valid restriction of the base data type as defined in the XML schema specification. For
example, you can change the data type of elem3 in the "derived" data type from
decimal to integer. After you do this, the element has a blue background to show that is
different from the element in the base type, and the type that the element has in the
base type is displayed in parentheses:
This example shows attributes whose data types have been restricted in the derived
complex type:
Smart Restrictions alert you to pointless occurrences in the content model. A pointless
occurrence happens, for example, when a sequence that is present in the content
model is unnecessary. This example shows a pointless occurrence:
Please note: Pointless occurrences are only shown if the content model contains an
error. It is possible for a content model to contain a pointless occurrence and be valid,
in which case the pointless occurrence is not explicitly shown in order to avoid
confusion.
See the XML schema specification for more information about pointless occurrences.
In Schema View, once the XML Namespaces namespace has been imported into the XML
Schema document, these four xml: attributes can be referenced for use on any element in the
schema.
Do this by clicking the Insert or Append icon at the top of the Schema Overview
window and selecting Import from the menu that pops up. Enter the XML Namespaces
namespace as the namespace to be imported. In Text View, the import declaration should look
like this:
<xs:import namespace="http://www.w3.org/XML/1998/namespace"
schemaLocation="http://www.w3.org/XML/1998/namespace"/>.
the include element, the top-level element of the parsed XML document is included with an
xml:base attribute. If this XML document is going to be validated, then the schema must define
an xml:base attribute on the relevant element/s.
Additional notes
Note the following points:
The Back button enables you to re-view the previous 500 positions.
The Back/Forward feature is enabled across schemas. If a schema has since been
closed or is currently open in another view, it will be opened in Schema View or
switched to Schema View, respectively.
If a component that was viewed in a previous position is deleted, then that component
will not be able to be viewed. If such a component was part of a previous position, this
position will be displayed without the deleted component. If the component comprised
the entire position, the entire position will be unavailable, and clicking the Back button
at this point in the Back series will take you to the position previous to the unavailable
position.
The Main Window (consisting of the PortTypes (WSDL 1.1) or Interfaces (WSDL 2.0), Bindings,
and Services sections) and the Entry Helpers (Overview and Details) are described in the
sub-sections of this section. (For a description of how to work with projects, see Project Menu in
the User Reference section.)
File viewing
Note the following points concerning file viewing:
When you open a WSDL file, the file opens automatically in WSDL View.
You can also view a WSDL document in the Text and Enhanced Grid Views. To do this,
click on the appropriate tab.
If the WSDL file contains a reference to an XML Schema, then the schema can be
viewed and edited by selecting the menu command WSDL | Types | Edit Schema in
Schema View. This opens the schema file in the Schema View.
If an associated schema file is open, then you are not allowed to change the view of the
WSDL file (for example, from WSDL View to Text View). Before trying to change views
of the WSDL file, make sure that you have saved changes to the schema file and
closed the file.
There are two entry helpers to help you edit WSDL documents: Overview and Details. Both
entry helpers can be docked/undocked by double-clicking the title bar. When docked, the
auto-hide feature can be activated by clicking the drawing-pin icon in the title bar. When
auto-hidden, the entry helper is minimized as a tab at an edge of the application window. An
auto-hidden entry helper can be re-docked by rolling it out from the edge (by mousing over its
tab) and clicking the drawing-pin icon in the title bar.
Binding
Service
Fault
Operation. The green arrow represents inputs and the blue arrow represents outputs.
Depending on the type of operation, an appropriate symbol is used.
Message
XSD element
Port
Operations can be expanded to display their messages by clicking the icon at the
left of an operation name.
In WSDL 1.1 a message can contain a message part . Such messages can be
expanded to show the message part.
Right-clicking a component of a portType box (either portType, operation, message, or
message part), pops up a context menu from which relevant actions can be selected.
For example, right-clicking a portType name allows you, among other actions, to
append a new portType, append an operation to the selected portType, or create a
binding for the selected portType.
The optional WSDL 2.0 interface properties, extends, styleDefault, and documentation
are hidden if empty. They can be edited via the Edit command in the context menu of
the interface.
In WSDL 2.0 documents, properties of operations can be edited via the Edit command
in the context menu of the operation. The value of the style property is selected via a
The association of a portType or interface with a binding is indicated in the Main Window by a
black connector line linking the portType box or interface box to the binding box; the binding box
will be in the Bindings section of the Main Window.
Bindings
A binding defines message formats and protocol details for:
Operations defined by a particular portType (WSDL 1.1), or
Operations and faults defined by a particular interface (WSDL 2.0).
In WSDL 1.1, bindings can be created for SOAP 1.1 or SOAP 1.2 endpoints, or for HTTP 1.1's
GET and POST verbs. In WSDL 2.0, bindings can be created for SOAP 1.1 or SOAP 1.2
endpoints, or for HTTP. Each binding is represented by a binding box (screenshot below) in the
Bindings section of the Main Window. The binding box contains all the operations and/or faults
of the associated portType or interface (see screenshot below).
A binding can be associated with a port type or an interface in any of the following ways:
Right-click a port type or an interface and select the command Create binding for
portType or Create binding for interface, respectively.
Right-click a WSDL 1.1 binding and edit the PortType property.
Right-click a WSDL 2.0 binding and select the command Edit | Interface.
To define the binding, in the first combo box to the right of the binding name (screenshot below
), select the required protocol. In WSDL 1.1, this is either soap 1.1, soap 1.2, http-get, or
http-post to define the kind of binding. If you select a SOAP protocol, you can additionally
define (using the second combo box) whether the style should be doc or rpc. In WSDL 2.0
documents, the wsoap:protocol property can be added or edited via the Edit command of the
context menu of the binding.
In WSDL 1.1, MIME encodings (also referred to as MIME bindings) are defined at the message
level. To define a MIME encoding, right-click on the message (screenshot below) and append
the appropriate MIME definition. In the screenshot below, MIME definitions have been created
for the Output message.
Right-clicking a specific item in a binding box opens a context-sensitive menu. Using the
context menus, for example, bindings can be appended or deleted; extensibility items can be
edited; and messages defined. Note also that when a binding box or an item in a binding box is
selected, the definitions are displayed in the Details entry helper and can be edited there.
A port can be created for a binding by right-clicking the title bar of a binding box and selecting
the Create Port for Binding command (WSDL 1.1 documents) or Create Endpoint for
Binding command (WSDL 2.0 documents). The associated port or endpoint is created within a
service box (in the Services section of the Main Window). The association between a binding
and a port is indicated by a black connector line.
Services
A service groups together a set of related ports (WSDL 1.1) or endpoints (WSDL 2.0). It is
represented by a service box in the Services section of the Main Window (screenshot below).
Each service box consists of one or more port or endpoint declarations (see screenshot below).
The service name, port or endpoint name, the binding associated with a port or endpoint, and
the address information of a port or endpoint can be edited directly in the service box or in the
Details entry helper. Right-clicking a service box or a specific item in the service box opens a
context menu in which commands relevant to the service or that item are available.
Overview entry helper in WSDL 1.1 (left) and WSDL 2.0 (right).
In each category, components are displayed in a tree view. A tree item can be expanded and
collapsed, respectively, to reveal and to hide its contents. Selecting a component in the
Overview entry helper displays it and its properties in the Details entry helper, where the
properties can be edited. The names of WSDL and schema components that are displayed in
the tree can be edited directly in the trees. Externally defined components (those in included or
imported WSDL documents or schemas and displayed in gray), however, cannot be edited. The
individual categories in the Overview entry helper are explained below.
Target namespace (WSDL 1.1 and 2.0): Indicated in the tree by tns. The target namespace
can be edited in the Overview entry helper. All other namespaces must be edited in Text View.
Imports (WSDL 1.1): XML Schema (XSD) files and WSDL files can be imported into the active
WSDL document. To import a file, right-click the Imports item or an already imported file in the
Imports list, and select Add new import. Right-clicking an imported file in the Imports list pops
up a context menu in which you can choose to add a new import, select another file to replace
the selected file as an import (Edit import), or delete the imported file. You can also open the
file from its location. The file opens in WSDL View (.wsdl file) or Schema View (.xsd file), and
can be edited there.
WSDL includes, WSDL imports, Schema imports (WSDL 2.0): XML Schema (XSD) files can
be imported, and WSDL files can be included or imported, into the active WSDL document. To
include or import a file, right-click the respective item and add the include or import. The
namespace of an imported file is generated automatically from the target namespace of the
imported file.
Right-clicking an included or imported file pops up a context menu in which you can choose to
delete the file or open it in XMLSpy. The file opens in WSDL View (.wsdl file) or Schema View (
.xsd file), and can be edited there.
Types (WSDL 1.1 and 2.0): Lists all types defined in the WSDL document (in black) and in any
imported schema or WSDL document (in gray). You can create a new XSD element,
simpleType, or complexType by right-clicking any type in the list and selecting the appropriate
Add New command. A newly created type is added to the WSDL types definitions and is listed
under the Types item in the Overview entry helper.
A type defined in the WSDL document can be edited in XMLSpy's Schema View. To do this,
right-click the type you wish to edit and select Edit (Schema View) from the context menu that
pops up. This causes a temporary XSD file to be generated on the fly from the types definitions
in the WSDL document. This XSD document is displayed in Schema View and can be edited.
After you have finished editing the XSD document, saving the changes will cause the changes
to be saved back to the types definitions in the WSDL document. You can close the XSD
document without saving changes; in this case, the types definitions in the WSDL document
will not be modified.
Messages (WSDL 1.1): When a message or its sub-component is selected, the properties of
that message or sub-component are displayed in the Details entry helper, where they can be
edited. Additionally, you can do the following via the context menu:
With a message selected in the Overview entry helper, you can add a message part to
that message or delete the message, as well as add a new message.
With a message part selected in the Overview entry helper, you can add another
message part to that message or delete the selected message part.
The Synchronize command highlights the selected message or message part in the
relevant portType box.
PortTypes (WSDL 1.1): For portTypes, the following functionality is available via context
menus.
Right-clicking a message element pops up a menu via which you can delete the
selected message.
Clicking the Synchronize command highlights the selected interface, operation, or
message in the design.
Bindings (WSDL 1.1 and 2.0): With a binding selected, additional bindings can be appended to
the already-existing bindings, the selected binding can be deleted, and operations inserted for
the selected binding. With an operation or message selected, the same options are available as
described for operations and messages in the PortTypes (WSDL 1.1) or Interfaces (WSDL 2.0)
category. Clicking the Synchronize command highlights the selected binding, operation, or
message.
Services (WSDL 1.1 and 2.0): With a service selected, additional services can be added, the
selected service can be deleted, and ports can be added for the selected service. Clicking the
For example, as shown in the screenshot above, if, in the Main Window, the port
TimeServiceSoap (of the TimeService service) is selected, then the properties of
TimeServiceSoap are displayed in the Details entry helper, where they can be edited. To edit a
text field such as for name or description, double-click in the field and edit the text. For some
properties, such as binding in the screenshot example above, where a selection can be made
from among options, a combo box allows you to select from the available options.
Three powerful entry helpers: Overview, Global Elements, Details. These entry helpers
enable you to manage taxonomy files and edit the taxonomy in the Main Window.
A Messages window which displays messages about the validity of the taxonomy.
This section provides a description of the Main Window and entry helpers of XBRL View and
information about how to use them. For more related information, see the sections XBRL and
the description of commands in the XBRL menu.
Sorting elements
In the Sort combo box located below the tabs of the Main Window and to the right (screenshot
below), you can sort the elements in the Main Window.
(To see the text definitions of an imported taxonomy document, the imported taxonomy
document will have to be opened in XMLSpy.)
<xs:element id="icui_UnrealizedHoldingLoss"
name="UnrealizedHoldingLoss"
substitutionGroup="xbrli:item"
type="xbrli:monetaryItemType"
xbrli:balance="credit"
xbrli:periodType="instant"
abstract="false"
nillable="true"/>
Each element (or concept) is displayed in the Elements tab with an icon indicating its
substitution group (item, tuple, hypercube, or dimension). Additionally, icons indicating the
values of the concept's balance, periodType, abstract, and nillable attributes are
displayed to the left of the concept name (screenshot below).
To edit the name of the concept, double-click the name of the concept and edit the name.
Substitution group
The substitution group value of a concept is indicated by the concept's icon:
xbrli:item
xbrli:tuple
xbrldt:hypercubeItem
xbrldt:dimensionItem
Note that the xbrli: attributes listed above are from the XBRL schema and the xs: attributes
are from the XML Schema schema.
In the screenshot above, the plus icon indicates that the value of the xbrli:balance attribute
is credit. The values of the other attributes in the screenshot (xbrli:periodType, xs:
abstract, xs:nillable), respectively, are: duration, false, (i.e. not abstratct), and true (i.e.
nillable).
The values of these four attributes are displayed in a popup when the cursor is placed over any
of the four icons. Clicking any of these icons pops up a list box containing the allowed values for
that attribute. You can select one of the allowed choices, and in this way edit the value of
These attribute values can also be edited in the Details entry helper (screenshot below).
In the screenshot above, the value of the xs:substitutionGroup and xs:type attributes are,
respectively: xbrli:item and xbrli:monetaryItemType. These values can be edited by
selecting alternative values from the dropdown list of the corresponding combo boxes. Both
attribute values can also be edited in the Details entry helper (see screenshot further above) by
double-clicking in the respective value field in the Details entry helper and editing the value via
the keyboard.
Label links
To add a label child, right-click an element and select Add Label Linkrole from the context
menu. This adds a label row (screenshot below), in which you can specify the label's properties
(language, label type, and value). You can expand and collapse labels by clicking the + and -
icons on the right edge of the box.
The language and label type properties of each label can be edited by selecting the required
property value from in respective combo boxes (screenshot above).
Reference links
To add a reference chid, right-click an element and select Add Reference Linkrole from the
context menu. This adds a reference box, in which the properties of the reference can be edited
by clicking in the Reference field and editing the reference URN. You can expand and collapse
references by clicking the + and - icons on the right edge of the box.
Each tab (Definition, Presentation, and Calculation) displays the taxonomy relationships of that
kind (screenshot below) and allows you to edit the relationships graphically. A relationship
between two concepts (whether a definition, presentation, or calculation relationship) is created
by building an arc from one concept to another concept. This from–to arc is indicated in the
graphical display as a curved arrow. The relationship between the two concepts (in the
direction from–to) is specified and is known as its arcrole. The arcrole of an arc is shown in the
Details entry helper when the element at the to-end of a relationship is selected, and, in the
case of definition relationships, in an Arcrole column in the Definitions tab (see screenshot
below).
The way the relationship arcs are displayed is the same for all kind of relationships (definition,
presentation, and calculation). In this section, each tab is considered separately, with the basic
description of how relationships are displayed being in the section on the Definitions tab.
Additional or specific information about presentation and calculation arcs are in the respective
sections. For more detailed information, see the sections, Creating Relationships: Part 1 and
Creating Relationships: Part 2.
Definitions tab
The Definitions tab shows all the definitions of the taxonomy. These definitions are specified in
definition arcs contained in definition relationships (.xml) file/s. In the Definitions tab of XBRL
View, the structure resulting from the set of definition arcs is displayed in an expandable/
collapsible tree form (screenshot below).
In this graphical display of the definitions, each definition arc is displayed as a curved arrow with
two endpoints (a from endpoint and a to endpoint). The type of relationship between the two
elements at either endpoint is displayed in the Arcrole column of the element at the to endpoint.
For example, in a hypercube–dimension relationship, the relationship (or arcrole) is listed with
the element that is the dimension part of the element pair. Arcrole URIs can also be entered in
the Details entry helper.
For more information on definitions relationships, see the section Creating Relationships: Part 1
.
Presentation tab
Presentation arcs have the same attributes as definition arcs, and they work in the same way
(see Definitions tabs above). Arcrole URIs are entered in the Details entry helper. One
important presentation attribute is the order attribute, which determines the order in which child
elements of a single parent element are presented. In the Presentation tab, such child elements
are displayed in correct ascending order. The value of the order attribute can be changed
quickly by dragging a child element to another position in the ordered list. The value of the
order attribute can also be changed in the Details entry helper (see screenshot below).
For more information on presentation relationships, see the section Creating Relationships: Part
2.
Calculation tab
Calculation arcs have the same attributes as definition arcs, and they work similarly to definition
arcs (see Definitions tabs above). Arcrole URIs are entered in the Details entry helper. There
are two types of arcroles:
those that sum the values of elements to another element; and
those that do not represent a summation relationship but an equivalent relationship
In the case of the former the weight attribute determines how much of the value of that element
is summed up to the aggregator element. A value of 1.0 indicates that 100% of the value
should be summed up. A negative value indicates that the value must be subtracted from the
aggregator. The value of the weight attribute can be edited in the Calculation tab as well as in
the Details entry helper.
Additionally, properties of the arc of the selected element are displayed in Arc section of the
Details entry helper. The arc will be a definition arc, presentation arc, or calculation arc
according to what tab is currently active. The arcrole can be entered in the Arcrole field.
Label and reference relationships are listed under the Children heading. These relationships
can be edited in the Elements tab.
This information displayed in the Overview entry helper is obtained from the /schema/
annotation/appinfo element of the main concepts file. See Taxonomy Files for more
information about this element.
Right-clicking a file in the Overview entry helper pops out a context menu (screenshot below), in
which the following commands are available:
Open File: opens the selected XML Schema or XML file in XMLSpy.
Set Default Linkbase: If there are multiple files of a single relationship kind (for
example, presentation relationships), then one of these can be set as the default
linkbase. Newly created relationships will be saved in the default linkbase of its
particular relationship kind. The default linkbase of each relationship kind is displayed in
bold.
Set Linkbase Kind: Specifies the relationship kind of the selected linkbase. Select the
required relationship kind from the submenu that rolls out. The All relationship kind
specifies that the selected linkbase will be used for all relationship kinds.
Add New Linkbase: Creates a new linkbase file to contain relationships of one of the
five kinds (definition, presentation, calculation, label, resource). The added file can be
renamed by right-clicking it and selecting the Rename command in the context menu. A
new linkbaseRef element is added to the concepts file; this element references the
newly added linkbase.
Import/Reference: Imports a standard taxonomy or creates a reference to an existing
XML Schema or linkbase. If you select the standard taxonomy option, a window
containing a list of standard taxonomies pops up. Select the taxonomy you wish to
import; see Importing a Taxonomy for details. If you create a reference to an XML
schema or linkbase, a new linkbaseRef element containing the reference is added to
the concepts file. Clicking either the XML Schema or linkbase option pops up a dialog in
which you can browse for the required file.
Set Target Namespace: Sets the target namespace and declares this namespace to be
in scope on the xs:schema element (that is, for the entire taxonomy). See the
description of the command XBRL | Set Target Namespace.
Rename: Enables the selected file to be renamed.
Remove: Removes the selected file from the Overview and its linkbaseRef element
from the concepts file.
After the Text Filter has been selected, in the combo box at the right-hand side of the
Text Filter bar (under the arrow cursor in the screenshot above), choose a condition
with which to filter. The available options are Contains, Does not contain, and Starts
with. In the screenshot above, the Starts with condition has been selected. Next, enter
the text for the filter in the Text Filter box. The displayed elements will be filtered
accordingly. In the screenshot above, the list is filtered by names that begin with n1.
Note that: (i) the filters work on the names of the entries as text strings, and (ii) the
names of entries can be changed with the Format icon (see below) and are sensitive to
the changes in name formats.
Filtering by sources: The required sources can be selected in a popup, and only the
elements in the selected sources will be displayed.
Format: There are three format options for the way names of elements are displayed:
Short qualified names , Expanded qualified names, and Labels. The short qualified
name uses the prefixes assigned to the respective namespaces; expanded qualified
name (icon is ) uses the whole namespace; and label uses the labels associated
with elements. Note that the format selection affects the Text Filter option, in that the
filter is applied to elements as listed according to the currently selected Format option.
Drag-and-drop functionality: Elements in the Global Elements entry helper can be
dragged and dropped into relationships in any of the relationships views of the Main
Window (Definitions, Presentations, Calculations)
The properties of some elements can be edited in the Details entry helper: Abstract, Nillable,
Balance, Period Type, Substitution Group, and Type.
Menu bar
The menus available in the menu bar are described in detail in the User Reference section of
your product documentation.
Toolbar
The symbols and icons displayed in the toolbar are described in the section, Authentic View
toolbar icons.
Project window
You can group XML, XSL, HTML schema, and Entity files together in a project. To create and
modify the list of project files, use the commands in the Project menu (described in the User
Reference section of your product documentation). The list of project files is displayed in the
Project window. A file in the Project window can be accessed by double-clicking it.
Main window
This is the window in which the XML document is displayed and edited. It is described in the
section, Authentic View main window.
Entry helpers
There are three entry helper windows in this area: Elements, Attributes, and Entities. What
entries appear in these windows (Elements and Attributes Entry Helpers) are context-sensitive,
i.e. it depends on where in the document the cursor is. You can enter an element or entity into
the document by double-clicking its entry helper. The value of an attribute is entered into the
value field of that attribute in the Attributes Entry Helper. See the section Authentic View Entry
Helpers for details.
Status Bar
The Status Bar displays the XPath to the currently selected node.
Context menus
These are the menus that appear when you right-click in the Main Window. The available
commands are context-sensitive editing commands, i.e. they allow you to manipulate structure
and content relevant to the selected node. Such manipulations include inserting, appending, or
deleting a node, adding entities, or cutting and pasting content.
Hide markup. All XML tags are hidden except those which have been collapsed.
Double-clicking on a collapsed tag (which is the usual way to expand it) in Hide
markup mode will cause the node's content to be displayed and the tags to be
hidden.
Show small markup. XML element/attribute tags are shown without names.
Show large markup. XML element/attribute tags are shown with names.
Show mixed markup. In the StyleVision Power Stylesheet, each XML element or
attribute can be specified to display (as either large or small markup), or not to
display at all. This is called mixed markup mode since some elements can be
specified to be displayed with markup and some without markup. In mixed markup
mode, therefore, the Authentic View user sees a customized markup. Note,
however, that this customization is created by the person who has designed the
StyleVision Power Stylesheet. It cannot be defined by the Authentic View user.
The dynamic table editing commands manipulate the rows of a dynamic SPS table. That is, you
can modify the number and order of the element occurrences. You cannot, however, edit the
columns of a dynamic SPS table, since this would entail changing the substructure of individual
element occurrences.
The icons for dynamic table editing commands appear in the toolbar, and are also available in
the Authentic menu.
Please note: These commands apply only to dynamic SPS tables. They should not be used
inside static SPS tables. The various types of tables used in Authentic View are described in
the Using tables in Authentic View section of this documentation.
The commands corresponding to these icons are not available as menu items. Note also that
for you to be able to use XML tables, this function must be enabled and suitably configured in
the StyleVision Power Stylesheet.
A detailed description of the types of tables used in Authentic View and of how XML tables are
to be created and edited is given in Using tables in Authentic View.
The arrow icons are, from left to right, Go to First Record in the DB; Go to
Previous Record; Open Go to Record # dialog; Go to Next Record; and Go to Last Record.
This icon opens the Edit Database Query dialog in which you can enter a query.
Authentic View displays the queried record/s.
To switch between modes, use the commands in the Authentic menu or the icons in the
toolbar (see the previous section, Authentic View toolbar icons).
Large markup
This shows the start and end tags of elements and attributes with the element/attribute names
in the tags:
The element Name in the figure above is expanded, i.e. the start and end tags, as well as the
content of the element, are shown. An element/attribute can be contracted by double-clicking
either its start or end tag. To expand the contracted element/attribute, double-click the
contracted tag.
In large markup, attributes are recognized by the equals-to symbol in the start and end tags of
the attribute:
Small markup
This shows the start and end tags of elements/attributes without names:
Notice that start tags have a symbol inside it while end tags are empty. Also, element tags have
an angular-brackets symbol while attribute tags have and equals sign as its symbol (see
screenshot below).
Mixed markup
Mixed markup shows a customized level of markup. The person who has designed the
StyleVision Power Stylesheet can specify either large markup, small markup, or no markup for
individual elements/attributes in the document. The Authentic View user sees this customized
Content display
In Authentic View, content is displayed in two ways:
Plain text. You type in the text, and this text becomes the content of the element or the
value of the attribute.
Data-entry devices. The display contains either an input field (text box), a multiline input
field, combo box, check box, or radio button. In the case of input fields and multiline
input fields, the text you enter in the field becomes the XML content of the element or
the value of the attribute.
In the case of the other data-entry devices, your selection produces a corresponding
XML value, which is specified in the StyleVision Power Stylesheet. Thus the selection
"approved" in the display example below could map to an XML value of "1", or to
"approved", or anything else; while "not approved" in the display could map to "0", or
"not approved", or anything else.
Optional nodes
When an element or attribute is optional (according to the referenced schema), a prompt of
type add [element/attribute] is displayed:
Clicking the prompt adds the element, and places the cursor for data entry. If there are multiple
optional nodes, the prompt add... is displayed. Clicking the prompt displays a menu of the
optional nodes.
The Elements and Attributes Entry Helpers are context-sensitive, i.e. what appears in the entry
helper depends on where the cursor is in the document. The entities displayed in the Entities
Entry Helper are not context-sensitive; all entities allowed for the document are displayed no
matter where the cursor is.
the Elements Entry Helper are listed below, together with an explanation of what they
mean.
Remove Element
Removes the element and its content.
Insert Element
An element from the Entry Helper can also be inserted within an element.
When the cursor is placed within an element, then the allowed child elements
of that element can be inserted. Note that allowed child elements can be part of
an elements-only content model as well as a mixed content model (text plus
child elements).
An allowed child element can be inserted either when a text range is selected
or when the cursor is placed as an insertion point within the text.
When a text range is selected and an element inserted, the text range
becomes the content of the inserted element.
When an element is inserted at an insertion point, the element is inserted at
that point.
After an element has been inserted, it can be cleared by clicking either of the
two Clear Element icons that appear (in the Elements Entry Helper) for these
inline elements. Which of the two icons appears depends on whether you
select a text range or place the cursor in the text as an insertion point (see
below).
Apply Element
If you select an element in your document (by clicking either its start or end tag
in the Show large markup view) and that element can be replaced by another
element (for example, in a mixed content element such as para, an italic
element can be replaced by the bold element), this icon indicates that the
element in the Entry Helper can be applied to the selected (original) element.
The Apply Element command can also be applied to a text range within an
element of mixed content; the text range will be created as content of the
applied element.
If the applied element has a child element with the same name as a child
of the original element and an instance of this child element exists in the
original element, then the child element of the original is retained in the new
element's content.
If the applied element has no child element with the same name as that
of an instantiated child of the original element, then the instantiated child of
the original element is appended as a sibling of any child element or
elements that the new element may have.
If the applied element has a child element for which no equivalent
exists in the original element's content model, then this child element is not
created directly but Authentic View offers you the option of inserting it.
The Attributes Entry Helper shown in the figures below has a para element in the combo box.
Clicking the arrow in the combo box drops down a list of all the para element's ancestors up
to the document's root element, which in this case is OrgChart.
Below the combo box, a list of valid attributes for that element is displayed, in this case for para
. If an attribute is mandatory on a given element, then it appears in bold. (In the example below,
there are no mandatory attributes.)
To enter a value for an attribute, click in the value field of the attribute and enter the value. This
creates the attribute and its value in the XML document.
In the case of the xsi:nil attribute, which appears in the Attributes Entry Helper when a
nillable element has been selected, the value of the xsi:nil attribute can only be entered by
selecting one of the allowed values (true or false) from the dropdown list for the attribute's
value.
Note: An internal entity is one that has its value defined within the DTD. An external entity is
one that has its value contained in an external source, e.g. another XML file. Both
internal and external entities are listed in the Entities Entry Helper. When you insert an
entity, whether internal or external, the entity—not its value—is inserted into the XML
text. If the entity is an internal entity, Authentic View displays the value of the entity. If
the entity is an external entity, Authentic View displays the entity—and not its value.
This means, for example, that an XML file that is an external entity will be shown in the
Authentic View display as an entity; its content does not replace the entity in the
Authentic View display.
You can also define your own entities in Authentic View and these will also be displayed in the
entry helper: see Define Entities in the Editing in Authentic View section.
Inserting elements
The figure below shows the Insert submenu, which is a list of all elements that can be inserted
at that current cursor location. The Insert Before submenu lists all elements that can be
inserted before the current element. The Insert After submenu lists all elements that can be
inserted after the current element. In the figure below, the current element is the para element.
The bold and italic elements can be inserted within the current para element.
As can be seen below, the para and Office elements can be inserted before the current
para element.
The node insertion, replacement (Apply), and markup removal (Clear) commands that are
available in the context menu are also available in the Authentic View entry helpers and are fully
described in that section.
Insert entity
Positioning the cursor over the Insert Entity command rolls out a submenu containing a list of all
declared entities. Clicking an entity inserts it a the selection. See Define Entities for a
description of how to define entities for the document.
Remove node
Positioning the mouse cursor over the Remove command pops up a menu list consisting of the
selected node and all its removable ancestors (those that would not invalidate the document) up
to the document element. Click the element to be removed. This is a quick way to delete an
element or any removable ancestor. Note that clicking an ancestor element will remove all its
descendants, including the selected element.
Clear
The Clear command clears the element markup from around the selection. If the entire node is
selected, then the element markup is cleared for the entire node. If a text segment is selected,
then the element markup is cleared from around that text segment only.
Apply
The Apply command applies a selected element to your selection in the main Window. For
more details, see Authentic View entry helpers.
Paste As
The Paste As command offers the option of pasting as XML or as text an Authentic View XML
fragment (which was copied to the clipboard). If the copied fragment is pasted as XML it is
pasted together with its XML markup. If it is pasted as text, then only the text content of the
copied fragment is pasted (not the XML markup, if any). The following situations are possible:
An entire node together with its markup tags is highlighted in Authentic View and
copied to the clipboard. (i) The node can be pasted as XML to any location where this
node may validly be placed. It will not be pasted to an invalid location. (ii) If the node is
pasted as text, then only the node's text content will be pasted (not the markup); the
text content can be pasted to any location in the XML document where text may be
pasted.
A text fragment is highlighted in Authentic View and copied to the clipboard. (i) If this
fragment is pasted as XML, then the XML markup tags of the text—even though these
were not explicitly copied with the text fragment—will be pasted along with the text, but
only if the XML node is valid at the location where the fragment is pasted. (ii) If the
fragment is pasted as text, then it can be pasted to any location in the XML document
where text may be pasted.
Note: Text will be copied to nodes where text is allowed, so it is up to you to ensure that the
copied text does not invalidate the document. The copied text should therefore be:
(i) lexically valid in the new location (for example, non-numeric characters in a numeric
node would be invalid), and
(ii) not otherwise invalidate the node (for example, four digits in a node that accepts only
three-digit numbers would invalidate the node).
If the pasted text does in any way invalidate the document, this will be indicated by the
text being displayed in red.
Delete
The Delete command removes the selected node and its contents. A node is considered to be
selected for this purpose by placing the cursor within the the node or by clicking either the start
or end tag of the node.
To view XML and HTML files in Browser View, click the Browser tab.
Folder View
The Folder View is located on the left-hand side of the Archive View window and displays the
folder structure of the ZIP archive. On each level, folders are listed alphabetically. To view the
sub-folders of a folder, click the plus symbol to the left of the folder. If a folder does not have a
plus symbol to the left of it, then it has no sub-folder. To view the document files (hereafter
called documents) contained in a folder, select the folder; the files will be displayed in the Main
Window. In the screenshot above, the documents displayed in the Main Window are in the word
folder, which also has two sub-folders: _rels and theme.
Main Window
The Main Window lists the documents in the folder that is selected in Folder View. Documents
are displayed in alphabetical order, each with its respective uncompressed size and the date
and time of last modification. To open a Document from Archive View, double-click it. The
document opens in a separate XMLSpy window.
Command buttons
The command buttons are located along the top of the Archive View window.
Open document: Enabled when a document in the Main Window is selected. Clicking
it opens the selected document. A document can also be opened by double-clicking the
document listing in the Main Window.
New folder: Adds a new folder to the folder that is currently selected in Folder View.
The folder must be named immediately upon its being created in Folder View. It is not
possible to rename a folder subsequently. The new folder is saved in the archive when
the archive file is saved.
Add new document: Adds a new document to the folder currently selected in Folder
View. Clicking this button opens the Create New Document dialog of XMLSpy. The
newly created document opens in a separate XMLSpy window. The document must be
named immediately upon its being listed in the document listing of the selected folder.
The document is saved in the archive only when it is saved in its own editing window or
when the archive file is saved.
Add document: Opens a Browse dialog in which you can browse for a document to
add. The document is added to the listing in the Main Window of documents currently in
the selected folder, and the document is opened in a separate XMLSpy window. For the
document to be saved to the archive, it must either be saved in its own window, or the
archive file must be saved.
Delete from archive: Deletes the selected document (in Main Window) or selected
folder (in Folder View) from the archive. The archive file must be saved in order for the
deletion to take effect.
Info: Toggles the Info Window on and off. See below.
Info Window
The Info Window is toggled on and off by clicking the Info command button. The Info Window
provides general information about the archive file, such as the number of files it contains, its
uncompressed and compressed sizes, and the compression ratio.
5 XML
This section describes how to work with XML documents in XMLSpy. It covers the following
aspects:
How to create, open, and save XML documents. In this section, some important
XMLSpy settings relating to file creation are also explained.
XML documents can be edited in Text View, Grid View, and Authentic View. You can
select the view that is most useful for you and switch among the views while editing.
Each of the views offers different advantages.
Entry helpers for XML documents have certain specific features, and these are
described.
How to process XML documents with XSLT and XQuery. Various XMLSpy features
related to processing are explained.
Miscellaneous other features for working with XML documents are described.
Default view
There are application-wide settings for specifying in what view XML documents (new and
existing) should open. These settings are in the Options dialog (Tools | Options).
In the File Types tab of the Options dialog, select a file type of .xml and, in the Default View
pane, check the required editing view (Text or Grid). Note that: (i) Schema View and WSDL
View can be used only for XML Schema and WSDL documents, respectively; and (ii) Browser
View is a display view, not an editing view.
In the File Types tab, you can also set XMLSpy as the default editor for the selected file type.
An XML document can be edited in Authentic View if a StyleVision Power Stylesheet (SPS) has
been assigned to it. When an XML file with an associated SPS is opened, you can specify that it
opens directly in Authentic View. Do this by checking the Always open in Authentic View option
in the View tab of the Options dialog. If this option is not checked, the file will open in the default
view specified for .xml files in the File Types tab (see above).
Assigning schemas
When a new XML file is to be created, select the menu command File | New. This pops up the
Create New Document dialog (screenshot below).
Notice that there are several options for the XML document type. The option marked Extensible
Markup Language creates a generic XML document. Each of the other options is associated
with a schema, for example the DocBook DTD. If you select one of these options, an XML
document is created that has (i) the corresponding schema automatically assigned to it, and (ii)
a skeleton document structure that is valid according to the assigned schema. Note that you
can create your own skeleton XML document. If you save it in the Template folder of the
application folder, your skeleton document will be available for selection in the Create New
Document dialog.
If you select the generic Extensible Markup Language document type, you will be prompted for
a schema (DTD or XML Schema) to assign to the document. At this point, you can choose to
browse for a schema or go ahead and create an XML document with no schema assigned to it.
You can, of course, assign a schema via the DTD/Schema menu at any subsequent time
during editing.
Automatic validation
If an existing XML document has a schema assigned to it, then it can be automatically validated
on opening and/or saving. The setting for this is in the File tab of the Options dialog (Tools |
Options).
The automatic validation settings in the File tab can be combined with a setting in the File
Types tab to disable automatic validation for specific file types. Using the settings in the two
tabs together enables you to specify automatic validation for specific file types.
A schema (DTD or XML Schema) can be assigned to an XML document when it is first created.
A schema can also be assigned, or changed, at any subsequent time using the Assign DTD or
Assign Schema commands in the DTD/Schema menu.
The path to the schema file that is inserted in the XML document can be made relative by
checking the relative path check box in the dialog.
After declaring the entities in the DTD, they can be used in the XML document. The document
will be well-formed and valid. Note, however, that external parsed entities are not supported in
Authentic View..
To comment out a block of text, select the text to be commented out and then select the
command Comment In/Out, either from the Edit menu or the context menu that you get on
right-clicking the selected text. The commented text will be grayed out (see screenshot below).
To uncomment a commented block of text, select the commented block excluding the
comment delimiters, and select the command Comment In/Out, either from the Edit menu or
the context menu that you get on right-clicking the selected text. The comment delimiters will be
removed and the text will no longer be grayed out.
In the screenshot above, notice that the document is displayed as a hierarchy in a grid form.
When a node can contains content, it is divided into two fields: for name and for content. Node
names are displayed in bold face and node content in normal face.
Display as table
If there are several instances of a repeating element, then, in standard Grid View, each
complete instance is displayed, one after the other, progressing vertically downward in
document order (screenshot below).
Such a structure of multiple instances can also be displayed as a table (screenshot below), in
which the child nodes form the columns and the multiple instances form the rows.
Table View offers a unique editing advantage in that whole rows and columns can be
manipulated relative to other columns and rows in the table. This enables such operations as
sorting data with respect to the value of one common child node. For example, in the
screenshot above, the six Person elements can be sorted on the basis of their Last child
elements via a simple GUI operation. Such an operation is much simpler than running an XSLT
transformation, which would be the usual way to sort an XML nodeset.
The XML menu offers commands to insert, append, and add empty child nodes. For example,
you can add an empty child node by selecting an element and then adding an empty child
element. You can then enter a name and content for the newly added node by double-clicking in
the respective field (name or content field) and entering the required string.
The Elements and Attributes entry helpers enable you to insert, append, and add child nodes
that are allowed at the selected location. For example, you select a node in the Main Window.
The element and attribute nodes that may be validly inserted, appended, or added as a child at
this location are listed in the Elements and Attributes entry helpers.
The commands available in the XML menu and entry helpers that are applicable to a selected
node are also available in the context menu of that node.
Editing content
To edit content, double-click in the content field and type in the content text. Entities can be
inserted via the Entities entry helper.
The Authentic View of a document is enabled when a StyleVision Power Stylesheet (SPS) is
assigned to an XML document. An SPS is based on the same schema source as that on which
the XML document is based, and it defines the structure of the XML document. The SPS also
defines the layout and formatting of the document in Authentic View. For example, in the
document shown in the screenshot above, the following Authentic formatting and editing
features are used:
SPSs are created specifically for viewing and editing XML documents in Authentic View and for
generating standard output (such as HTML, PDF, RTF, and Word 2007 documents) from XML.
SPSs are created with Altova StyleVision.
When editing the structure of an XML document in Authentic View, it could be useful to see the
markup of the document. Markup can therefore be switched on as tags (screenshot below)
using the Authentic | Show Large Markup command (or the corresponding toolbar icon).
Editing content
Content is created and edited by typing it into the nodes of the document. Entities and CDATA
sections can be added via the context menu (entities also via the Entities entry helper).
Note that in the different views, the entry helpers are designed differently, in accordance with
the functionality of the respective view.
To insert an attribute, double-click the required attribute. The attribute is inserted at the
cursor point together with an equals-to sign and quotes to delimit the attribute value.
The cursor is placed between the quotes, so you can start typing in the attribute value
directly.
Grid View: When an element is selected, the attributes that can be added as a child are
listed in the Add Child tab of then entry helper. When an attribute is selected, the
available attributes are listed in the Append (after) and Insert (before) tabs. Unused
attributes are displayed in black, used attributes in gray.
Authentic View: When an element is selected, the attributes declared for that element
become visible. Enter he value of the attribute in the entry helper.
Note that if you add an internal entity, you will need to save and reopen your document before
the entity appears in the Entities entry helper.
Additionally, an XSLT-for-FO stylesheet can be assigned with the XSL/XQuery | Assign XSL:
FO command (browse for the file in the dialog (screenshot below) that pops up). The
assignment is entered in the XML document as a processing instruction (PI) having the Altova-
defined target: altova_xslfo. This assignment is used when an XSLT-for-FO transformation
is invoked (XSL/XQuery | XS:FO Transformation).
You can also select a global resource to specify the XSLT file. A global resource is an alias for a
file or folder. The target file or folder can be changed within the GUI by changing the active
configuration of the global resource (via the menu command Tools | Active Configuration).
Global resources therefore enable the assigned XSLT file to be switched from one to another,
which can be useful for testing. How to use global resources is described in the section Altova
Global Resources.
If a previous assignment using either of these PI targets exists, then you are asked whether you
wish to overwrite the existing assignment.
Go to XSLT
The XSL/XQuery | Go to XSL command opens the XSLT file that has been assigned to the
XML document.
appears on clicking the command XSL/XQuery | XSLT Parameters / XQuery Variables. The
parameter/variable values defined here are used for all XSLT transformations and XQuery
executions in XMLSpy. However, these values will not be passed to external engines such as
MSXML. For the details of how to use this feature, see the User Reference section.
XSLT transformations
Two types of XSLT transformation are available:
Standard XSLT transformation (XSL/XQuery | XSL Transformation): The output of the
transformation is displayed in a new window or, if specified in the stylesheet, is saved to
a file location. The engine used for the transformation is specified in the XSL tab of the
Options dialog (Tools | Options).
XSL-for-FO transformation (XSL/XQuery | XSL-FO Transformation): The XML
document is transformed to PDF in a two-step process. In the first step, the XML
document is transformed to an FO document using the XSLT processor specified in the
XSL tab of the Options dialog (Tools | Options); note that you can also select (at the
bottom of the tab) the XSLT engine that comes with some FO processors such as FOP.
In the second step, the FO document is processed by the FO processor specified in
the XSL tab of the Options dialog (Tools | Options) to produce PDF output.
XQuery executions
An XQuery document can be executed on the active XML document by clicking the command
XSL/XQuery | XQuery Execution. You are prompted for the XQuery file, and the result
document is displayed in a new window in the GUI.
XSLT transformation tasks can therefore be automated with the use of AltovaXML. For
example, you can create a batch file that calls AltovaXML to transform a set of documents. See
the Altova XML documentation for details.
5.8 Charts
When an XML document is open in Text View or Grid View, a chart (pie chart, bar chart, etc)
representing selected data in the XML document can be generated in the Charts Window
(which is one of the Output Windows). The chart can then be exported as an image file or as an
XSLT or XQuery fragment to the clipboard. The Charts feature is useful for quickly representing
selected numeric data in an XML document graphically.
3. On clicking OK, the chart is created in the Charts Window (see screenshot below).
4. The chart's data selection and other settings can subsequently be edited. Not only can
its Source XPath and column selection be edited, but also its type and appearance. The
data selection for the chart's axes can be edited by clicking the Select Data button. And
the chart's type and appearance can be modified by clicking the Change Type button
and Change Appearance button, respectively.
5. The chart can be exported as an image file or as an XSLT or XQuery fragment to the
clipboard.
Other features
The following features help to make usage easier:
Multiple tabs: If you wish to create a new chart without deleting the current chart, then
create the new chart in any one of the other tabs marked one to nine (see screenshot
above). Note that, even when an XML document is closed, charts generated from that
document will stay open in their respective tabs in the Charts Window.
Auto Reloading: If the Auto button (see screenshot above) is toggled on, then the
chart will be automatically reloaded every time data in the XML document is modified.
Otherwise, the chart will have to be manually updated by clicking the Reload button.
must be clicked for the change to take effect and for the X-Axis and Y-Axis lists in the
dialog to be refreshed.
X-Axis: The selection in this combo box specifies which node will be used as the X-
Axis. The sequence returned for this selection will give the labels that occur on the X-
Axis. The Auto-Enumerated option of the combo box provides numbered labels for the
X-Axis. Note that XPath expressions created for the Y-Axis are also available for
selection.
Y-Axis: The entries that are checked in this pane will be the nodes, the numeric values
of which will be represented on the numeric Y-Axis. The Clear All and Mark All buttons
deselect all items and select all items in the Y-Axis pane, respectively. The Insert
XPath button enables a series to be generated that is not available because it is not a
descendant of the node the Source XPath returns. The node or XPath expression
selected for the X-Axis is not available for Y-Axis selection and is grayed out.
The chart data generated for the Select Columns dialog shown above can be visualized as in
the following table.
The chart generated from this data would look something like this:
The XML document used for the example above is given here for reference..
The data selection shown in the Select Columns dialog above can be seen in the table of the
Select Data dialog (screenshot below). The Select Data dialog is accessed by clicking the
Select Data button in the Charts output window.
For more details about the individual parameters of the Select Columns dialog, see the
individual sections: Source XPath, X-Axis Selection, Y-Axis Selection, and Chart Data.
After a new Source XPath has been selected, clicking Update Columns refreshes the available
selections (in the dialog) for the X-Axis and Y-Axis. If you modify the Source XPath expression
be sure to click Update Columns.
Similarly, highlighting two Region elements will generate an XPath expression that
selects these two Region elements only.
The Source XPath expression can be edited subsequently in the Select Columns dialog.
In Grid View, selection is done by clicking a node or marking a range. The Source XPath that is
generated from the Grid View selection is as described above for Text View.
For example, here are the implications of some XPath expressions with respect to the XML
document shown above.
/Data/Region: Returns the three Region elements, so three ticks on the X-Axis. Each
Region element will in turn be the context node for XPath expressions.
/Data/Region/Year: Returns 18 Year elements, so 18 ticks on the X-Axis. Each Year
element will in turn be the context node for XPath expressions.
/Data/Region[1]/Year: Returns the six Year element children of the first Region
element, so six ticks on the X-Axis. Each Year element of the first Region element will
in turn be the context node for XPath expressions.
distinct-values(//Year/@id): Returns six items (the distinct values of the Year/
@id attribute: 2005, 2006, 2007, 2008, 2009, 2010). However, since this XPath
expression returns no node item, it cannot be a context node for any XPath expression.
If the items in this sequence are to be used to target nodes in the XML document
(using, say, the current() function (shorthand: .)), then the XPath expression using
the current item must start from the document root in order for the context to be
established. For example: /Data/Region[1]/Year[@id eq .].
Consider the following XML document example. The cursor is placed in the start tag of the first
Region element and the New Chart button of the Charts output window is clicked. The Select
Columns dialog appears, with the Source XPath: /Data/Region (see screenshot above).
As explained in the Source XPath section, this Source XPath sets up a chart with three ticks on
the X-Axis (because the Source XPath returns three items: the three Region elements). Since
we want the labels of these three ticks in the chart to be the names of the three regions, we
select the @id attribute in the combo box of the the X-Axis selection (see screenshot of Select
Columns dialog above).
To produce the chart data for each tick, each Region element is evaluated in turn. For each
Region element, the id attribute generates the correct label for the X-Axis tick. The X-Axis
would look something like in the screenshot below.
If another XPath expression is selected in the X-Axis combo box, then that expression is
evaluated within the respective Region element context and the evaluated result will be the
label of the respective tick. The Auto-Enumerated option generates a number sequence that
corresponds to the tick number: the first tick will be numbered 1, the second 2, and so on.
In the Select Data dialog shown in the screenshot below, for example, click in the X-Axis text
box of the Axis Values pane. This enables the X-Axis selection to be modified. Now click the B1
field and drag the mouse to F1 to make the B1:F1 selection. Click OK to see the new chart.
This selection will now provide the labels for the ticks, as shown in the screenshot below. Notice
also that since the new selection contains five items, five ticks have been generated. However,
only the first three are populated. This is because the Source XPath returns three nodes and
these are the nodes that will be processed for the charts. These three nodes correspond to the
rows of the table shown in the Select Data dialog. Note that the number of rows in the table can
only be modified by changing the Source XPath.
For more information about how the Source XPath and X-Axis selections interact, see How
Chart Data Is Created.
The selection you make for this axis determines how many series are plotted for each X-Axis
tick. If only one series is selected, then at each X-Axis tick, the value returned by the XPath
expression for that series is plotted. If more series are selected, as in the screenshot below, in
which six series are selected, then the chart data selection will be as in the table below. (The
context node for the Y-Axis data selection is the respective Region element.)
There are three X-Axis ticks, labeled with the value of the respective Region/@id attributes. At
each X-Axis tick, the XPath expression for each series is evaluated. In our example, for each X-
Axis tick, each of the six series is evaluated and plotted. For example, the first series (Year[1])
is plotted for all three regions, so also Year[2] to Year[6].
Note: Some charts, such as pie charts and single-bar charts, take only one axis. In a single-
bar chart for example, each X-Axis tick will have just a single bar: that representing the
single series. In a pie chart, the values of the single series will sum up to 100% of the
pie, with each value being assigned to one X-Axis tick.
Y-Axis legends
The legends that appear below the chart are the names of the series. These names can be
modified in the Select Data dialog.
Reference
The XML document used for the example in this section is given here for reference..
The Select Columns button pops up the Select Columns dialog, in which you can change the
Source XPath and modify the data selection for the X-Axis and Y-Axis.
Series pane
The series contained originally in the Series pane are those that were selected in the Select
Columns dialog. The series present in this pane when you click OK will be the series that
appear in the chart. In the Series pane you can carry out three operations:
Add and delete series: This enables you to control the number of series appearing in
the chart.
Edit series names: The names of series are the legends that appear in the chart.
Select data for individual series: With a series selected in the Series pane, the X-Axis
and Y-Axis data can be specified in the Axis Values pane. How to do this is described
below.
The data selection is specified as a range from the chart data table. It can be entered via the
keyboard (for example, B1:F1) or a range can be marked in the chart data table. A range can
only be within a column or a row. To mark a range select the first cell in the range and drag the
cursor to the last cell in the range.
The chart data table can be viewed as a superset of data that is selected using the parameters
in the Select Columns dialog. From this superset, you can then select ranges of data you
require (in the Axis Values pane) for individual series.
After the chart type has been selected, chart settings (such as title, height, and width) must be
made in the Change Appearance dialog and the chart data must be specified. How data is
selected for each chart type is described in the sections, Creating a Chart and Chart Data.
The various settings are organized into the following common tabs:
General: The chart title (see screenshot below) can be edited in this tab, as well as the
chart's background color and the plot's border and background color. In the screenshot
below, the plot has been given a pale green background color. The legends are at the
bottom of the chart; they explain the color codes in the chart and can be turned on or off
in the dialog.
Color scheme: Four predefined color schemes are available plus a user-defined color
scheme. You can modify any of the color schemes by adding and/or deleting colors to a
scheme. The color scheme selected in the Color Scheme tab will be used in the chart.
Sizes: Sizes of various aspects of the chart can be set, either as pixels or as a
percentage ratio.
Font: The font properties of the chart title and of legends and labels can be specified in
this tab. Sizes can be set as a percentage of the chart size or as pixels.
Additionally, each type of chart has settings specific to its type. These are listed below:
Pie charts: Settings for: (i) the angle from which the first slice should be drawn; (ii) the
direction in which slices should be drawn; (iii) the outline color; (iv) whether the colors
receive highlights (in 3D pie charts: whether dropshadows and transparency are used);
(v) whether labels should be drawn; and (vi) whether values and percentages should be
added to labels and how many decimal places should be added to the percentages.
Bar charts: Settings for: (General) Drawing the X and Y axes exchanged generates a
horizontal bar chart (for 2D bar charts only); (Bar) Bar outlines and dropshadows
(dropshadows in 2D bar charts only); (X-Axis) Label and color of the x-axis, and vertical
gridlines; (Y-Axis) Label and color of the y-axis, horizontal gridlines, the range of values
to be displayed, and the tick marks on the y-axis; (Z-Axis, 3D only) Label and color of
the z-axis; (3D) the vertical tilt, horizontal rotation, and the width of the view.
Line graphs: Settings for: (General) Drawing the X and Y axes exchanged; (Line)
including the plot points or not; (X-Axis) Label and color of the x-axis, and vertical
gridlines; (Y-Axis) Label and color of the y-axis, horizontal gridlines, the range of values
to be displayed, and the tick marks on the y-axis.
Gauge: Settings for: (i) the angle at which the gauge starts and the angular sweep of
the scale (Round Gauge only); (ii) the range of the values displayed (Round and Bar
Gauges); (iii) the interval and color of major and minor ticks (Round and Bar Gauges);
(iv) colors of the dial, the needle, and the border.
5.8.8 Export
Clicking the Export button gives you the following options:
Save the chart as an image to file: The image formats available are PNG, GIF, BMP,
and JPG.
Copy the currently sized image or a resized to the clipboard: Enables the chart to be
subsequently copied from the clipboard into a report in another application.
Print chart: Sends the image to a printer on your network. The height and width of the
image can each be specified as a percentage of the page size.
Copy XSLT or XQuery code to the clipboard: Creates an XSLT fragment or XQuery
fragment. Each is essentially the Altova extension function CreateChart. This function
can be used with other Altova extension functions and processed with XMLSpy or
AltovaXML Engine to generate charts. To help you use the CreateChart extension
function, a commented-out usage example is also created with each fragment.
We wish to produce a chart that plots the three regions on the X-Axis and gives the yearly sales
for each region. Our chart should look something like the bar chart below.
This is a simple chart to create because we can select the Region element as the Source
XPath. The Source XPath expression returns a sequence of three items: the three Region
elements. Each Region element will, in turn, be the context node for the X-Axis and Y-Axis data
selections.
For the series we want the Year elements of each region, so a search depth of one level will
suffice. We select the Region element's id attribute for the X-Axis. The id attribute values will
therefore be used as the labels of the three X-Axis ticks. All the Year series are checked
because we wish to include all the Year elements in the chart data table.
Clicking the OK button generates the chart we wanted. For more advanced charts, see the
section, Chart Example: Advanced.
We wish to produce a chart that plots the years on the X-Axis and compare the regional sales
for each year. Our chart should look something like the bar chart below.
We show two ways in which this can be done. These two ways together demonstrate how the
different data selection parameters can be combined to produce the required results.
1. In the Select Columns dialog, makes sure that all the required nodes will be available
for X-Axis and Y-Axis selection. In the screenshot below, notice that the Column Search
Depth has been set to 2 so that the Year/@id attributes are also selected.
2. In the Select Data dialog (screenshot below), the chart data table has the following
columns: the first column is the X-Axis selection (which is the Auto-Enumerated
selection), the remaining columns are the series (Y-Axis) columns, which are the
Region/@id attributes, the Year element contents, and the Year/@id attributes. Notice
also that: (i) there are only three rows, so three X-Axis ticks; (but we need six X-Axis
ticks for the six years); (ii) there are 13 series columns.
3. In the Series pane, we delete any 10 of the 13 series rows and rename the remaining
three series to Americas, Europe, and Asia, as shown in the screenshot above. The
order selected here will be the order of the X-Axis tick labeling.
4. In the Series pane, select the Americas series. In the Axis Values pane, click in the X-
Axis box to enable modification. Then click the cell I1 in the chart data table and drag
to the cell N1. In the Y-Axis text box either enter C1:H1 or make the selection by
dragging from C1 to H1.
5. For the Europe and Asia series, select C2:H2 and C3:H3, respectively for the Y-Axis.
The X-Axis selection can be the same as that for the Americas series.
6. Click OK. The required chart is generated.
Note: The number of X-Axis ticks (defined by default by the number of rows in the chart data
table) is increased from three to six because the number of X-Axis labels is six.
In the Select Columns dialog, the Region[1]/Year element has only two descendants: @id and
text(). The @id attribute is selected for the X-Axis, thereby generating the correct X-Axis label
for each of the six X-Axis ticks. The chart data table would be evaluated as follows.
Note that the context node is each of the six Region[1]/Year elements in turn. The first XPath
expression looks for the current Year/@id attribute value and returns the Region[2]/Year
element that has the same Year/@id value as the @id value of the current Region[1]/Year.
The second XPath expression does the same for the Region[3]/Year elements. In this way,
for each of the six years: the three Y-Axis series are the Year element children, respectively, of
each of the three Region elements. (The text() node returns the contents of the Region[1]/
Year elements.)
The chart data table in the Select Data dialog would look something like this.
The names of the series in the Select Data dialog can be changed from XPath expressions (as
in the screenshot above) into meaningful legends (screenshot below). For each series the
correct data column can be assigned in the Axis Values pane (by clicking in the Y-Axis text box
and then selecting the required column in the chart data table).
Both the methods shown above generate identical charts. The different approaches are
intended to show how the data selection parameters are to be used.
Encoding
The encoding of XML files (and other types of documents) can be set via the menu command
File | Encoding. The default encoding of XML and non-XML files can be specified in the
Options | Encoding tab.
The screenshot above shows the Find & Replace dialog in Text View. The dialog and
functionality varies according to the view that is active.
Evaluate XPath
An XPath expression, which you enter in the XPath Window, can be evaluated against the
active XML document. The results of the evaluation are displayed in the XPath Window, and
clicking a node in the result highlights that node in the document display in the Main Window.
Note that the XPath Window can be made active by clicking XML | Evaluate XPath command.
This section provides an overview of how to work with DTDs and XML Schemas. It also
describes SchemaAgent and the powerful Find in Schemas feature. In addition to the editing
features, XMLSpy provides the following powerful DTD/Schema features:
Catalog mechanism
Support for the OASIS catalog mechanism enables the re-direction of URIs to local addresses,
thus facilitating use across multiple workstations.
Schema rules
An XML Schema can be assigned a set of additional constraints defined by the user. XMLSpy
contains a Schema Rule Editor in which a Schema Rule Set for an XML Schema can be
created and edited.
Schema subsets
Components of a large schema can, in Schema View, be created as a separate file. These
smaller schema subsets can then be included in the larger schema. The reverse operation,
known as flattening a schema, puts the components of included files directly in the larger
schema. How to generate schema subsets and flatten schemas is described in the section,
Schema Subsets.
Go to definition
When the cursor is located within a node in an XML document, clicking the DTD/Schema | Go
to Deinition menu command opens the schema file and highlights the definition of the selected
XML node.
6.1 DTDs
A DTD document can be edited in Text View and Grid View. The default view can be set in the
File Types tab of the Options dialog.
Text View
In Text View, the document is displayed with syntax coloring and must be typed in. Given below
is a sample of a DTD fragment:
Indentation is indicated by indentation guides and is best obtained by using the tab key. The
amount of tab indentation can be set in the Text View Settings dialog.
Grid View
In Grid View, the DTD document is displayed as a table. The screenshot below shows the Grid
View display of the DTD listed above.
When the cursor is inside a row of the table, or if a row is selected, DTD editing commands in
the XML menu become enabled. You can insert, append, and add child nodes to the graphical
representation of the DTD. The DTD items available at a particular selection point are enabled
in the respective sub-menu of the XML menu (Insert, Append, Add Child). You can also
convert a selected DTD item to another item, and move the item left or right in order to change
its position in the document hierarchy. When a node is selected, available DTD items are also
displayed as items in the entry helpers.
Generate sample XML file from DTD: With the DTD/Schema | Generate Sample XML
File command, an XML document can be generated that is based on the active DTD.
In Schema View, one possible work scenario that describes various aspects of the Schema
Subsets feature is as follows:
1. Create a schema subset that contains one or more components of the active schema.
How to do this is described below,
2. Create additional schema subsets as required.
3. Include the newly created schema subset/s to compose the larger schema. Do this for
each schema subset by appending or inserting an Include component in the Schema
Overview window, and selecting the newly created schema subset file.
4. Delete any components that were present in the original full schema but are now
duplicated because of the included subset/s.
You can also do the reverse in Schema View, that is, flatten the included schema subsets so
that: (i) the components contained in the schema subsets are added directly to the main
schema, and (ii) the included schema subsets are deleted from the main schema. How to
flatten a schema is described further below.
1. With the required XML Schema active in Schema View, select the command Schema
Design | Create Schema Subset. This pops up the Select Schema Components
dialog (screenshot below).
2. In the dialog, check the component or components you wish to create as a single
schema subset, then click Next. (Note that a check box below the pane enables
components from all referenced files to also be listed for selection.)
3. In the Schema Subset Generation dialog that now appears (screenshot below), enter
the name/s you want the file/s of the schema subset package to have. You must also
specify the folder in which the new schema subset files are to be saved. A schema
subset package could have multiple files if one or more of the components being
created is an imported component in the original schema. A separate schema file is
created for each namespace in the schema subset. The filenames displayed in the
dialog are, by default, the names of the original files. But since you are not allowed to
overwrite the original files, use new filenames if you wish to save the files in the same
folder as the original files.
4. On clicking OK, the schema subset file with the namespace corresponding to that of
the active file is opened in Schema View. Any other files in the package are created but
not opened in Schema View.
Flattening a schema
Flattening the active schema in Schema View is the process of: (i) adding the components of all
included schemas as global components of the active schema, and (ii) deleting the included
schemas.
To flatten the active schema, select the command Schema Design | Flatten Schema. This
pops up the Flatten Schema dialog (screenshot below), which contains the names of separate
files, one for each namespace that will be in the flattened schema. These default names are the
same as the original filenames. But since you are not allowed to overwrite the original files, the
filenames must be changed if you wish to save in the same folder as the active file. You can
browse for a folder in which the flattened schema and its associated files will be saved.
On clicking OK, the flattened schema file will be opened in Schema View.
A set of schema rules is saved in a Rule Set file, which is an XML (.xml) file. XMLSpy contains
a Schema Rules Editor in which you can edit schema rules graphically. In XMLSpy, one or more
Rule Set files can then be assigned to an XML Schema. The XML Schema is validated in
Schema View against the assigned Rule Sets by selecting the XML | Validate (F8) command.
Any number of Schema Rule Sets can be added (see screenshot above). When more than one
Schema Rule Set is assigned to an XML Schema, the rules in all the added Schema Rule Sets
are used when the XML Schema is validated in Schema View (XML | Validate).
After the rules in a Rule Set file have been edited, click Save to save the rules to the Rule Set
File.
Defining a rule
To define or edit a rule, select the rule from the listing in the upper Rules pane. The definition of
the rule will be displayed in the Rule pane and can be edited. The screenshot below displays a
rule which can be defined as follows: If a complex type is an extension of a simple type, then it
must have a child kind AttributeGroup.
Each individual condition can be negated by checking its Not check box (located to the
left of the condition).
Within a Condition Group, the logical connectors and or or indicate, respectively,
whether all conditions in the group or one condition in the Condition Group must
evaluate to true in order for the entire Condition Group to evaluate to true. In the GUI,
these logical operators are the inner of the two columns of logical operators.
Each Condition Group can be negated by checking its Not check box (located to the left
of the Condition Group's logical operator).
The outer logical connector and or or indicates, respectively, whether all the Condition
Groups in the set (Validate or Filter) or one Condition Group must evaluate to true in
order for the entire set (Validate or Filter) to evaluate to true.
Logical connectors can be changed by selecting the appropriate option in the combo
box for the outer logical connector (the Condition Group connector). The value of the
inner logical connectors (the connectors for conditions within a Condition Group) are all
switched to the opposite value as that of the outer logical connector.
A Condition Group or Condition can be appended or inserted relative to the selected
condition. Do this by selecting a condition, then clicking the Append or Insert button (at
the top left of the pane) and then selecting the required item (Condition Group or
Condition) from the menu (see screenshot below).
Kinds of condition
A condition can belong to one of three groups (also see screenshot below):
Component kind (in the dropdown list the kinds beginning with Component; see
screenshot below)
Property kind (Property Value)
A combination of component and property kinds (kinds with Property and Component in
their names)
The kind of a condition is selected from the dropdown list in the Condition column of the
condition (screenshot above). Each of the three groups of conditions is described below.
In the screenshot above, the Filter condition specifies that the rule concerns components of
kind Element. If the Validate condition then specifies that the component must have a child of
kind Notation, then the complete rule can be stated as: An Element component must have a
child of kind Notation. If the Validate condition had its NOT option checked, then the rule would
be stated as: An Element component must not have a child of kind Notation.
The screenshot above shows a rule in which the Model property has a value equal to All and is
negated (via the Not check box). Taken in conjunction with the filter on the Model Group
component, this rule simply states that a schema must not contain any xsd:all element.
Negating a condition
A condition is negated by checking the Not check box to its immediate left (the inner Not check
boxes). A Condition Group is negated by checking the Not check box to the left of the logical
connector for conditions in that Condition Group..
RootCatalog.xml
When XMLSpy starts, it loads a file called RootCatalog.xml (structure shown in listing below),
which contains a list of catalog files that will be looked up. You can modify this file and enter as
many catalog files to look up as you like, each in a nextCatalog element. Each of these catalog
files is looked up and the URIs in them are resolved according to the mappings specified in
them.
In the listing above, notice that in the Schemas and XBRL folders of the folder identified by the
variable %AltovaCommonFolder% are catalog files named catalog.xml. (The value of the
%AltovaCommonFolder% variable is given in the table below.)
The catalog files in the Altova Common Folder map the pre-defined public and system
identifiers of commonly used schemas (such as SVG and WSDL) and XBRL taxonomies to
URIs that point to locally saved copies of the respective schemas. These schemas are installed
in the Altova Common Folder when XMLSpy is installed.You should take care not to duplicate
mappings in these files, as this could lead to errors.
the folder of a specific schema or XBRL taxonomy in the Altova Common Folder, and
each maps public and/or system identifiers to URIs that point to locally saved copies of
the respective schemas.
%AltovaCommonF
older% C:\Program Files\Altova\Common2011
%DesktopFolder
% Full path to the Desktop folder for the current user.
%ProgramMenuFo
lder% Full path to the Program Menu folder for the current user.
%StartMenuFold
er% Full path to Start Menu folder for the current user.
%StartUpFolder
% Full path to Start Up folder for the current user.
%TemplateFolde
r% Full path to the Template folder for the current user.
%AdminToolsFol Full path to the file system directory that stores administrative tools for the
der% current user.
%AppDataFolder
% Full path to the Application Data folder for the current user.
%CommonAppData
Folder% Full path to the file directory containing application data for all users.
%FavoritesFold
er% Full path of the Favorites folder for the current user.
%PersonalFolde
r% Full path to the Personal folder for the current user.
%SendToFolder% Full path to the SendTo folder for the current user.
%SystemFolder% Full path to the System folder for the current user.
%CommonAppData
Folder% Full path to the file directory containing application data for all users.
%LocalAppDataF Full path to the file system directory that serves as the data repository for
older% local (nonroaming) applications.
%MyPicturesFol
der% Full path to the MyPictures folder.
For popular schemas, the PUBLIC identifier is usually pre-defined, thus requiring only that the
URI in the catalog file point to the correct local copy. When the XML document is parsed, the
PUBLIC identifier in it is read. If this identifier is found in a catalog file, the corresponding URL in
the catalog file will be looked up and the schema will be read from this location. So, for
example, if the following SVG file is opened in XMLSpy:
This document is read and the catalog is searched for the PUBLIC identifier. Let's say the
catalog file contains the following entry:
<catalog>
...
<public publicId="-//W3C//DTD SVG 1.1//EN" uri="schemas/svg/svg11.dtd"/>
...
</catalog>
In this case, there is a match for the PUBLIC identifier, so the lookup for the SVG DTD is
redirected to the URI schemas/svg/svg11.dtd (this path is relative to the catalog file), and this
local file will be used as the DTD. If there is no mapping for the Public ID in the catalog, then
the URL in the XML document will be used (in the example above:
http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd).
In cases where there is no public identifier, as with most stylesheets, the system identifier can
be directly mapped to a URL via the system element. Also, a URI can be mapped to another
URI using the uri element. The rewriteURI and rewriteSystem elements enable the rewriting
of the starting part of a URI or system identifier, respectively. This allows the start of a filepath to
be replaced and consequently enables the targeting of another directory. For more information
on these elements, see the XML Catalogs specification.
This would enable intelligent editing (auto-completion, entry helpers, etc) of .myhtml files in
XMLSpy according to the XHTML 1.0 Transitional DTD. Refer to the catalog.xml file in the
%AltovaCommonFolder%\Schemas\xhtml folder, which contains similar entries.
More information
For more information on catalogs, see the XML Catalogs specification.
SchemaAgent technology
The SchemaAgent technology enables users to build and edit relationships between multiple
schemas. It consists of:
A SchemaAgent Server, which holds and serves information about the relationships
among schemas in one or more search path/s (folder/s on the network) that you
specify.
A SchemaAgent client, Altova's SchemaAgent product, which uses schema
information from the SchemaAgent server to which it is connected (i) to build
relationships between these schemas; and (ii) to manage these schemas (rename,
move, delete schemas, etc).
XMLSpy uses SchemaAgent technology to directly edit schemas in Schema View using
information about other schemas it gets from a SchemaAgent server. In this setup, XMLSpy is
connected to a SchemaAgent server, and, in interaction with SchemaAgent Client, sends
requests to SchemaAgent Server. When XMLSpy has been set up to work with SchemaAgent,
the Entry Helpers in Schema View not only list components from the schema currently active in
Schema View but also list components from other schemas in the search paths of the
SchemaAgent server to which it is connected. This provides you with direct access to these
components. You can view the content model of a component belonging to another schema in
Schema View, and reuse this component with or without modifications. You can also build
relationships between schemas, thereby enabling you to modularize and manage complex
schemas directly from within XMLSpy.
For details about installing SchemaAgent and SchemaAgent Server and configuring search
paths on servers, see the SchemaAgent user manual.
schemas that will be mapped for their relationships with each other.)
Start a connection from within XMLSpy to a SchemaAgent server.
The menu commands provide general administrative functionality. The Entry Helpers (and
standard GUI mechanisms, such as drag-and-drop) are used to actually edit schemas.
This section describes how to use the SchemaAgent functionality available in Schema View.
Before you connect to SchemaAgent Server, only the Connect to SchemaAgent Server
command is enabled in the Schema Design menu; other SchemaAgent commands in the
Schema Design menu are disabled (see screenshot). The other menu items become enabled
once a connection to a SchemaAgent Server has been successfully made.
Connection steps
To connect to a SchemaAgent server:
2. You can use either the local server (the SchemaAgent server that is packaged with
Altova SchemaAgent) or a network server (the Altova SchemaAgent Server product,
which is available free of charge). If you select Work Locally, the local server of
SchemaAgent will be started when you click OK and a connection to it will be
established. If you select Connect to Network Server, the selected SchemaAgent
Server must be running in order for a connection to be made.
Please note:
At the top of the Globals view the text "Connected to SchemaAgent Server" appears,
specifying the server to which the connection has been made.
You now have full access to all schemas and schema constructs available in the server
search path. SchemaAgent schema constructs such as global elements,
complexTypes, and simpleTypes are visible in bold blue text, below the constructs of
the active schema (bold black text).
1. Scroll down to the blue Company entry in the Components entry helper, and
double-click it. The Goto Definition dialog box is opened.
2. Click the Addresslast.xsd entry, and click OK to confirm. This opens the
addresslast.xsd schema and displays the content model of the Company element.
3. Click the icon of the Altova element in the Schema Overview to see its content
model.
4. Right-click the Altova sequence compositor and select the menu option Add Child |
Element. Note that a list box containing all global elements within the server path opens
automatically at this point. Selecting one would incorporate that element.
5. Enter Altova-office as the name for this new element and press Enter.
6. Using the Details Entry Helper, click the type combo box and select the entry
OfficeType.
8. Click OK. The Import command was automatically selected for you. An expand icon
appears in the Altova-office element.
Please note: The type entry in the Details entry helper has changed; it is now
displayed as ns1:OfficeType due to the fact that the Orgchart.xsd schema file has
been imported and the target namespaces must be different in both schemas. An
Import command has also been added to the schema.
10. Press F8 to validate the schema. The "Schema is valid" message should appear at this
stage.
4. Select the menu option Schema Design | Schema settings to see how the
namespace settings have changed.
Please note:
Changes made to schemas under SchemaAgent Server control using XMLSpy
automatically update other schemas in the SchemaAgent Server path that referenced
the changed schema.
It is possible to see duplicates of constructs element, simpleTypes etc. in entry helpers
(in black and blue), if the schema you are working on is also in the SchemaAgent
Server path.
You have the option of opening only the active schema in SchemaAgent (File only command),
or the active schema together with either (i) all directly referenced schemas, or (ii) all directly
referencing schemas, or (iii) all directly related schemas.
How to carry out extended validation is demonstrated below by means of an example. This
example assumes that the schema file address.xsd is the active schema in Schema View of
XMLSpy. You would then do the following:
1. Click the Extended Validation icon in the toolbar or the menu item Schema Design
| Extended Validation. This opens the Extended Validation dialog box, in which you
can choose whether to validate the active schema only or one or more related schemas
as well.
2. To insert schemas into the list, click the Show Directly Referenced or Show All
Referenced button as required. In this example, we have clicked the Show All
Referenced button, and this inserts all referenced files into the list.
At this point, you can remove a schema from the list (Remove from List).
3. Click the Validate button to validate all the schemas in the list box.
The Validate column displays whether the validation was successful or whether it failed.
You can now open the schemas that failed validation or a set of selected schemas in XMLSpy.
The Find and Replace in Schema View feature is enabled when a schema is active in Schema
View. It is accessed in one of two ways:
Via the Edit | Find and Edit | Replace menu commands.
Via the Find and Replace buttons in the Find in Schemas window.
Clicking a command or a button pops up the Find or the Replace dialog, according to which
command/button was clicked. The Replace dialog (screenshots below) is different from the Find
dialog in that it has a text entry field for the Replace term.
Clicking the More button expands the dialog to show additional search criteria (screenshot
below).
Usage is as follows:
Enter the search and replace terms in the Search and Replace text fields
Specify the schema components to be searched in the Components tab
Specify the properties of the components to be searched; this helps to narrow the
search
Set the scope of the search to the current document or project, or specify a folder to
search
Execute the command
Use the Find in Schemas window to navigate to a component quickly
The Reset button at the bottom of the dialog resets the original settings, which are as follows:
No search term, no replace term
Components: all
Namespaces: none specified
Property restrictions: anywhere
Additional property restrictions: none
Scope: current file
String search
In a string search (screenshot below), the entry can be: (i) text; (ii) a QName; or (iii) a regular
expression. For QName searches, the namespace is determined on the basis of either the
prefix used in the document or by the namespace URI, either of which must be entered. In the
screenshot below, the ts: prefix is the prefix used in the document to identify a certain
namespace.
To search using a regular expression, check the Regular Expression check box and then enter
the regular expression. Entry helpers for regular expressions are available in a menu that is
activated by clicking the right-pointing arrowhead at the right of the Search entry field (
screenshot below).
You can also select whether a search term must match a whole word in the document and/or
whether the casing in the document must match. Use the check boxes below the text entry field
to specify these options.
Numeric search
When the Numeric Search radio button is selected, the search term can be a single operator-
and-number search parameter, or a set of two such operator-and-number search parameters
joined by the logical connector AND or OR. In the screenshot below, there are two search term
parameters which create a search term for all integers between, and including, 1 and 5.
6.7.2 Components
The search can be restricted to one or more component types and to one or more target
namespaces. These options are available in the Components tab. Expand the Find or Replace
dialog by clicking the More button. This will bring up the tabs for refining the search, one of
which is the Components tab (screenshot below).
The Components tab consists of two parts: (i) for selecting the component types to be
searched, and (ii) for selecting the target namespaces to be searched.
Component selection
You can enter the component types to be searched by clicking the Add icon located to the
right of the text field (see screenshot above). This pops up the Component Restriction dialog (
screenshot below), in which you can select the components to be searched by checking them.
Checking the Components item at the top of the list selects all components (text entry: all).
Unchecking it de-selects all components (text entry: none)—including individually selected
components. Individual components, therefore, can be selected only when the Components item
is unchecked. The selected components are entered in the text field as a comma-separated list
(see screenshot above).
Note: Each time the Components tab or the Find/Replace dialog is opened, the previous
component selection is retained.
Namespace selection
To select one or more target namespaces to be searched, click the Add or Insert icons and
enter the required namespace/s. If no target namespace is specified, then all target
namespaces are searched. To delete a target namespace that has been entered in this pane,
select the target namespace and click the Delete icon.
6.7.3 Properties
The search can be restricted to one or more component properties (details and facets) by using
options in the Properties tab, as well as to match the contents of properties. Expand the Find or
Replace dialog by clicking the More button, and then select the Properties tab (screenshot
below).
The Properties tab consists of two parts: (i) for restricting the main search term (entered in the
Find text box); and (ii) for adding additional content restrictions (which have their own match
term); see the section Additional Restrictions below.
Properties selection
You can enter the property types to be searched by clicking the Add icon , which is to the
right of the text field (see screenshot above). This pops up the Property Restriction dialog (
screenshot below), in which you can select the properties to be searched by checking them.
The properties are organized in three groups: (i) Details; (ii) Facets; (iii) Advanced (such as the
DerivedFrom property). Checking Details, Facets, or Advanced selects all properties in that
group. Unchecking a group de-selects all properties in that group, including individually selected
properties. Individual properties, therefore, can be selected only when the group item is
unchecked. The selected properties are entered in the text field (see screenshot above).
Note: Each time the Properties tab or the Find/Replace dialog is opened, the previous
properties selection is retained.
Additional restrictions
An additional restriction enables you to specify the value of the property to search for. For
example, if you are looking for an element called state which has an enumeration MA (for the
US state of Massachusetts), you could specify the value MA of the property enumeration with
the Addition Restrictions option. You would do this as follows:
1. In the Additional Restrictions pane, click the the Add or Insert icon (screenshot below).
2. This adds a row to the pane and pops up the Property Restriction dialog. Deselect all
properties and select only the enumeration property (screenshot below).
3. In the text field at the top of the dialog, enter the enumeration value to be searched for,
in this case, MA (see screenshot above).
4. Click OK. The additional restriction is entered in the newly created row in the Additional
Restrictions pane (screenshot below).
In the screenshot above, notice that the search term is ipo:state. In the Properties
tab, the anywhere specifies that all properties will be searched, but the additional
restriction specifies that the search should be restricted to enumerations having a value
of MA.
Multiple additional restrictions can be added to further narrow the search. To delete an
additional restriction, select the additional restriction and click the Delete icon.
Note: Each time the Properties tab or the Find/Replace dialog is opened, the previous
additional restriction/s are retained.
6.7.4 Scope
The scope of the search can be set in the Scope tab (screenshot below). You can select either
file/s or the currently selected schema component in Schema View.
If the File/s option is selected, you can further specify one from among the following options:
Current file: An additional option to search included, imported and redefined files is also
available.
Open files: All XML Schema (XSD) files that are open in XMLSpy. Only the Find All and
Replace All commands are enabled; single-step searching is not available.
Project: The currently active project is selected, with the option to skip external folders.
Only the Find All and Replace All commands are enabled; single-step searching is not
available. If the default view for the .xsd file extension (Tools | Options | File Types |
Default View) is not Schema View, then the .xsd files are not searched.
Folder: You can browse for the required folder; an option to search sub-folders is also
available. Only the Find All and Replace All commands are enabled; single-step
searching is not available.If the default view for the .xsd file extension (Tools |
Options | File Types | Default View) is not Schema View, then the .xsd files are not
searched.
Included, imported, and redefined files can be included in the scope by checking the
option for adding them to the scope.
In the Replace dialog, you can choose whether to copy the replacement to the file on disk or
whether to open the file in XMLSpy. Do this by selecting the appropriate button in the dialog.
Find dialog
After you have entered the search term and, optionally, other criteria to refine the search, you
can click either the Find (F3) or Find All command (screenshot below).
Clicking the Find (Ctrl+F) command in the dialog closes the Find dialog and finds the next
occurrence of the search term within the specified scope and refinement criteria. The next
occurrence is found relative to the currently selected component in Schema View. If the search
reaches the end of the scope, it will not start automatically from the beginning of the scope.
Therefore, you should make sure that the currently selected component in Schema View before
starting the search is located before the document part you wish to search.
The result of the Find is highlighted in Schema View and the result is also reported in the Find
In Schemas window. In the Find In Schemas window, you can click a result to highlight that item
in Schema View.
Clicking the Find All command closes the Find dialog and lists all the search results in the Find
In Schemas window.
Replace dialog
In the Replace dialog (screenshot below), clicking the Find command finds the next occurrence
of the search term relative to the current selection in Schema View. You can then click
Replace to replace this occurrence.
The Find All command closes the Replace dialog and lists all the search results in the Find In
Schemas window.
The Replace All command replaces all occurrences of the found term, closes the Replace
dialog, and lists the found terms in the Find In Schemas dialog.
The Find All and Replace All commands list all the found occurrences in the document.
Note: The Find and Replace buttons at the top of this window bring up the Find dialog and
the Replace dialog, respectively. The Find button can be used to find the next
occurrence of the search term.
Additional and more detailed information about commands is in the descriptions of the relevant
menu commands (in the User Reference section). For more information on editing support, also
see the Editing Views section and the XML section.
7.1 XSLT
Altova website: XSLT Editor
Editing XSLT documents: describes the editing support for XSLT documents in
XMLSpy
XSLT Processing: shows the various ways in which XSLT transformations can be
carried out in the XMLSpy GUI using engines of your choice. This section also explains
important XSLT settings in XMLSpy.
XSL Outline: describes the XSL Outline and XSL Info Windows, which together provide
a powerful way to view, navigate, and manage a collection of XSLT files.
XPath Evaluation
When an XML document is active, you can use the XPath Window to evaluate XPath
expressions. This is a very useful feature to quickly check how an XPath expression will be
evaluated. Type in an XPath expression and specify whether it should be evaluated relative to
the document root or to a selected context node in the XML document. The result of the
evaluation will be displayed immediately in the XPath Window. How to use the XPath Window is
described in the section Introduction | XPath Window.
Entry helpers
Entry helpers are available for elements, attributes, and entities. Information about the items
displayed in the entry helpers is built into XMLSpy, and is not dependent on references
contained in the XSLT document.
Auto-completion
In Text View, auto-completion is available in a pop-up as you type, with the first item in the pop-
up list being highlighted that matches the typed text. When an element is being typed, a list of
elements pops up with the first nearest match in alphabetical order being highlighted. Similarly,
when an attribute is being typed in, a list of applicable attributes pops up. The items in the list
are determined according to the rules described in the previous section on entry helpers.
The available options are explained in the User Reference section. The engine specified in the
XSL tab will be used for all XSLT transformations. Note that for the XSL:FO transformation, an
additional XSLT engine option is available: the XSLT engine that is packaged with some FO
processors. To select this option, select the corresponding radio button at the bottom of the XSL
tab (see screenshot above).
The XSLT version of a stylesheet is specified in the version attribute of the xsl:stylesheet
(or xsl:transform) element. XMLSpy contains the built-in Altova XSLT 1.0 and Altova XSLT
2.0 engines, and the appropriate engine is selected according to the value of the version
attribute (1.0 or 2.0).
XSLT Transformation
The XSLT Transformation (F8) command can be used in the following scenarios:
To transform an XML document that is active in the GUI and has an XSLT document
assigned to it. If no XSLT document is assigned, you are prompted to make an
assignment when you click the XSLT Transformation (F8) command.
To transform an XSLT document that is active in the GUI. On clicking the XSLT
Transformation (F8) command, you are prompted for the XML file you wish to process
with the active XSLT stylesheet.
To transform project folders and files. Right-click the project folder or file and select the
command.
XSL:FO Transformation
The XSL:FO Transformation command can be used in the following scenarios:
To transform an XML document that is active in the GUI and has an XSLT document
assigned to it. The XML document will first be transformed to FO using the specified
XSLT engine. The FO document will then be processed with the specified FO
processor to produce the PDF output. If no XSLT document is assigned, you are
prompted to make an assignment when you click the XSL:FO Transformation
command.
To transform an FO document to PDF using the specified FO processor.
To transform an XSLT document that is active in the GUI. On clicking the XSL:FO
Transformation command, you are prompted for the XML file you wish to process with
the active XSLT stylesheet.
To transform project folders and files. Right-click the project folder or file and select the
command.
For a description of the options in the XSL:FO output dialog, see the User Reference section.
XSLT transformation tasks can therefore be automated with the use of Altova XML. For
example, you can create a batch file that calls AltovaXML to transform a set of documents. See
the Altova XML documentation for details.
In the XSL Outline window (screenshot below), you can do the following:
View the templates and functions in the active XSLT document and in all imported and
included XSLT documents.
Sort the templates and functions on the basis of their names or match expressions,
mode, priority, or comments.
Search for specific templates on the basis of their names/expressions.
Use the XSL Outline to navigate to the corresponding template in the XSLT document.
Quickly insert calls to named templates.
Set a selected named template as the entry point for transformations.
In the XSLT tab of the Info Window (screenshot below), you can do the following:
View information about all the files related to the active XSLT document, such as the
locations of imported and included files.
Set an XML file for transformation with the active XSLT document. Also, the schema
(XSD/DTD) file can be set for validating the selected XML file.
Open a related file from within the Info Window.
Quickly organize all related files into XMLSpy projects.
Zip all related files to a user-defined location.
The XSL Outline window and the XSLT tab of the Info Window are described in detail in the
sub-sections of this section.
There are two types of templates: (i) named templates, and (ii) templates that match an XPath
expression. Each template is listed with:
Its name (if the template has a name attribute) and/or XPath expression (if the template
has a match attribute). If the template has both, a name and a match attribute, then
both are listed, with the value of the name attribute first: namevalue, matchvalue (see
the template named bold in the screenshot above).
Its mode, if any;
Its priority, if any;
The comment that directly precedes the template or function, if any.
Functions in the stylesheet are listed by their names. Functions have neither mode nor priority.
Operations
The following operations can be performed in the XSL Outline Window:
Filtering: The list displayed in the window can be filtered to show one of the following: (i)
all templates and functions (the default setting each time XMLSpy is started); (ii) named
templates only; (iii) XPath-expression templates only; (iv) functions only. To select the
required filter, click the dropdown arrow to the right of the Search box at bottom right of
the window (screenshot below), and select the required filter (the second group of
commands in the menu). The selected filter is applied immediately and applies from
this moment onwards till it is modified or till XMLSpy is closed.
Sorting and locating: Each column can be sorted alphabetically by clicking the column
header. Each subsequent click reverses the previous sorting order. After a column has
been sorted in this way, if you select any item in the list and then quickly type in a term
from the sorted column, the first item in the list that contains that term will be
highlighted. In this way, you can quickly go to templates of a particular name/
expression, mode, or priority.
Searching: Enter in the Search box (at bottom right) the name or XPath expression for
which you wish to search. The search results are displayed as you type. The following
search options are available in the dropdown list of the Search box (screenshot above):
(i) whether the name or expression either starts with or contains the search term (the
first group of commands in the menu); the starts-with option is the default each time
XMLSpy is started; (ii) whether the search results should be displayed as a reduced list
or be highlighted (the third group of commands in the menu); the reduced-list option is
the default each time XMLSpy is opened. These selections are applied immediately and
remain in effect till changed or till XMLSpy is closed.
Reloading: After the stylesheet has been modified, click the Reload icon in the
window's toolbar to update the XSL outline.
Go to item: When a template or function is selected in the XSL Outline window, clicking
the the Go to Item icon in the window's toolbar highlights the template or function
in the document in Design View. Alternatively, double-click an entry to go to it.
Named template actions: Two groups of actions can be carried out involving named
templates: (i) Calls to the named template (with xsl:call-template) can be inserted
in the stylesheet at the cursor insertion point; and (ii) A named template can be set as
the entry point for a transformation. The commands for these actions are carried out via
icons in the toolbar and are described below.
Named templates
When a named template is selected, one or more commands in the window's toolbar relating to
named templates become enabled (screenshot below).
The commands in the toolbar (screenshot above) are, from left to right:
Insert xsl:call-template: This command becomes active when a named template is
selected in the XSL Outline window. The command inserts an xsl:call-template
element at the cursor insertion point in the stylesheet. The name attribute of the xsl:
call-template element that is inserted in the stylesheet is given a value that is the
value of the name attribute of the selected named template. This makes the xsl:call-
template a call to the selected named template.
Insert xsl:call-template with param: This command becomes active when a named
template having one or more xsl:param child elements is selected in the XSL Outline
window. As with the Insert xsl:call-template command, the command inserts an xsl:
call-template element, but in this case with a corresponding xsl:with-param child
element for every xsl:param child element of the selected named template. The
names of the inserted xsl:call-template and its xsl:with-param child elements
correspond to the names of the selected named template and its xsl:param children.
Set the selected named template as entry point for transformation: When a named
template is set as the entry point for a transformation, transformations executed in
XMLSpy start at this named template. In the XSL Outline Window, such a named
template is indicated in boldface (see screenshot at the start of this section).
Clear named template as entry point for transformation: Becomes active once a named
template has been set as the entry point for transformations.
Jump to the named template selected as the entry point for transformations: Becomes
active once a named template has been set as the entry point for transformations.
When the focus in the XSL Outline window is at some other point than the named
template set as the entry point for transformations, clicking this icon highlights the
named template in the XSL Outline window, thus making access to it faster.
Info Window
The XSLT tab of the Info Window, which is displayed only when an XSLT document is the
active document in XMLSpy, displays all the imported and included XSLT files related to the
active XSLT document, and enables the selection of an XML file that can be used as the source
XML document on which the XSLT document is used for the transformation.
The following files are displayed in the XSLT tab of the Info Window:
XSLT files: All imported and included XSLT files are listed (see screenshot above). The
location of each file is displayed in a pop-up when the mouse cursor is placed over the
file. Double-clicking an imported or included file, or selecting it and then clicking the
Open icon in the Info Window toolbar, opens the file in a new window. The Go to
Include/Import Location icon in the toolbar highlights the include/import declaration in
the active XSLT document.
XML file: An XML file can be assigned to the active XSLT stylesheet for
transformations. The location of the assigned XML file is displayed in a pop-up when
the mouse cursor is placed over the file. If an XML file is specified and the menu
In the event that more than one of the above assignments exists, the selection priority
is: (i) project; (ii) processing instruction; (iii) browsed by user. The XML file can be
opened by double-clicking it or by selecting it and clicking the Open toolbar icon.
XSD/DTD file: If the selected XML file has a reference to a schema (XML Schema or
DTD), then this schema file is displayed in the XSD/DTD entry. Alternatively, just as
with the XML file, the schema file can be selected via the Project Properties dialog (
Validation) or by clicking the XSD/DTD icon and browsing for the required schema file.
If the schema file is selected via the Projects Properties dialog, a Projects icon is
displayed next to the entry, otherwise the clickable XSD/DTD icon is displayed with the
file entry either in a normal font face (when the schema is referenced from the XML file)
or bold font face (schema browsed for by the user via the XSD/DTD icon). Should the
schema file be assigned via more than one method, then the order of priority is as
follows: (i) project; (ii) browsed by user; (iii) reference in XML document. The location of
the assigned XSD file is displayed in a pop-up when the mouse cursor is placed over
the file. The schema file can be opened by double-clicking it or by selecting it and
clicking the Open toolbar icon.
Note: If an XML or XSD/DTD file is selected via the Project Properties dialog, then to clear
this selection, you must go to the Project Properties dialog and clear the setting there. If
the selection has been made by browsing via the XML or XSD/DTD icons, then to clear
this setting, select the file and click the Clear icon in the Info Window toolbar.
Options
XPath intelligent editing: If an XML file has been assigned, the structure of the XML
document is known and intelligent XPath editing will extend to elements and attributes. At
locations in the XSLT document where an XPath expression can be entered, available elements
and attributes will be shown in a popup. This option is switched on by default. To disable XPath
intelligent editing, uncheck the check box. The setting is saved for each XSLT file separately
when the file is closed, and will be used each time the file is opened.
Toolbar icons
The Info Window toolbar icons (screenshot below) are, from left to right:
Reload info: Updates the Info Window to reflect modifications made in teh XSLT
document.
Clear XML/XSD assignment: Clears an XML or XSD/DTD assignment made by the
user by browsing via the XML or XSD/DTD icons, respectively. Select the file to clear
and then click this icon.
Open document: Opens the selected document.
Go to import/include location: When an imported or included file is selected, clicking this
icon highlights the relevant import or include declaration in the XSLT document.
Zip all local documents: Zips all the documents listed in the Info Window to a user-
defined location. Alternatively, only the selected documents can be zipped; do this by
selecting, in the dropdown menu of this icon, the command Zip selected local
documents.
Add all files to projects: Adds all files to the current projects. Alternatively, only the
selected documents can be added; do this by selecting, in the dropdown menu of this
icon, the command Add selected files to project.
7.2 XQuery
Altova website: XQuery Editor
XQuery documents can be edited in Text View. The Entry Helpers, syntax coloring, and
intelligent editing are different than for XML documents (see screenshot; line numbering and
folding margins in Enterprise and Professional Editions only). We call this mode of Text View its
XQuery Mode. In addition, you can validate your XQuery document in Text View and execute
the code in an XQuery document (with an optional XML file if required) using the built-in Altova
XQuery Engine.
Please note: XQuery files can be edited only in Text View. No other views of XQuery files are
available.
You should also make the following Windows Explorer settings in this dialog:
Description: XML Query Language
Content type: text/xml
If you wish to use XMLSpy as the default editor for XQuery files, activate the Use
XMLSpy as default editor check box.
To insert any of the items listed in the Entry Helpers into the document, place the cursor at the
required insertion point and double-click the item. In XQuery, some character strings represent
both a keyword and a function (empty, unordered, and except). These strings are always
entered as keywords (in blue)—even if you select the function of that name in the Functions
Entry Helper. When a function appears in blue, it can be distinguished by the parentheses that
follow the function name.
In XQuery code in the XQuery Mode of Text View, the following default syntax coloring is used:
(: Comments, including 'smiley' delimiters, are in green :)
XQuery Keywords are in blue: keyword
XQuery Variables, including the dollar sign, are in purple: $start
XQuery Functions, but not their parentheses, are in olive: function()
Strings are in orange: "Procedure"
All other text, such as path expressions, is black (shown underlined below). So:
for $s in doc("report1.xml")//section[section.title =
"Procedure"]
return ($s//incision)[2]/instrument
You can change these default colors and other font properties in the Text Fonts tab of the
Options dialog (Tools | Options).
Please note: In the above screenshot, one pair of colored parentheses for a comment is
displayed black and bold. This is because of the bracket-matching feature (see XQuery
Intelligent Editing).
Bracket-matching
The bracket-matching feature highlights the opening and closing brackets of a pair of brackets,
enabling you to clearly see the contents of a pair of brackets. This is particularly useful when
brackets are nested, as in XQuery comments (see screenshot below).
Bracket-matching is enabled for round parentheses (), square brackets [], and curly braces
{}. The exception is angular brackets <>, which are used for XML tags.
Please note: When you place the cursor just inside a start or end bracket, both brackets are
highlighted. Pressing Ctrl+E moves the cursor to the other member of the pair. Pressing Ctrl+E
repeatedly enables you to switch between the start and end brackets. This is another aid to
quickly navigating your document.
Keywords
XQuery keywords are instructions used in query expressions, and they are displayed in blue.
You select a keyword by placing the cursor inside a keyword, or immediately before or after it.
With a keyword selected, pressing Ctrl+Space causes a complete list of keywords to be
displayed in a pop-up menu. You can scroll through the list and double-click a keyword you wish
to have replace the selected keyword.
In the screenshot above, the cursor was placed in the let keyword. Double-clicking a keyword
from the list causes it to replace the let keyword.
Variables
Names of variables are prefixed with the $ sign, and they are displayed in purple. This
mechanism of the intelligent editing feature is similar to that for keywords. There are two ways
to access the pop-up list of all variables in a document:
After typing a $ character, press Ctrl+Space
Select a variable and press Ctrl+Space. (A variable is selected when you place the
cursor immediately after the $ character, or within the name of a variable, or
To insert a variable after the $ character (when typing), or to replace a selected variable,
double-click the variable you want in the pop-up menu.
Functions
Just as with keywords and variables, a pop-up menu of built-in functions is displayed when you
select a function (displayed in olive) and press Ctrl+Space. (A function is selected when you
place the cursor within a function name, or immediately before or after a function name. The
cursor must not be placed between the parentheses that follow the function's name.)
Double-clicking a function name in the pop-up menu replaces the selected function name with
the function from the pop-up menu.
To display a tip containing the signature of a function (screenshot below), place the cursor
immediately after the opening parenthesis and press Ctrl+Space.
Please note: The signature can be displayed only for standard XQuery functions.
The downward-pointing arrowhead indicates that there is more than one function with the same
name but with different arguments or return types. Click on the signature to display the
signature of the next function (if available); click repeatedly to cycle through all the functions
with that name. Alternatively, you can use the Ctrl+Shift+Up or Ctrl+Shift+Down
key-combinations to move through a sequence.
Visual Guides
Text folding is enabled on XQuery curly braces, XQuery comments, XML elements, and XML
comments.
2. Select XML | Validate, or press the F8 key, or click the toolbar icon.
Typically, an XQuery document is not associated with any single XML document. This is
because XQuery expressions can select any number of XML documents with the doc()
function. In XMLSpy, however, before executing individual XQuery documents you can select a
source XML document for the execution. In such cases, the document node of the selected
XML source is the starting context item available at the root level of the XQuery document.
Paths that begin with a leading slash are resolved with this document node as its context item.
The result document is generated as a temporary file that can be saved to any location with the
desired file format and extension.
XQuery Variables
If you are using the Altova XQuery engine, XQuery variables can be stored in a convenient GUI
dialog. All the stored variables are passed to the XQuery document each time you execute an
XQuery document via XMLSpy. For more information, see the description of the XSLT
Parameters / XQuery Variable command.
The steps for implementing this mechanism are as follows and are described in detail below:
1. Set up the XQuery document to query the XML DB by inserting the XQUERY keyword at
If the document uses the optional xquery version expression, the XQUERY keyword is still
required:
Note: XMLSpy's built-in XQuery Engine reads the XQUERY keyword as indicating that an XML
DB is to be accessed. As a result, attempting to execute an XQuery document
containing the XQUERY keyword on any XML document other than one contained in an
XML DB will result in an error.
When you enable DB support in the Info window, a Quick Connect dialog pops up, which
enables you to connect to a database. Currently, only IBM DB2 databases are supported. How
to connect to a DB is described in the section, Connecting to a Data Source. If connections to
data sources already exists, then these are listed in the Data Sources combo box of the Info
window (screenshot below), and one of these data sources can be selected as the data source
for the active XQuery document. In the Info window, you can also select the root object from
among those available in the Root Object combo box.
The Quick Connect dialog (which enables you to connect to a DB) can be accessed at any time
by clicking the icon in the Info window.
Note: When you close an XQuery document the connection to the DB is closed as well. If you
subsequently re-open the XQuery document, you will also have to re-connect to the DB.
The XML data retrieved using these functions can then be operated on using standard XQuery
constructs. See examples below.
The retrieved data can then be queried with XQuery constructs. In the example below, the XML
data retrieved from the the INFO (XML) column of the CUSTOMER table is filtered using an
XQuery construct so that only the profiles of customers from Toronto are retrieved.
XQUERY (: Retrieve details of Toronto customers :)
declare default element namespace "http://www.altova.com/xquery/databases/db2"
;
<newdocelement> {db2-fn:xmlcolumn("CUSTOMER.INFO")/customerinfo[addr/city=
'Toronto']} </newdocelement>
Note: In the example above, the document element of the XML files in each cell is
customerinfo and the root node of the XML sequence returned by db2-fn:xmlcolumn
is considered to be an abstract node above the customerinfo nodes.
db2-fn:sqlquery:The function takes an SQL Select statement as its argument and returns
a sequence of XML values. The retrieved sequence is then queried with XQuery constructs. In
the following example, the INFO column is filtered for records in the CUSTOMER table that have a
CID field with a value between 1000 and 1004. Note that while SQL is not case-sensitive,
XQuery is.
XQUERY (: Retrieve details of customers by Cid:)
declare default element namespace "http://www.altova.com/xquery/databases/db2"
;
<persons>
{db2-fn:sqlquery("SELECT info FROM customer WHERE CID>1000 AND CID<1004")/
<person>
<id>{data(@Cid)}</id>
<name>{data(name)}</name>
</person>}
</persons>
The XSLT and XQuery Debugger enables you to test and debug XSLT stylesheets and XQuery
documents. The XSLT and XQuery Debugger interface presents simultaneous views of the
XSLT/XQuery document, the result document, and the source XML document. You can then go
step-by-step through the XSLT/XQuery document. The corresponding output is generated
step-by-step, and, if a source XML file is displayed, the corresponding position in the XML file is
highlighted for each step. At the same time, windows in the interface provide debugging
information.
The XSLT and XQuery Debugger always opens within a debugging session. Debugging
sessions can be of three types:
XSLT 1.0, which uses the built-in Altova XSLT 1.0 engine
XSLT 2.0, which uses the built-in Altova XSLT 2.0 engine
XQuery, which uses the built-in Altova XQuery 1.0 engine
For details about the three Altova engines, please see the following sections:
Altova XSLT 1.0 Engine
Altova XSLT 2.0 Engine
Altova XQuery 1.0 Engine
XSLT and XQuery tasks can therefore be automated with the use of Altova XML. For example,
you can create a batch file that calls Altova XML to transform a set of XML documents or to
execute a set of XQuery documents. See the Altova XML documentation for details.
Alternatively to the view of the three documents (XML, XSLT/XQuery, Output) shown
above, a view of two documents (XSLT/XQuery and Output), or a view of any one of the
documents can be selected.
While a debugging session is open, information windows in the interface provide
information about various aspects of the transformation/execution (Variables, XPath
Watch, Call Stack, Messages, Info, etc).
While a debugging session is open, you can stop the debugger (not the same as
stopping the debugging session) to make changes to any of the documents. All the
editing features that are available in your XMLSpy environment are also available while
editing a file during a debugging session. When the debugger is stopped, the XSLT and
XQuery Debugger interface stays open, and you have access to all the information in
the information windows. After stopping the debugger in a debugging session, you can
restart the debugger (from the beginning of the XSLT/XQuery document) within the
same debugging session.
Breakpoints can be set in the XSLT file to interrupt the processing at selected points.
This speeds up debugging sessions since you do not have to step through each
statement in the XSLT or XQuery document manually.
Tracepoints can be set in the XSLT file. For instructions where a tracepoint is set, the
value of that instruction is output when the instruction is reached.
Stop a debugging session. This closes the XSLT and XQuery Debugger interface and
returns you to your previous XMLSpy environment. The information in the information
windows is no longer available. Breakpoint and tracepoint information, however, is
retained in the respective files till the file is closed. (So if you start another debugging
session involving a file containing breakpoints, the breakpoints will apply in the newly
opened debugging session.)
Please note: The Debugger toolbar with Debugger icons appears automatically when a
debugging session is started.
Stop Debugger
Stops the debugger. This is not the same as stopping the debugger session in which the
debugger is running. This is convenient if you wish to edit a document in the middle of a
debugging session or to use alternative files within the same debugging session. After stopping
the debugger, you must restart the debugger to start from the beginning of the XSLT/XQuery
document.
Restart Debugger
Clears the output window and restarts the debugging session with the currently selected files.
Output Window
Sets the view of the output document window (Default, Text, Grid, or Browser). The Default
View is that selected for the output file type in the File tab of the Options dialog (Tools | Options
). For XSLT transformations, the output file type is defined in the XSLT file. For XQuery
executions, the output file type is determined by the serialization format you choose in the
XQuery setting of this dialog (see below).
The Close All Output Windows option gives you the opportunity to keep open the output
document windows that were opened in the debugging session when the debugging session
ends.
Debugging
The Debug Built-in Templates setting causes the debugger to step into built-in templates code
whenever appropriate. It is not related to the display of built-in templates when clicking this type
of template entry in the Templates tab, or if the callstack shows a node from the built-in
template file.
The XSLT Debugger works only in Text View or Grid View. The Auto Change to Text View
option enables you to automatically switch to the Text View of a document for debugging if a
document is not in Text View or Grid View. (The XQuery Debugger works in Text View only.) If
the On demand variable execution check box is checked, the definition of a variable will be
stepped into when the variable is called. Otherwise, the Debugger will not step into the variable
definition when it encounters a call to a variable, but will carry on to the next step.
XQuery
The serialization method determines two things: (i) the file format of the generated output file,
and (ii) the rules followed in writing the output to the output file. The available options are HTML,
Text, XHTML, and XML. The selection you make sets up an empty file of the selected file type
when you start the debugger inside a debugging session. The file type is significant because it
enables currently active XMLSpy features for that file type (such as validation for XML files).
You can choose to omit the XML declaration and to indent the output. The Always Skip XML
Source option enables you to always skip the optional XML file association step when you start
a debugging session from an XQuery file. For DB2 databases, you can specify the maximum
number of rows to be retrieved.
The file type selected here determines the file type of the output format for XML or XSLT files
that belong to a project for which XSLT transformation properties have been defined.
Predefined associations
Predefined associations are relevant only for XSLT debugging sessions, and refer to cases in
which the associated file assignment is already present in the active file. To make an
assignment in an XML or XSLT file, do the following:
In XML files: Open the file, click XSL/XQuery | Assign XSL, and select the XSLT file.
In XSLT files: Open the file, click XSL/XQuery | Assign sample XML file..., and select
the XML file.
When you click XSL/XQuery | Start Debugger/Go, the debugging session is started directly,
i.e. without you being prompted for any file to associate with the active file.
Direct assignment
If no predefined association is present in the active file, you are prompted for an association.
When you select XSL/XQuery | Start Debugger/Go, the following happens:
For XML files: You are prompted to select an XSLT or XQuery file.
For XSLT files: You are prompted to select an XML file.
For XQuery files: You are given the option of selecting an XML file, which you can skip.
(The dialog shown in the screenshot appears when you start a debugging session from
an XQuery file.)
After you select the required associated file or skip an optional association, the debugging
session is started.
Debugger View
The XSLT and XQuery Debugger works only in Text View and Enhanced Grid View. If either
your XML or XSLT file is open in some other view than Text or Grid View, or if an SPS file is
associated with an XML file, the following dialog pops up when you start a debugging session
involving one of these files.
Clicking OK causes the document to open in Text View. Note that XQuery files are always
displayed in Text View.
There are eight information windows in XSLT debugging sessions and five information windows
in XQuery debugging sessions. These windows are organized into two groups by default, which
are located at the bottom of the XSLT and XQuery Debugger interface (see illustration below).
These windows and the information they display are described in detail in this section.
The first group of information windows displays the following windows as tabs in a single
window:
Context (for XSLT debugging sessions only)
Variables
XPath-Watch
The second group of information windows displays the following windows as tabs in a single
window
Call Stack
Messages
Templates (for XSLT debugging sessions only)
Info
Trace
In the default layout, therefore, there are two window groups, each having tabs for the different
windows in them. One tab is active at a time. So, for example, to display information about
Variables in the first information window group, click the Variables tab. This causes the
Variables information window to be displayed and the Context and XPath-Watch information
windows to be hidden. Note that in some tabs, you can use the information display as
navigation tools: clicking an item can take you to that item in the XML, XSLT, or XQuery file.
See the documentation of the respective information windows (Context, Call Stack, Templates)
for details.
The two information window groups can be resized by dragging their borders. Individual
windows can be dragged out of the containing group by clicking the tab name and dragging the
window out of the group. A window can be added to a group by dragging its title bar onto the
title bar of the group. Note that there is no reset button to return the layout to the default layout.
Context Window
The Context Window is available in XSLT debugging sessions only; it is not available in XQuery
debugging sessions.
During the processing of the XSLT stylesheet, the processor's context is always within a
template that matches some sequence (of nodes or atomic values). The Context Window
displays the current processing context, which could be a sequence of nodes, a single node, or
an atomic value (such as a string). Depending on the kind of a context item, its value or
attribute/s is/are displayed. For example, if the context item is an element, the element's
attributes are displayed. If the context item is an attribute or text node, the node's value is
displayed.
Clicking an entry in the Context Window, displays that item in the XML document. If the XML
document is not currently displayed in the interface, a window for the XML document will be
opened.
Variables Window
The Variables Window is available in XSLT and XQuery debugging sessions. It displays the
variables and parameters that are used in the XSLT/XQuery document when they are in scope,
and their values.
Parameters are indicated with P, global variables (declared at top-level of a stylesheet) are
indicated with G, and local variables (declared within an XSLT template) are indicated with L.
The type of the values of variables and parameters is also indicated by icons in the Value field.
The following types are distinguished: Node Set, Node Fragment, String, Number, and Boolean.
XPath-Watch Window
The XPath-Watch Window is available in XSLT and XQuery debugging sessions.
It enables you to enter XPath expressions that you wish to evaluate in one or more contexts. As
you step through the XSLT document, the XPath expression is evaluated in the current context
and the result is displayed in the Value column.
To enter an XPath expression, double-click in the text field under the Name column and enter
the XPath. Alternatively, drag an XPath expression from a file and drop it into the XPath-Watch
Window. Use expressions that are correct according to the XPath version that corresponds to
the XSLT version of the XSLT stylesheet (XPath 1.0 for XSLT 1.0, and XPath 2.0 for XSLT 2.0).
Please note: If namespaces have been used in the XML file or XSLT file, you must use the
correct namespace prefixes in your XPath expressions.
The Call Stack Window displays a list of previously processed XSLT templates and instructions,
with the current template/instruction appearing at the top of the list.
Clicking an entry in this window, causes the selected XSLT template/instruction to be displayed
in the XSLT document window. Clicking a template/instruction that references a built-in
template highlights the built-in template in a separate window that displays all built-in templates.
Messages Window
The Messages Window is displayed in XSLT and XQuery debugging sessions.
XQuery
In XQuery debugging sessions, the Messages Window displays error messages.
Templates Window
The Templates Window (see screenshot) is available in XSLT debugging sessions only; it is not
available in XQuery debugging sessions.
The Templates Window displays the various templates used in the XSLT stylesheet, including
built-in templates and named templates. Matched templates are listed by the nodes they match.
Named templates are listed by their name. For both types of template, the mode, priority, and
location of the template are displayed.
In the screenshot above, there are three matched templates in the XSLT stylesheet: a template
which matches the document node /, and templates that match the n1:italic and n1:bold
nodes. All the other templates are built-in templates (indicated with no entry in the Location
field).
Clicking an entry in this window, causes the template to be highlighted in the XSLT document
window. If you click a built-in template, the template is highlighted in a separate window that
displays all the built-in templates.
Info Window
The Info Window is available in XSLT and XQuery debugging sessions. It provides meta
information about the current debugging session. This information includes what debugger is
being used, the names of the source and output documents, and the status of the debugger.
Trace Window
The Trace Window is displayed in XSLT and XQuery debugging sessions.
The Trace Window contains the element the tracepoint is set for, its location in the XSLT
stylesheet and the result generated when that element is executed. Click on a row in the left
side of the window to display the full result on the right.
Menu
In the XSL/XQuery menu, placing the cursor over the item Debug Windows pops up the list of
Info Windows. You can hide or show individual windows by clicking the window.
Context Menu
The context menu can be accessed by right-clicking a window tab or title bar.
Click the required option to cause that window to float, be docked or be hidden.
Drag-and-drop
You can drag a window by its tab or title bar and place it at a desired location.
Additionally, you can dock the window in another window or in the interface using placement
controls that appear when you drag a window:
When you drag a window over another window, a circular placement control appears (
see screenshot below). This control is divided into five placement sectors. Releasing
the mouse key on any of these sectors docks the dragged window into the respective
sector of the target window. The four arrow sectors dock the dragged window into the
respective sides of the target window. The center button docks the dragged window as
a tab of the target window. You can also dock a window as a tab in another window by
dragging it to the tab bar and dropping it there.
When you drag a window, a placement control consisting of four arrows appears. Each
arrow corresponds to one side of the Debugger interface. Releasing a dragged
window over one of these arrows docks the dragged window into one side of the
Debugger interface.
You can also double-click the title bar of a window to toggle it between its docked and floating
positions.
7.3.6 Breakpoints
The XSLT and XQuery Debugger enables you to define breakpoints in XSLT, XQuery, and XML
documents. Breakpoints are displayed as a dashed red line (shown in the screenshot below).
Please note: It is possible to set a tracepoint and a breakpoint for the same instruction. This
appears as a dashed blue and red line (see screenshot).
When you start the debugger within a debugging session, the debugging will pause at each
encountered breakpoint. In this way, you can identify specific areas to debug, and restrict
attention to these areas in either the XSLT, XQuery, and/or XML documents. You can set any
number of breakpoints.
Please note: Breakpoints set for a document remain in that document until it is closed.
However, if you switch to Schema View (for example, in the case of XSD documents), then the
breakpoints are deleted; when you switch back to Text View or Grid View (from Schema View),
there will be no breakpoint.
Inserting/removing breakpoints
To insert a breakpoint:
1. Place the cursor at the point in the document where you wish to insert the breakpoint (
see paragraphs above). In XSLT debugging sessions, you can set breakpoints in both
Text View and Grid View. XQuery debugging sessions are available only in Text View.
2. Do one of the following:
Select XSL/XQuery | Insert/Remove Breakpoint.
Press F9.
To remove a breakpoint:
1. Place the cursor at the point in the document containing the breakpoint.
2. Do one of the following:
Select XSL/XQuery | Insert/Remove Breakpoint.
Press F9.
Right-click and select Insert/Remove Breakpoint.
The Remove All button deletes all the breakpoints from the dialog box (and all XSLT
stylesheets).
Disabling/enabling breakpoints:
After inserting breakpoints, you can disable them if you wish to skip over breakpoints without
having to delete them. You can enable them again when necessary.
To disable a breakpoint:
1. Place the cursor in the node or expression containing the breakpoint.
2. Select XSL/XQuery | Enable/Disable Breakpoint (or press Ctrl+F9). The breakpoint
changes from red to gray, indicating that it has been disabled.
2. Remove the check mark of the breakpoints you wish to disable, and click OK to
confirm. The breakpoint changes from red to gray, indicating that it has been disabled.
To enable a breakpoint:
7.3.7 Tracepoints
The XSLT and XQuery Debugger enables you to define tracepoints in XSLT documents.
Tracepoints allow you to trace content generated by an instruction or view the result of an XPath
expression at the point where the tracepoint is set without having to edit the XSLT stylesheet,
for example, using the xsl:message element to output debugging messages.
Tracepoints are displayed as a dashed blue line in XSLT stylesheets (shown in the screenshot
below).
Please note: It is possible to set a tracepoint and a breakpoint for the same instruction. This
appears as a dashed blue and red line (see screenshot).
The debugger outputs the content generated by each instruction that has a tracepoint set for it.
This output is visible in the Trace window. You can set any number of tracepoints in an XSLT
stylesheet.
Please note: Tracepoints set for a document remain in that document until it is closed.
Inserting/removing tracepoints
To insert a tracepoint:
1. Place the cursor at the point in the XSLT document where you wish to insert the
tracepoint. During debugging sessions, you can set tracepoints in both Text View and
Grid View.
2. Do one of the following:
To remove a tracepoint:
1. Place the cursor at the point in the XSLT document containing the tracepoint.
2. Do one of the following:
Select XSL/XQuery | Insert/Remove Tracepoint.
Press Shift+F9.
Right-click and select Insert/Remove Tracepoint.
Alternatively, you can use the XSLT Breakpoints / Tracepoints dialog to remove a tracepoint:
1. Select the menu option XSL/XQuery | Breakpoints/Tracepoints....
2. Click the tracepoint in the dialog box (see screenshot) and click Remove.
The Remove All button in the Tracepoints pane deletes all the tracepoints from the dialog box
(and from all XSLT stylesheets).
Example:
The following example uses the file OrgChart.xsl, which is found in the XMLSpy Examples
folder.
The tracepoint is set such that the context node is Person. The Person element contains a
Shares element. We want to display the number of shares that each person has, multiplied by
125 (the value of each share).
Do the following:
1. Open the file OrgChart.xsl.
2. Set a tracepoint at line 555.
3. Open the XSLT Breakpoints / Tracepoints dialog and enter the XPath
n1:Shares*125.00 for the tracepoint you just set.
4. Start the Debugger. The results of the XPath you entered for the tracepoint appear in
the Trace window.
Please note: Results are displayed in the Trace window only after the traced instruction is
completed.
Disabling/enabling tracepoints
After inserting tracepoints, you can disable them if you wish to skip over them without having to
delete them. You can enable them again when necessary.
To disable a tracepoint:
1. Place the cursor at the point in the XSLT stylesheet containing the tracepoint.
2. Select XSL/XQuery | Enable/Disable Tracepoint (or press Ctrl+Shift+F9). The
tracepoint changes from blue to gray, indicating that it has been disabled.
Alternatively, you can use the XSLT Breakpoints / Tracepoints dialog to disable a tracepoint:
1. Select the menu option XSL/XQuery | Breakpoints/Tracepoints.... This opens the
XSLT Breakpoints / Tracepoints dialog box which displays the currently defined
tracepoints in all open XSLT stylesheet documents.
2. Remove the check mark of each tracepoint you wish to disable, and click OK to
confirm. The tracepoints change from blue to gray, indicating that they have been
disabled.
To enable a tracepoint:
1. Place the cursor at the point in the XSLT document containing the tracepoint.
2. Select XSL/XQuery | Enable/Disable Tracepoint (or press Ctrl+Shift+F9). The
tracepoint changes from gray to blue, indicating that it has been enabled.
The XSLT/XQuery Profiler is a tool that is used to analyze the execution times of XSLT (1.0 and
2.0) stylesheets and XQuery documents from within XMLSpy. It tells you how much time each
instruction in the XSLT stylesheet or XQuery document takes to execute, and you can use this
information to optimize the execution time of these files.
The Profiler is used to find the instructions that have the highest total execution time so that this
information can then be used to optimize these instructions. Instructions can have a high total
execution time for one or both of the following reasons:
the instruction is time-intensive
the instruction is evaluated often (high hit count)
To use the XSLT/XQuery Profiler, see Analyzing XSLT Transformations or Analyzing XQuery
Execution.
Profiler Views
The results of the analysis can be viewed in either of the following views by clicking the
corresponding tab:
List View: The profiling statistics are displayed as a list that can be sorted by, e.g.,
duration of instruction execution or duration of execution of the instruction and its
descendants.
Tree View: The statistics are displayed in a tree-like structure. It is possible to see, e.g.,
how long a function took to execute, and then expand the tree for that function and see
how much time each instruction in the function took to execute, and how many times it
was executed.
Sorting Results
After you have run the Profiler, you can sort by the amount of time an instruction took to
execute, or by the number of times that instruction was called.
To sort information in the Profiler:
1. Click the List tab.
2. Click the column header of the column you want to sort by (e.g., Hit Count to sort by
the number of times an instruction was called or Duration to sort by the time the
instruction takes to execute).
This screenshot shows the contents of the Profiler sorted by instruction duration in descending
order.
The following XSLT code fragments show an example of how to optimize code by
removing unnecessary variables. Both do the same thing, but the second example does
so without using the variables name and containsResult:
Code fragment 1:
<xsl:for-each select="row">
<xsl:variable name="row" select="."/>
<xsl:for-each select="@name">
<xsl:variable name="name" select="."/>
<xsl:variable name="containsResult" select="fn:contains
($name, '.exe')"/>
<xsl:if test="string($containsResult)='true'">
...
</xsl:if>
</xsl:for-each>
</xsl:for-each>
The screenshot below shows the results of the analysis of the file that contains this
code fragment, sorted by duration of instructions. The instruction in which the variable
containsResult is initialized needs about 19 seconds total execution time.
The screenshot below shows the results in the tree view. Here we can see that the if-statement
that uses the variable containsResult needs about 50 seconds total execution time:
Code fragment 2:
<xsl:for-each select="row">
<xsl:variable name="row" select="."/>
<xsl:for-each select="@name">
<xsl:if test="fn:contains(., '.exe')">
...
</xsl:if>
</xsl:for-each>
</xsl:for-each>
After the stylesheet is rewritten without using these variables, its total execution time is
only about 4.3 seconds:
Please note: Execution time results displayed in the Profiler may be influenced by other
applications that are running on your computer. When analyzing files using the Profiler, it is best
to run only the XMLSpy application.
Click on a row in the Profiler to highlight the corresponding instruction in the file that was
analyzed.
The following screenshot shows List View in the Profiler for the same XSLT stylesheet:
Descendants and Self and %: The number of milliseconds that the instruction and its
descendants took to execute, and the percentage of the total execution time.
XPath: If the instruction contains an XPath statement, this column contains the time it
took that statement to execute.
Please note: When using hitcount profiling, the times in the Profiler window are the sum total of
execution time for all the hits to the instruction. When using callgraph profiling, because each
call of the instruction is listed separately, the times shown in the Profiler window are the duration
of a single execution of the instruction.
Please note: Execution time results displayed in the Profiler may be influenced by other
applications that are running on your computer. When analyzing files using the Profiler, it is best
to run only the XMLSpy application.
Click on a row in the Profiler to highlight the corresponding instruction in the file that was
analyzed.
The following screenshot shows List View in the Profiler for the same XQuery document:
Duration (ms) and %: The number of milliseconds that the instruction took to execute
without taking the execution time of its descendants into account, and the percentage of
the total execution time.
Descendants and Self (ms) and %: The total time spent executing the instruction and
its descendants, and the percentage of the total execution time.
Please note: When using hitcount profiling, the times in the Profiler window are the sum total of
execution time for all the hits to the instruction. When using callgraph profiling, because each
call of the instruction is listed separately, the times shown in the Profiler window are the duration
of a single execution of the instruction.
Clicking the Select Data button of the Charts output window pops up the Select Data
dialog (screenshot below). In this dialog, you can select data for the X-Axis and Y-Axis
from the data table that is produced by the Select Columns process. To select data for
the X-Axis click in the Axis Values text box and then either enter the range of table
values (for example, A1:A7) or drag the cursor from the start of the range to the end of
the range. Do the same for the Y-Axis.
Clicking the Select Columns button enables you to change the data selection for the
data table. See the Source XPath, X-Axis Selection, and Y-Axis Selection for
information about how column selection works.
For more detailed information about charts see the Charts section of the documentation.
8 Authentic
Authentic View (screenshot below) is a graphical representation of your XML document. It
enables XML documents to be displayed without markup and with appropriate formatting and
data-entry features such as input fields, combo boxes, and radio buttons. Data that the user
enters in Authentic View is entered into the XML file.
To be able to view and edit an XML document in Authentic View, the XML document must be
associated with a StyleVision Power Stylesheet (SPS), which is created in Altova's
StyleVision product. An SPS (.sps file) is, in essence, an XSLT stylesheet. It specifies an
output presentation for an XML file that can include data-entry mechanisms. Authentic View
users can, therefore, write data back to the XML file or DB. An SPS is based on a schema and
is specific to it. If you wish to use an SPS to edit an XML file in Authentic View, you must use
one that is based on the same schema as that on which the XML file is based.
In this section
This section contains an Authentic View tutorial, which shows you how to use Authentic View. It
is followed by the section, Editing in Authentic View, which explains individual editing features in
detail.
Editing an XML document in Authentic View involves two user actions: (i) editing the structure of
the document (for example, adding or deleting document parts, such as paragraphs and
headlines); and (ii) entering data (the content of document parts).
Remember that this tutorial is intended to get you started, and has intentionally been kept
simple. You will find additional reference material and feature descriptions in the Authentic View
interface section.
Tutorial requirements
All the files you need for the tutorial are in the C:\Documents and Settings\<username>\My
Documents\Altova\<ProductName>\Examples folder of your Altova application folder. These
files are:
NanonullOrg.xml (the XML document you will open)
NanonullOrg.sps (the StyleVision Power Stylesheet to which the XML document is
linked)
NanonullOrg.xsd (the XML Schema on which the XML document and StyleVision
Power Stylesheet are based, and to which they are linked)
nanonull.gif and Altova_right_300.gif (two image files used in the tutorial)
Please note: At some points in the tutorial, we ask you to look at the XML text of the XML
document (as opposed to the Authentic View of the document). If the Altova product edition you
are using does not include a Text View (as with Authentic Desktop and Authentic Browser), then
use a plain text editor like Wordpad or Notepad to view the text of the XML document.
Caution: We recommend that you use a copy of NanonullOrg.xml for the tutorial, so that
you can always retrieve the original should the need arise.
The file NanonullOrg.xml opens directly in Authentic View (screenshot below). This is
because
1. The file already has a StyleVision Power Stylesheet (SPS) assigned to it, and
2. In the Options dialog (Tools | Options), in the View tab, the option to open XML files in
Authentic View if an SPS file is assigned has been checked. (Otherwise the file would
open in Text View.)
Remember: It is the SPS that defines and controls how an XML document is displayed in
Authentic View. Without an SPS, there can be no Authentic View of the document.
If a Template XML File has been assigned to the SPS, then the data in the Template XML File
is used as the starting data of the XML document template that is created in Authentic View.
</DocumentRoot>
By default, the node tags are not displayed in Authentic View. You can switch on the node tags
by selecting the menu item Authentic | Show Large Markup (or the toolbar icon). Large
markup tags contain the names of the respective nodes. Alternatively, you can select small
markup (no node names in tags) and mixed markup (a mixture of large, small, and no markup
tags, which is defined by the designer of the stylesheet; the default mixed markup for the
document is no markup).
You can view the text of the XML document in the Text View of your Altova product or in a text
editor.
Entry helpers
There are three entry helpers in the interface (screenshot below), located by default along the
right edge of the application window. These are the Elements, Attributes, and Entity entry
helpers.
Elements entry helper: The Elements entry helper displays elements that can be inserted and
removed with reference to the current location of the cursor or selection in the Main Window.
Note that the entry helper is context-sensitive; its content changes according to the location of
the cursor or selection. The content of the entry helper can be changed in one other way: when
another node is selected in the XML tree of the Elements entry helper, the elements relevant to
that node are displayed in the entry helper. The Elements entry helper can be expanded to
show the XML tree by checking the Show XML Tree check box at the top of the entry helper (
see screenshot above). The XML tree shows the hierarchy of nodes from the top-level element
node all the way down to the node selected in the Main Window.
Attributes entry helper: The Attributes entry helper displays the attributes of the element
selected in the Main Window, and the values of these attributes. Attribute values can be entered
or edited in the Attributes entry helper. Element nodes from the top-level element down to the
selected element are available for selection in the combo box of the Atributes entry helper.
Selecting an element from the dropdown list oft he combo box causes that element's attributes
to be displayed in the entry helper, where they can then be edited.
Entities entry helper: The Entities entry helper is not context-sensitive, and displays all the
entities declared for the document. Double-clicking an entity inserts it at the cursor location.
How to add entities for a document is described in the section Authentic View Interface.
Context menu
Right-clicking at a location in the Authentic View document pops up a context menu relevant to
that (node) location. The context menu provides commands that enable you to:
Insert nodes at that location or before or after the selected node. Submenus display
lists of nodes that are allowed at the respective insert locations.
Remove the selected node (if this allowed by the schema) or any removable ancestor
element. The nodes that may be removed (according to the schema) are listed in a
submenu.
Insert entities and CDATA sections. The entities declared for the document are listed in
a submenu. CDATA sections can only be inserted withn text.
Cut, copy, paste (including pasting as XML or text), and delete document content.
Note: For more details about the interface, see Authentic View Interface
The node operations described in this section refer only to element nodes and attribute nodes.
When trying out the operations described in this section, it is best to have large markup
switched on.
Note: It is important to remember that only same- or higher-level elements can be inserted
before or after the selected element. Same-level elements are siblings. Siblings of a
paragraph element would be other paragraph elements, but could also be lists, a table,
an image, etc. Siblings could occur before or after an element. Higher-level elements
are ancestor elements and siblings of ancestors. For a paragraph element, ancestor
elements could be a section, chapter, article, etc. A paragraph in a valid XML file would
already have ancestors. Therefore, adding a higher-level element in Authentic View,
creates the new element as a sibling of the relevant ancestor. For example, if a section
Inserting elements
Elements can be inserted at the following locations:
The cursor location within an element node. The elements available for insertion at that
location are listed in a submenu of the context menu's Insert command. In the
Elements entry helper, elements that can be inserted at a location are indicated with
the icon. In the NanonullOrg.xml document, place the cursor inside the para
element, and create bold and italic elements using both the context menu and
Elements entry helper.
Before or after the selected element or any of its ancestors, if allowed by the schema. In
the first submenu that rolls out, you select the element (selected element or an
ancestor) before/after which you wish to insert the element. In the (second) submenu,
which now rolls out, you select the element you wish to insert. In the Elements entry
helper, elements that can be inserted before or after the selected element are indicated
with the and icons, respectively. Note that in the Elements entry helper, you can
insert elements before/after the selected element only; you cannot insert before/after an
ancestor element. Try out this command, by first placing the cursor inside the para
element and then inside the table listing the employees.
If the content model of an element is ambiguous, for example, if it specifies that a sequence of
child elements may appear in any order, then the add... link appears. Note that no node name
is specified. Clicking the link will pop up a list of elements that may validly be inserted.
Note: The Add Node link appears directly in the document template; there is no
corresponding entry in the context menu or Elements entry helper.
Applying elements
In elements of mixed content (those which contain both text and child elements), some text
content can be selected and an allowed child element be applied to it. The selected text
becomes the content of the applied element. To apply elements, in the context menu, select
Apply and then select from among the applicable elements. (If no elements can be applied to
the selected text, then the Apply command does not appear in the context menu.) In the
Elements entry helper, elements that can be applied for a selection are indicated with the
icon. In the NanonullOrg.xml document, select text inside the mixed content para element and
experiment with applying the bold and italic elements.
The stylesheet designer might also have created a toolbar icon to apply an element. In the
NanonullOrg.xml document, the bold and italic elements can be applied by clicking the
bold and italic icons in the application's Authentic toolbar.
Removing nodes
A node can be removed if its removal does not render the document invalid. Removing a node
causes a node and all its contents to be deleted. A node can be removed using the Remove
command in the context menu. When the Remove command is highlighted, a submenu pops
up which contains all nodes that may be removed, starting from the selected node and going up
to the document's top-level node. To select a node for removal, the cursor can be placed within
the node, or the node (or part of it) can be highlighted. In the Elements entry helper, nodes that
can be removed are indicated with the icon. A removable node can also be removed by
selecting it and pressing the Delete key. In the NanonullOrg.xml document, experiment with
removing a few nodes using the mechanisms described. You can undo your changes with Ctrl
+Z.
Clearing elements
Element nodes that are children of elements with mixed content (both text and element
children) can be cleared. The entire element can be cleared when the node is selected or when
the cursor is placed inside the node as an insertion point. A text fragment within the element
can be cleared of the element markup by highlighting the text fragment. With the selection
made, select Clear in the context menu and then the element to clear. In the Elements entry
helper, elements that can be cleared for a particular selection are indicated with the icon
(insertion point selection) and icon (range selection). In the NanonullOrg.xml document, try
the clearing mechanism with the bold and italic child elements of para (which has mixed
content).
For example, to change the name of the company, in the Name field of Office, place the cursor
after Nanonull, and type in USA to change the name from Nanonull, Inc. to Nanonull USA, Inc.
If text is editable, you will be able to place your cursor in it and highlight it, otherwise you will not
be able to. Try changing any of the field names (not the field values), such as "Street", "City", or
"State/Zip," in the address block. You are not able to place the cursor in this text because such
text is not XML content; it is derived from the StyleVision Power Stylesheet.
copying them from the character map of your system to the required location in the
document.
A frequently used text string can be defined as an entity, which appears in the Entities
entry helper. The entity is inserted at the required locations by placing the cursor at
each required location and double-clicking the entity in the entry helper. This is useful
for maintenance because the value of the text string is held in one location; if the value
needs to be changed, then all that needs to be done is change the entity definition.
Note: When markup is hidden in Authentic View, an empty element can easily be overlooked.
To make sure that you are not overlooking an empty element, switch large or small
markup on.
Given below is a list of data-entry devices in Authentic View, together with an explanation of
how data is entered in the XML file for each device.
In the static table containing the address fields (shown below), there are two data-entry devices:
an input field for the Zip field and a combo-box for the State field. The values that you enter in
the text fields are entered directly as the XML content of the respective elements. For other
data-entry devices, your selection is mapped to a value.
For the Authentic View shown above, here is the corresponding XML text:
<Address>
<ipo:street>119 Oakstreet, Suite 4876</ipo:street>
<ipo:city>Vereno</ipo:city>
<ipo:state>DC</ipo:state>
<ipo:zip>29213</ipo:zip>
</Address>
Notice that the combo-box selection DC is mapped to a value of DC. The value of the Zip field is
entered directly as content of the ipo:zip element.
The ampersand character (&) has special significance in XML (as have the apostrophe, less
than and greater than symbols, and the double quote). To insert these characters, entities are
used so that they are not confused with XML-significant characters. These characters are
available as entities in Authentic View.
In NanonullOrg.xml, change the title of Joe Martin (in Marketing) to Marketing Manager
Europe & Asia. Do this as follows:
1. Place the cursor where the ampersand is to be inserted.
2. Double-click the entity listed as "amp". This inserts an ampersand (screenshot below).
Note: The Entities Entry Helper is not context-sensitive. All available entities are displayed no
matter where the cursor is positioned. This does not mean that an entity can be inserted
at all locations in the document. If you are not sure, then validate the document after
inserting the entity: XML | Validate (F8).
Notice that the formatting of the page is the same as that in Authentic View.
3. To print the file, click File | Print.
Note that you can also print a version of the document that displays (small) markup. To do this,
switch Authentic View to Show small markup mode or Show large markup mode, and then print.
Both modes produce a printout that displays small markup.
Text editing
An Authentic View document will essentially consist of text and images. To edit the text in the
document, place the cursor at the location where you wish to insert text, and type. You can
copy, move, and delete text using familiar keystrokes (such as the Delete key) and drag-and-
drop mechanisms. One exception is the Return key. Since the Authentic View document is pre-
formatted, you do not—and cannot—add extra lines or space between items. The Return key
in Authentic View therefore serves to append another instance of the element currently being
edited, and should be used exclusively for this purpose.
To paste as XML or text, first copy the text (Ctrl+C), right-click at the location where the text is
to be pasted, and select the context menu command Paste As | XML or Paste As | Text. If the
shortcut Ctrl+V is used, the text will be pasted in the default Paste Mode of the SPS. The
default Paste Mode will have been specified by the designer of the SPS. For more details, see
the section Context Menus.
Alternatively, highlighted text can be dragged to the location where it is to be pasted. When the
text is dropped, a pop-up appears asking whether the text is to be pasted as text or XML. Select
the desired option.
Text formatting
One of the most fundamental principles of XML document systems is that content be kept
separate from presentation. The XML document contains the content, while the stylesheet
contains the presentation (formatting). In Authentic View, the XML document is presented via
the stylesheet. This means that all the formatting you see in Authentic View is produced by the
stylesheet. If you see bold text, that bold formatting has been provided by the stylesheet. If you
see a list or a table, that list format or table format has been provided by the stylesheet. The
XML document, which you edit in Authentic View contains only the content; it contains no
formatting whatsoever. The formatting is contained in the stylesheet. What this means for you,
the Authentic View user, is that you do not have to—nor can you—format any of the text you
edit. You are editing content. The formatting that is automatically applied to the content you edit
is linked to the semantic and/or structural value of the data you are editing. For example, an
email address (which could be considered a semantic unit) will be formatted automatically in a
certain way because of it is an email. In the same way, a headline must occur at a particular
location in the document (both a structural and semantic unit) and will be formatted
automatically in the way the stylesheet designer has specified that headlines be formatted. You
cannot change the formatting of either email address or headline. All that you do is edit the
content of the email address or headline.
In some cases, content might need to be specially presented; for example, a text string that
must be presented in boldface. In all such cases, the presentation must be tied in with a
structural element of the document. For example, a text string that must be presented in
boldface, will be structurally separated from surrounding content by markup that the stylesheet
designer will format in boldface. If you, as the Authentic View user, need to use such a text
string, you would need to enclose the text string within the appropriate element markup. For
information about how to do this, see the Insert Element command in the Elements Entry
Helper section of the documentation.
Inserting entities
In XML documents, some characters are reserved for markup and cannot be used in normal
text. These are the ampersand (&), apostrophe ('), less than (<), greater than (>), and quote (")
characters. If you wish to use these characters in your data, you must insert them as entity
references, via the Entities Entry Helper (screenshot below).
XML also offers the opportunity to create custom entities. These could be: (i) special characters
that are not available on your keyboard, (ii) text strings that you wish to re-use in your document
content, (iii) XML data fragments, or (iv) other resources, such as images. You can define your
own entities within the Authentic View application. Once defined, these entities appear in the
Entities Entry Helper and can then be inserted as in the document.
SPS tables are of two types: static and dynamic. SPS tables are designed by the designer of
the StyleVision Power Stylesheet to which your XML document is linked. You yourself cannot
insert an SPS table into the XML document, but you can enter data into SPS table fields and
add and delete the rows of dynamic SPS tables. The section on SPS tables below explains the
features of these tables.
XML tables are inserted by you, the user of Authentic View. Their purpose is to enable you to
insert tables at any allowed location in the document hierarchy should you wish to do so. The
editing features of XML tables and the XML table editing icons are described below.
SPS Tables
Two types of SPS tables are used in Authentic View: static tables and dynamic tables.
Static tables are fixed in their structure and in the content-type of cells. You, as the user of
Authentic View, can enter data into the table cells but you cannot change the structure of these
tables (i.e. add rows or columns, etc) or change the content-type of a cell. You enter data either
by typing in text, or by selecting from options presented in the form of check-box or radio button
alternatives or as a list in a combo-box. After you enter data, you can edit it.
Please note: The icons or commands for editing dynamic tables must not be used to edit
static tables.
Dynamic tables have rows that represent a repeating data structure, i.e. each row has an
identical data structure (not the case with static tables). Therefore, you can perform row
operations: append row, insert row, move row up, move row down, and delete row. These
commands are available under the Authentic menu and as icons in the toolbar (shown below).
To use these commands, place the cursor anywhere in the appropriate row, and then select the
required command.
To move among cells in the table, use the Up, Down, Left, and Right arrow keys. To move
forward from one cell to the next, use the Tab key. Pressing the Tab key in the last cell of a row
creates a new row.
XML Tables
XML tables can be inserted by you, the user of Authentic View. They enable you to insert tables
anywhere in the XML document where they are allowed, which is useful if you need to insert
tabular information in your document. These tables will be printed out as tables when you print
out directly from Authentic View. If you are also generating output with XSLT stylesheets,
discuss the required output with the designer of the StyleVision Power Stylesheet.
Note that you can insert XML tables only at allowed locations. These locations are specified in
the schema (DTD or XML Schema). If you wish to insert a table at additional locations, discuss
this with the person designing the StyleVision Power Stylesheet.
Inserting tables
To insert an XML table:
1. Place your cursor where you wish to insert the table, and click the icon. (Note that
where you can insert tables is determined by the schema.) This opens the Insert Table
dialog (shown below).
2. Select the number of columns and rows, and specify whether you wish the table to
extend the entire available width. For the specifications given in the dialog box shown
above, the following table is created.
You can add and delete columns, create row and column joins later. Create the broad
structure first.
Please note: All modifications to table structure must be made by using the Table menu
commands. They cannot be made by changing attribute values in the Attribute Entry Helper.
1. Place the cursor anywhere in the table and click the (Table Properties) icon. This
opens the Table Properties dialog (see screenshot), where you specify formatting for
the table, or for a row, column, or cell.
2. Set the cellspacing and cellpadding properties to "0". Your table will now look like this:
3. Place the cursor in the first row to format it, and click the (Table Properties) icon.
Click the Row tab.
Since the first row will be the header row, set a background color to differentiate this
row from the other rows. Note the Row properties that have been set in the figure
above. Then enter the column header text. Your table will now look like this:
cell, and click the (Split vertically) icon. Your table will look like this:
5. Now place the cursor in the cell below the cell containing "Telephone", and click the
(Split horizontally) icon. Then type in the column headers "Office" and "Home".
Your table will now look like this:
Now you will have to vertically split each cell in the "Telephone" column.
You can also add and delete columns and rows, and vertically align cell content, using the
table-editing icons. The XML table editing icons are described in the User Reference, in the
section titled "XML Table Icons".
Formatting text
Text in an XML table, as with other text in the XML document, must be formatted using XML
elements or attributes. To add an element, highlight the text and double-click the required
element in the Elements Entry Helper. To specify an attribute value, place the cursor within the
text fragment and enter the required attribute value in the Attributes Entry Helper. After
formatting the header text bold, your table will look like this.
The text above was formatted by highlighting the text, and double-clicking the element strong,
for which a global template exists that specifies bold as the font-weight. The text formatting
becomes immediately visible.
Please note: For text formatting to be displayed in Authentic View, a global template with the
required text formatting must have been created in StyleVision for the element in question.
For a full description of when and how XML tables are to be used, see XML tables.
Insert table
The "Insert Table" command inserts a CALS / HTML table at the current cursor
position.
Delete table
Append row
The "Append row" command appends a row to the end of the currently active table.
Append column
The "Append column" command appends a column to the end of the currently active
table.
Insert row
The "Insert row" command inserts a row above the current cursor position in the
currently active table.
Insert column
The "Insert column" command inserts a column to the left of the current cursor position
in the currently active table.
The "Join cell left" command joins the current cell (current cursor position) with the cell
to the left. The tags of both cells remain in the new cell, the column headers remain
unchanged.
The "Join cell right" command joins the current cell (current cursor position) with the cell
to the right. The tags of both cells remain in the new cell, the column headers remain
unchanged.
The "Join cell below" command joins the current cell (current cursor position) with the
cell below. The tags of both cells remain in the new cell, the column headers remain
unchanged.
The "Join cell above" command joins the current cell (current cursor position) with the
cell above. The tags of both cells remain in the new cell, the column headers remain
unchanged.
The "Split cell Horizontally" command creates a new cell to the right of the currently
active cell. The size of both cells, is now the same as the original cell.
The "Split cell Vertically" command creates a new cell below the currently active cell.
Align top
This command aligns the cell contents to the top of the cell.
Center vertically
Align bottom
This command aligns the cell contents to the bottom of the cell.
Table properties
The "Table properties" command opens the Table Properties dialog box. This icon is
only made active for HTML tables, it cannot be clicked for CALS tables.
8.2.3 Editing a DB
In Authentic View, you can edit database (DB) tables and save data back to a DB. This section
contains a full description of interface features available to you when editing a DB table. The
following general points need to be noted:
The number of records in a DB table that are displayed in Authentic View may have
been deliberately restricted by the designer of the StyleVision Power Stylesheet in order
to make the design more compact. In such cases, only that limited number of records is
initially loaded into Authentic View. Using the DB table row navigation icons (see
Navigating a DB Table), you can load and display the other records in the DB table.
You can query the DB to display certain records.
You can add, modify, and delete DB records, and save your changes back to the DB.
Navigating a DB Table
The commands to navigate DB table rows are available as buttons in the Authentic View
document. Typically, one navigation panel with either four or five buttons accompanies each DB
table.
The arrow icons are, from left to right, Go to First Record in the DB; Go to Previous Record;
Open the Go to Record dialog (see screenshot); Go to Next Record; and Go to Last Record.
XML Databases
In the case of XML DBs, such as IBM DB2, one cell (or row) contains a single XML document,
and therefore a single row is loaded into Authentic View at a time. To load an XML document
that is in another row, use the Authentic | Select New Row with XML Data for Editing menu
command.
DB Queries
A DB query enables you to query the records of a table displayed in Authentic View. A query is
made for an individual table, and only one query can be made for each table. You can make a
query at any time while editing. If you have unsaved changes in your Authentic View document
at the time you submit the query, you will be prompted about whether you wish to save all
changes made in the document or discard all changes. Note that even changes made in other
tables will be saved/discarded. After you submit the query, the table is reloaded using the query
conditions.
Please note: If you get a message saying that too many tables are open, then you can reduce
the number of tables that are open by using a query to filter out some tables.
2. Click the Append AND or Append OR button. This appends an empty criterion for the
query (shown below).
4. Enter the expression for the criterion. An expression consists of: (i) a field name
(available from the associated combo-box); (ii) an operator (available from the
associated combo-box); and (iii) a value (to be entered directly). For details of how to
construct expressions see the Expressions in criteria section.
5. If you wish to add another criterion, click the Append AND or Append OR button
according to which logical operator (AND or OR) you wish to use to join the two criteria.
Then add the new criterion. For details about the logical operators, see the section
Re-ordering criteria in DB Queries.
Expressions in criteria
Expressions in DB Query criteria consist of a field name, an operator, and a value. The
available field names are the child elements of the selected top-level data table; the names of
these fields are listed in a combo-box (see screenshot above). The operators you can use are
listed below:
= Equal to
<> Not equal to
< Less than
<= Less than or equal to
> Greater than
>= Greater than or equal to
LIKE Phonetically alike
NOT LIKE Phonetically not alike
IS NULL Is empty
NOT NULL Is not empty
If IS NULL or NOT NULL is selected, the Value field is disabled. Values must be entered
without quotes (or any other delimiter). Values must also have the same formatting as that of
the corresponding DB field; otherwise the expression will evaluate to FALSE. For example, if a
criterion for a field of the date datatype in an MS Access DB has an expression
StartDate=25/05/2004, the expression will evaluate to FALSE because the date datatype
in an MS Access DB has a format of YYYY-MM-DD.
Parameters are useful if you wish to use a single value in multiple expressions.
Please note: The Edit Parameters dialog contains all the parameters that have been defined
for the stylesheet. While it is an error to use an undeclared parameter in the StyleVision Power
Stylesheet, it is not an error to declare a parameter and not use it.
Please note: If the parameter has already been declared, then the entry will be colored green. If
the parameter has not been declared, the entry will be red, and you must declare it.
The DB Query shown in the screenshot above may be represented in text as:
State=CA AND (City=Los Angeles OR City=San Diego OR (City=San
Francisco AND CustomerNr=25))
You can re-order the DB Query by moving a criterion or set of criteria up or down relative to the
other criteria in the DB Query. To move a criterion or set of criteria, do the following:
1. Select the criterion by clicking on it, or select an entire level by clicking on the bracket
that represents that level.
2. Click the Up or Down arrow button in the dialog.
If the adjacent criterion in the direction of movement is at the same level, the two
criteria exchange places.
A set of criteria (i.e. criterion within a bracket) changes position within the same level; it
does not change levels.
An individual criterion changes position within the same level. If the adjacent criterion is
further outward/inward (i.e. not on the same level), then the selected criterion will move
outward/inward, one level at a time.
Modifying a DB Query
To modify a DB Query:
1. Click the Query button . The Edit Database Query dialog box opens. You can now
edit the expressions in any of the listed criteria, add new criteria, re-order criteria, or
delete criteria in the DB Query.
2. Click OK. The data from the DB is automatically re-loaded into StyleVision so as to
reflect the modifications to the DB Query.
Modifying a DB Table
Adding a record
To add a record to a DB table:
1. Place the cursor in the DB table row and click the icon (to append a row) or the
icon (to insert a row). This creates a new record in the temporary XML file.
2. Click the File | Save command to add the new record in the DB. In Authentic View a
row for the new record is appended to the DB table display. The AltovaRowStatus
for this record is set to A (for Added).
When you enter data for the new record it is entered in bold and is underlined. This enables you
to differentiate added records from existing records—if existing records have not been
formatted with these text formatting properties. Datatype errors are flagged by being displayed
in red.
The new record is added to the DB when you click File | Save. After a new record is saved to
the DB, its AltovaRowStatus field is initialized (indicated with ---) and the record is
displayed in Authentic View as a regular record.
Modifying a record
To modify a record, place the cursor at the required point in the DB table and edit the record as
required. If the number of displayed records is limited, you may need to navigate to the required
record (using the navigation icons described above).
When you modify a record, entries in all fields of the record are underlined and the
AltovaRowStatus of all primary instances of this record is set to U (for Updated). All
secondary instances of this record have their AltovaRowStatus set to u (lowercase). Primary
and secondary instances of a record are defined by the structure of the DB—and
correspondingly of the XML Schema generated from it. For example, if an Address table is
included in a Customer table, then the Address table can occur in the Design Document in two
types of instantiations: as the Address table itself and within instantiations of the Customer
table. Whichever of these two types is modified is the type that has been primarily modified.
Other types—there may be more than one other type—are secondary types. Datatype errors
are flagged by being displayed in red.
The modifications are saved to the DB by clicking File | Save. After a modified record is saved
to the DB, its AltovaRowStatus field is initialized (indicated with ---) and the record is
displayed in Authentic View as a regular record.
Please note:
If even a single field of a record is modified in Authentic View, the entire record is
updated when the data is saved to the DB.
The date value 0001-01-01 is defined as a NULL value for some DBs, and could
result in an error message.
Deleting a record
To delete a record:
1. Place the cursor in the row representing the record to be deleted and click the icon.
The record to be deleted is marked with a strikethrough. The AltovaRowStatus is set
as follows: primary instances of the record are set to D; secondary instances to d; and
records indirectly deleted to X. Indirectly deleted records are fields in the deleted record
that are held in a separate table. For example, an Address table might be included in a
Customer table. If a Customer record were to be deleted, then its corresponding
Address record would be indirectly deleted. If an Address record in the Customer table
were deleted, then the Address record in the Customer table would be primarily deleted,
but the same record would be secondarily deleted in an independent Address table if
this were instantiated.
2. Click File | Save to save the modifications to the DB.
Please note: Saving data to the DB resets the Undo command, so you cannot undo actions
that were carried out prior to the save.
The method the Authentic View user will use is defined in the SPS. Both methods are described
in the two sub-sections of this section.
In order to ensure that the date is entered in the correct format, the SPS designer can include
the graphical Date Picker in the design. This would ensure that the date selected in the Date
Picker is entered in the correct lexical format. If there is no Date Picker, the Authentic View
should take care to enter the date in the correct lexical format. Validating the XML document
could provide useful tips about the required lexical format.
Date Picker
The Date Picker is a graphical calendar used to enter dates in a standard format into the XML
document. Having a standard format is important for the processing of data in the document.
The Date Picker icon appears near the date field it modifies (see screenshot).
To display the Date Picker (see screenshot), click the Date Picker icon.
To select a date, click on the desired date, month, or year. The date is entered in the XML
document, and the date in the display is modified accordingly. You can also enter a time zone if
this is required.
Text Entry
For date fields that do not have a Date Picker (see screenshot), you can edit the date directly by
typing in the new value.
Please note: When editing a date, you must not change its format.
If you edit a date and change it such that it is out of the valid range for dates, the date turns red
to alert you to the error. If you place the mouse cursor over the invalid date, an error message
appears (see screenshot).
If you try to change the format of the date, the date turns red to alert you to the error (see
screenshot).
An entity is useful if you will be using a text string, XML fragment, or some other external
resource in multiple locations in your document. You define the entity, which is basically a short
name that stands in for the required data, in the Define Entities dialog. After defining an entity
you can use it at multiple locations in your document. This helps you save time and greatly
enhances maintenance.
There are two broad types of entities you can use in your document: a parsed entity, which is
XML data (either a text string or a fragment of an XML document), or an unparsed entity,
which is non-XML data such as a binary file (usually a graphic, sound, or multimedia object).
Each entity has a name and a value. In the case of parsed entities the entity is a placeholder for
the XML data. The value of the entity is either the XML data itself or a URI that points to a .xml
file that contains the XML data. In the case of unparsed entities, the value of the entity is a URI
that points to the non-XML data file.
To define an entity:
1. Click Authentic | Define XML Entities.... This opens the Define Entities dialog (
screenshot below).
2. Enter the name of your entity in the Name field. This is the name that will appear in the
Entities Entry Helper.
3. Enter the type of entity from the drop-down list in the Type field. The following types are
possible: An Internal entity is one for which the text to be used is stored in the XML
document itself. Selecting PUBLIC or SYSTEM specifies that the resource is located
outside the XML file, and will be located with the use of a public identifier or a system
identifier, respectively. A system identifier is a URI that gives the location of the
resource. A public identifier is a location-independent identifier, which enables some
processors to identify the resource. If you specify both a public and system identifier,
the public identifier resolves to the system identifier, and the system identifier is used.
4. If you have selected PUBLIC as the Type, enter the public identifier of your resource in
the PUBLIC field. If you have selected Internal or SYSTEM as your Type, the PUBLIC
field is disabled.
5. In the Value/Path field, you can enter any one of the following:
If the entity type is Internal, enter the text string you want as the value of your entity.
Do not enter quotes to delimit the entry. Any quotes that you enter will be treated as
part of the text string.
If the entity type is SYSTEM, enter the URI of the resource or select a resource on
your local network by using the Browse button. If the resource contains parsed data,
it must be an XML file (i.e., it must have a .xml extension). Alternatively, the
resource can be a binary file, such as a GIF file.
If the entity type is PUBLIC, you must additionally enter a system identifier in this field.
6. The NDATA entry tells the processor that this entity is not to be parsed but to be sent to
the appropriate processor. The NDATA field should therefore be used with unparsed
entities only.
Dialog features
You can do the following in the Define Entities dialog:
Append entities
Insert entities
Delete entities
Sort entities by the alphabetical value of any column by clicking the column header;
clicking once sorts in ascending order, twice in descending order.
Resize the dialog box and the width of columns.
Locking. Once an entity is used in the XML document, it is locked and cannot be edited
in the Define Entities dialog. Locked entities are indicated by a lock symbol in the first
column. Locking an entity ensures that the XML document valid with respect to entities.
(The document would be invalid if an entity is referenced but not defined.)
Duplicate entities are flagged.
Limitations of entities
An entity contained within another entity is not resolved, either in the dialog, Authentic
View, or XSLT output, and the ampersand character of such an entity is displayed in its
escaped form, i.e. &.
External entities are not resolved in Authentic View, except in the case where an entity
is an image file and it is entered as the value of an attribute of type ENTITY or
ENTITIES. Such entities are resolved when the document is processed with an XSLT
generated from the SPS.
Authentic View is based on Internet Explorer, and is able to display most of the image formats
that your version of Internet Explorer can display. The following commonly used image formats
are supported:
GIF
JPG
PNG
BMP
WMF (Microsoft Windows Metafile)
EMF (Enhanced Metafile)
SVG (for PDF output only)
Relative paths
Relative paths are resolved relative to the SPS file.
Please note: The Return key does not insert a carriage return/line feed, i.e. it does not jump to
a new line. This is the case even when the cursor is inside a text node, such as paragraph.
A complete listing of support for this feature in Altova products is given in the table below. Note,
however, that in the trusted version of Authentic Browser plug-in, internal scripting is turned off
because of security concerns.
* No AuthenticView
** Both Trusted and Untrusted versions
*** Scripted designs displayed. No internal macro execution or event handling. External
events fired.
Authentic Scripts behave in the same way in all Altova products, so no product-specific code or
settings are required.
All the scripting that is required for making Authentic documents interactive is done within the
StyleVision GUI (Enterprise and Professional editions). Forms, macros and event handlers are
created within the Scripting Editor interface of StyleVision and these scripts are saved with the
SPS. Then, in the Design View of StyleVision, the saved scripts are assigned to design
elements, toolbar buttons, and context menus. When an XML document based on the SPS is
opened in an Altova product that supports Authentic Scripting (see table above), the document
will have the additional flexibility and interactivity that has been created for it.
The intelligent editing features of each type of document is described separately in the sub-
sections of this section: HTML, CSS, and JSON.
9.1 HTML
HTML documents can be edited in Text View, and the edited page can then be viewed
immediately in Browser View. Text View provides a number of useful HTML editing features.
These are described in detail in Text View, but the main features, as well as HTML-specific
options, are listed below.
Entry helpers
Elements, Attributes and Entities entry helpers are available when an HTML document is active.
The entry helpers are context-sensitive; the items displayed in the entry helpers are those
available at the current cursor location. Use the HTML entry helpers as described in Text View.
Auto-completion
As you type markup text into your HTML document, XMLSpy provides Auto-completion help. A
pop-up containing a list of all nodes available at the cursor insertion point is displayed. As you
type, the selection jumps to the first closest match in the list (see screenshot below). Click the
selected item to insert it at the cursor insertion point.
Auto-completion for elements appears when the left bracket of node tags is entered. When the
start tag of an element node is entered in the document, the end tag is automatically inserted as
well. This ensures well-formedness.
Auto-completion for attributes appears when a space is entered after the element name in a
start tag. When you click an attribute name in the Auto-completion pop-up, the attribute is
entered with quotes characters and the cursor positioned between the quotes.
The Entities entry helper contains character entities from the HTML 4.0 entity sets, Latin-1,
special characters, and symbols.
Assigning a DTD
For XHTML documents, a DTD or XML Schema can be assigned via the DTD/Schema menu,
which enables you to browse for the required DTD or XML Schema file. An XHTML document
can be edited exactly like an XML document.
9.2 CSS
CSS documents can be edited using Text View's intelligent editing features. These features, as
they apply to the editing of CSS documents, are listed below.
Syntax coloring: A CSS rule consists of a selector, one or more properties, and the values of
those properties. These three components may be further sub-divided into more specific
categories; for example, a selector may be a class, pseudo-class, ID, element, or attribute.
Additionally, a CSS document can contain other items than rules: for example, comments. In
Text View, each such category of items can be displayed in a different color (screenshot below)
according to settings you make in the Options dialog (see below).
You can set the colors of the various CSS components in the Text Fonts tab of the Options
dialog (screenshot below). In the combo box at top left, select CSS, and then select the required
color (in the Styles pane) for each CSS item.
Folding margins: Each rule can be collapsed and expanded by clicking, respectively, the
minus and plus icons to the left of the rule (see screenshot above). Note also that the pair of
curly braces that delimit a rule (screenshot above) turns bold when the cursor is placed either
before or after one of the curly braces. This indicates clearly where the definition of a particular
rule starts and ends.
CSS outline: The CSS Outline entry helper (screenshots below) provides an outline of the
document in terms of its selectors. Clicking a selector in the CSS Outline highlights it in the
document. In the screenshot at left below, the selectors are unsorted and are listed in the order
in which they appear in the document. In the screenshot at right, the Alphabetical Sorting
feature has been toggled on (using the toolbar icon), and the selectors are sorted alphabetically.
You should note the following points: (i) For evaluating the alphabetical order of selectors, all
parts of the selector are considered, including the period, hash, and colon characters; (ii) If the
CSS document contains several selectors grouped together to define a single rule (e.g. h4,
h5, h6 {...}), then each selector in the group is listed separately.
The icons in the toolbar of the CSS Outline entry helper, from left to right, do the following:
Synchronizes the entry helper with the current state of the document.
Toggles alphabetical sorting on and off. When off, the selectors are listed in
the order in which they appear in the document. When sorted alphabetically,
ID selectors appear first because they are prefaced by a hash (e.g. #intro).
Properties entry helper: The Properties entry helper (screenshot below) provides a list of all
CSS properties, arranged alphabetically. A property can be inserted at the cursor insertion point
by double-clicking the property.
Auto-completion of properties and tooltips for properties: As you start to type the name of
a property, XMLSpy prompts you with a list of properties that begin with the letters you have
typed (screenshot below). Alternatively, you can place the cursor anywhere inside a property
name and then press Ctrl+Space to pop up the list of CSS properties.
You can view a tooltip containing the definition of a property and its possible values by scrolling
down the list or navigating the list with the Up and Down keys of your keyboard. The tooltip for
the highlighted property is displayed. To insert a property, either press Enter when it is selected,
or click it.
9.3 JSON
Altova website: JSON Editor
JSON documents can be edited using Grid View and the intelligent editing features of Text
View.
Grid View provides a number of editing features that are very useful for editing large
files; these features are described in the Grid View section.
The Text View features, as they apply to the editing of JSON documents, are listed
below.
Note: XMLSpy also provides conversion between JSON and XML in both directions. Clicking
the Convert from/to JSON command in XMLSpy converts the active document to the
other format.
Folding margins: Each JSON element can be collapsed and expanded by clicking,
respectively, the minus and plus icons to the left of the rule (see screenshot below). Note also
that line-numbering is enabled.
Structural marking: The pair of curly braces or square brackets that delimit a JSON element (
screenshot below) turns bold when the cursor is placed either before or after one of the braces
or brackets. This indicates where the definition of a particular element starts and ends.
Syntax coloring: A JSON document is made up of object strings, value strings, operators,
numbers and keywords. In Text View, each category of items can be displayed in a different
color (screenshot above) according to settings you make in the Options dialog (screenshot
below). You can set the colors of the various JSON components in the Text Fonts tab of the
Options dialog (screenshot below). In the combo box at top left, select JSON, and then select
the required color (in the Styles pane) for each JSON item.
Syntax checking: The syntax of a JSON document can be checked by selecting the
command XML | Check Well-Formedness (F7). The results of te well-formed check are
displayed in the Messages window (screenshot below).
The error message in the screenshot above points out an error in the document: Two double
quotes (a closing quote followed by an opening quote) occur consecutively; syntactically a
comma or a closing curly brace is required between the two quotes.
WSDL
A WSDL document is an XML document that describes a web service. XMLSpy supports
WSDL 1.1 and WSDL 2.0. You can create and edit both WSDL 1.1 and WSDL 2.0 documents
in XMLSpy's WSDL View, which automatically provides the correct editing environment for
whichever WSDL version is being edited.
In XMLSpy's WSDL View a WSDL document can be constructed using graphical building
blocks, thus greatly simplifying their creation. WSDL View is described in the section, Editing
Views. For a hands-on description of creating a WSDL document, see the WSDL Tutorial in this
documentation. You can also view and edit WSDL documents in Text View and Grid View. In
these two views, WSDL documents are edited as straightforward XML documents.
SOAP
SOAP is an XML messaging specification, and it is used to transmit messages between
applications. In XMLSpy, not only can you create and edit a SOAP document in Text View and
Grid View with XMLSpy's intelligent editing features for XML documents, but you can generate a
SOAP request file from a WSDL file. How to generate a SOAP request from a a WSDL file is
described in the WSDL Tutorial. XMLSpy is able to also send and receive SOAP requests
(using commands in the SOAP menu). Additionally, you can debug SOAP requests with
XMLSpy's SOAP Debugger, which is described in a sub-section of this section.
You can do all this in the graphical WSDL View and do not have to use the Text View. You can
directly manipulate the WSDL components using drag and drop, as well as enter values of
properties in the Entry Helpers of the WSDL View.
Note: In the skeleton starter document, WSDL elements are in the target namespace while
references to WSDL elements are made using the tns prefix. For example:
<wsdl:binding name="NewBinding" type="tns:NewPortType">. In order for the
tns prefix to match the target namespace, its namespace value should be identical with
the target namespace.
Inserting an operation
In the case of MyPortType, an operation, NewOperation, is already present, so we will work
with this. Start by renaming NewOperation to, say, EchoString (double-click its name, edit, and
press Return). (To insert additional operations for a PortType, right-click the PortType box,
select Append Operation, and then click the required type of operation.)
Empty operation
For each type, input and output messages are added automatically according to the operation
type. When Empty operation is selected, right-clicking the operation allows you to select a
message type to insert. A message can be deleted by right-clicking and selecting Delete input/
output/fault element. In the case of the EchoString operation, rename the input and output
messages to EchoStringRequest and EchoStringResponse, respectively.
To edit a parameter do one of the following: (i) double-click the text to edit it; or (ii) right-click the
parameter and select Edit, or (iii) use the Detail entry helper (see screenshot above).
To associate a PortType with a binding, in the new Binding box click the Down arrow of the
PortType entry (see screenshot above). This pops up a list of PortTypes defined in the
document. Select the PortType with which you wish to associate the binding. When a PortType
has been associated with the binding, the association is indicated by a line joining the box of the
the selected PortType to the Binding box, like this:
The soapAction for each operation in the binding can be defined in the design (see screenshot
above) or in the Detail entry helper when that operation is selected.
In the Overview entry helper, double-click the NewPort entry, change it to MyPort., and press
Return. Notice that the name of the port also changes in the MyService box in the design (
screenshot above). To add additional ports, right-click either the service or the port, and, from
the context menu, select Insert Port.
Note: If a binding is already associated with a port and you wish to associate another binding,
you have to remove the binding reference (using the port's right-click menu), and then
insert the new binding reference.
Detailed information about any error detected is displayed, enabling you to quickly locate the
error and fix it.
2. Click OK to load the WSDL file. The WSDL file is displayed in Text View.
3. Select the menu option File | Save As, and save the file locally, naming it, say,
timeservice.wsdl.
4. Click the WSDL View tab to display the file in the graphical WSDL editor.
Viewing the schema file associated with the active WSDL file
With the timeservice.wsdl file as the active document in WSDL View, select the menu
option WSDL | Types | Edit Schema(s) in Schema View. This opens the schema file that
defines all the datatypes used in the timeservice.wsdl file. You can modify the schema and
save changes. These changes will take effect as soon as the WSDL file is re-parsed.
5. In the dialog box that then pops up (screenshot below), select a SOAP operation, for
example, getServerTime, and click OK.
Note: In order to generate documentation in MS Word format, you must have MS Word
(version 2000 or later) installed.
6. Click OK and enter the name of the WSDL documentation file in the Save as dialog
box.
1. Make the file TimeService.wsdl the active file. (This file is in the WSDL Editor folder
in the Examples project of XMLSpy.)
2. Click the command WSDL | Convert to WSDL 2.0.
3. In the Save As dialog that appears, enter the name with which you wish to save the
WSDL 2.0 file, for example, TimeService20.wsdl..
4. The new file is generated, automatically validated, and displayed in WSDL View.
10.2 SOAP
Altova website: SOAP Debugger
When developing an application that accesses data from a web service and does further data
processing, something might happen that you don't expect. This chapter explains how to see
and edit the data that is actually transmitted. This is done using the SOAP debugger. It works as
a proxy server between your client and the web service. The debugger functionality goes a lot
deeper than a normal trace utility that only stores every call's Request and Response.
SOAP debugger allows you to set breakpoints for every Request and Response message and
even define Conditional breakpoints via XPath expressions.
On pressing F8 (or the menu command XML | Validate) the SOAP message will be validated
not only against the rules for SOAP messages but also against the rules in the linked WSDL
file.
The file is found to be valid if it is valid according to both sets of rules (see screenshot above).
The webservice server responds to the proxy request, and sends the response data
back to the proxy server
4. Server responses can be modified if/when breakpoints have been triggered
5. Proxy server response data is forwarded to the client application
Port settings
The SOAP debugger uses the 8080 port to monitor the clients' requests. The port can only be
altered when a new SOAP debugging session is started.
Please note: This port may be disabled by personal firewalls, or advertising filters. You would
therefore have to disable these programs, or select a different port address.
1. Start XMLSpy.
2. Select the menu option Project | Open Project.
3. Select the Examples.spp file in the C:\Documents and Settings\<username>\My
Documents\Altova\XMLSpy2011\Examples folder.
4. Click the + sign of the SOAP Debugger folder to see the folder contents.
5. Double-click the DebuggerClient.htm file to start the SOAP Client and connect to the
web service.
The Browser View displays the current Eastern Standard Time (7:09 in this example).
6. Click the GMT radio button to see the current Greenwich Mean Time.
An error has obviously occurred at this point. We should have a correct time in the
clock display. We will have to activate the SOAP debugger to analyze the SOAP
messages, and see if we can locate the error and perhaps fix it.
This allows more room for the SOAP request and response windows. Make sure you
define these settings before you start the SOAP debugger session.
2. Enter the WSDL file location (shown below into the text box
http://www.nanonull.com/TimeService/TimeService.asmx?WSDL and click OK.
The following dialog box displays the source and target port settings. The source port
setting (8080) is a default setting and is automatically entered. This setting can be
changed every time the debugger is started. The target settings are supplied by the
WSDL file, and also appear automatically. If the port number of the target ends with
443, the Secure Connection (via https) check box will be checked by default. If any
other port number is entered, then you must check the Secure Connection check box
manually. Click the HTTPS Settings button to select the secure connection options
(see the section Change SOAP Request Parameters for details about using these
options).
3. Click OK to start the SOAP debugger session. This opens the SOAP debugger proxy
server in its inactive state. You can see this by noting that the proxy server icon is
disabled. If you are using the https protocol, you might wish to allow a host name
mismatch or an expired server certificate. To make these settings, click the HTTPS
Settings button. The HTTPS Settings dialog (screenshot below) appears.
4. In the HTTPS Settings dialog, you can allow that the host name given in the SOAP
request need not match the host name in the server certificate; do this by checking the
Allow host name mismatch check box. If you wish to allow the connection despite an
expired server certificate, then check the Allow expired server certificate check box.
Confirm the changes with OK.
2. Click the GO icon (or use the menu command SOAP | GO).
3. Click the DebuggerClient tab to switch to the Client. You may have to select Window |
DebuggerClient.htm to see the contents.
This displays a "Debugging is on" message, and sends the SOAP request to the
debugger.
Looking at the timezone element, we notice that the value is GMD. This cannot be
correct, so we will change it to GMT and see what happens.
2. Click the GO icon (or use the menu command SOAP | GO) to send the corrected
request to the web service.
After a few seconds, the web service response to the SOAP request appears in the
SOAP response window. Select View | Word wrap to see the contents as displayed in
the diagram below.
We did not receive an error message in the response, so we can assume that this is
the correct time.
3. Click the debugger GO icon to send this response to the client (the Browser
window in this case).
4. Click the DebuggerClient.htm tab to switch back to the client, and see the new result.
The error message has disappeared, and the correct GMT time is displayed.
5. Select the menu option SOAP | SOAP debugger session to close the debugger
session.
2. Change the value from "GMD" to "GMT" and switch back to the Browser View.
The SOAP Client now works correctly, the "Unknown Time zone" message has gone
and the correct time appears in the window.
Function-Breakpoints tab
The Function-Breakpoints tab allows you to set a breakpoint on Requests and/or Responses to
SOAP methods. The debugger highlights the line of the function which triggered the breakpoint.
Data packets to and from the client are analyzed and matched to the corresponding functions
from the WSDL file. If a breakpoint is set for a specific method, then this is where the SOAP
debugger stops. The toolbar buttons are enabled at this point.
The data is displayed in the Soap Request or Soap Response document window. The SOAP
documents displayed in the SOAP windows can be modified at this point. The data is sent the
moment you click one of the toolbar icons (except for the Stop Server icon).
Conditional-Breakpoints
The Conditional-Breakpoints tab (screenshot below) allows you to use XPath expressions to
define breakpoints. If a SOAP request causes an error, the SOAP response must contain a
2. Enter the XPath expression (for example, .//faultcode) in the XPath field.
3. Select the required XPath version (1.0 or 2.0) and the Break when XPath nodes found
radio button.
4. Click OK to confirm the settings. The SOAP debugger will stop whenever a
.//faultcode element appears in a SOAP request or response.
For the condition defined in the dialog displayed above, the following conditional breakpoint will
be listed in the Conditional-Breakpoints tab.
To edit a conditional breakpoint, double-click its line in the tab or click the Change button (see
screenshot above). To delete a conditional breakpoint, select the line you want to delete and
click Delete.
11 XBRL
Altova website: XBRL Taxonomy Editor, XBRL Validator
XMLSpy's XBRL View is an XBRL taxonomy editor that provides a graphical overview of XBRL
taxonomies and intelligent taxonomy editing features. In this section we describe how to create
and edit taxonomies in XBRL View.
For more related information, see the sections: Editing Views | XBRL View and the description
of commands in the XBRL menu. For example, information about generating documentation for
the taxonomy (as seen in XBRL View) will be found in the section User Reference | XBRL Menu
| Generate Documentation.
Both kinds of taxonomies can be viewed and edited in XBRL View. In some cases, such as
when a standard taxonomy is imported into a taxonomy you are creating (in order to extend the
imported taxonomy), you will not be allowed to edit the imported taxonomy. Elements from
imported taxonomies that are not allowed to be edited are displayed in gray.
In the description above, we have used the term taxonomy to denote the entire taxonomy, which
comprises several files: the concept definitions files and the relationship files. (See the section
Taxonomy Document Files for a description of the various files that comprise a taxonomy.)
The taxonomy you will be creating leads, with additional work, to the taxonomy supplied with
XMLSpy (Nanonull.xsd) and which is located in the folder C:\Documents and Settings
\<username>\My Documents\Altova\XMLSpy2011\Examples\XBRLExamples\Nanonull.
(Note that the main taxonomy file always has the extension .xsd. The file extension .xbrl is
used for XBRL instance files and not for taxonomy files.)
The locations of the relationship files are specified in the concept definitions file (the .xsd file)
inside a /schema/annotation/appinfo element:
<xsd:annotation>
<xsd:appinfo>
<link:linkbaseRef xlink:arcrole="
http://www.w3.org/1999/xlink/properties/linkbase"
xlink:href="NanonullLabels.xml" xlink:type="simple"
xlink:role="http://www.xbrl.org/2003/role/labelLinkbaseRef" />
<link:linkbaseRef xlink:arcrole="
http://www.w3.org/1999/xlink/properties/linkbase"
xlink:href="NanonullDefinitions.xml" xlink:type="simple"
xlink:role="http://www.xbrl.org/2003/role/definitionLinkbaseRef" />
<link:linkbaseRef xlink:arcrole="
http://www.w3.org/1999/xlink/properties/linkbase"
xlink:href="NanonullPresentations.xml" xlink:type="simple"
xlink:role="http://www.xbrl.org/2003/role/presentationLinkbaseRef" />
<link:linkbaseRef xlink:arcrole="
http://www.w3.org/1999/xlink/properties/linkbase"
xlink:href="NanonullCalculations.xml" xlink:type="simple"
xlink:role="http://www.xbrl.org/2003/role/calculationLinkbaseRef" />
<link:linkbaseRef xlink:arcrole="
http://www.w3.org/1999/xlink/properties/linkbase"
xlink:href="NanonullReferences.xml" xlink:type="simple"
xlink:role="http://www.xbrl.org/2003/role/referenceLinkbaseRef" />
</xsd:appinfo>
</xsd:annotation>
When the concept definitions file (the .xsd file) is open in XBRL View, the various taxonomy
files are displayed in a tree structure in the Overview entry helper (screenshot below).
In the screenshot above, notice the icons to the left of the file names. XML Schema (.xsd) files
are indicated with an XSD icon. The relationship files have a colored file icon with a character
corresponding to the initial character of the relationship kind. For example, a icon indicates a
Definition relationships file, a icon indicates a Presentation relationships file, and so on.
Double-clicking any of these files opens it in XMLSpy, where it can be edited in Grid View (
screenshot below) or Text View.
The first step in creating a new taxonomy is to create its concept definitions file, which is an
XML Schema (.xsd) file. Besides containing concept definitions, this file defines and declares
the namespace of the new taxonomy, locates taxonomies to be imported, locates the
relationships files of the taxonomy, and declares the namespace of imported taxonomies and
other namespaces used.
Select xsd: XBRL Taxonomy Schema and then click OK. This pops up the first screen of the
New Taxonomy Wizard (screenshot below).
The New Taxonomy Wizard helps you create XBRL taxonomies that are conformant with US-
GAAP and IFRS requirements. Essentially it imports the taxonomies you specify. Subsequently,
the file can be edited as required.
The taxonomy namespace (target namespace of the main taxonomy concepts file,
which is a .xsd file) and the names of the concept definitions file (Schema File) and the
of relationship files are generated automatically from: (i) the ticker symbol (or company
name) and (ii) the date. If you try to edit any of these, you will receive a warning to the
effect that changing the values in these fields would lead to non-conformance with the
rules of the relevant taxonomy.
After you have finished, click Next. The dialog that is displayed next depends on what you
selected as the base for your taxonomy. There are three possibilities:
If you selected US-GAAP, then the US-GAAP-specific second screen of the New
Taxonomy Wizard appears (screenshot below). You can now select the entry points
you wish to include in the taxonomy, as well as specify whether the US-GAAP Core
Schema should be imported (check box at the bottom of the dialog).
When you click Finish, a new concept definitions (.xsd) file that imports the selected
entry-point schemas is created in the destination folder you specified in the wizard. The
taxonomy opens in XBRL View and is ready to be edited.
If you selected IFRS as the base for your taxonomy, the IFRS-specific second screen of
the New Taxonomy Wizard appears (screenshot below). Click the link in the dialog to
go to the IFRS website, where you can generate a ZIP file containing your customized
entry-point schema. Download the ZIP file and unpack it to a local folder. Browse for the
entry-point schema in the local folder, select it, and then click Finish in the wizard.
When you click Finish, a new concept definitions (.xsd) file that imports the selected
entry-point schemas is created in the destination folder you specified in the wizard. The
taxonomy opens in XBRL View and is ready to be edited.
If you selected None (that is, no base taxonomy), a new concept definitions (.xsd) file is
created in the destination folder you specified in the wizard and opens in XBRL View.
Notice that two elements (xbrldt:hypercube and xbrldt:dimension) are
automatically created and that the basic schemas required for every taxonomy have
been imported automatically (see Overview entry helper).
After you have created your base taxonomy, the next steps are: (i) to create a namespace for
the taxonomy (the target namespace of the schema); and (ii) to import the taxonomy or
taxonomies on which the new taxonomy is to be built. If you have used the New Taxonomy
Wizard, a default taxonomy namespace will have been created and the relevant taxonomies will
have been imported.
In the next step we will modify the target namespace of the taxonomy that was automatically
The Namespace Prefixes dialog lists all the namespaces in the taxonomy.
To add or delete a namespace, use the Add or Delete buttons, respectively. After
adding a namespace, edit the default prefix and default URI by double-clicking in the
respective field and entering the changes.
A color can be assigned to a namespace via the color palette for that namespace. If a
color has been assigned to a namespace, all components in that namespace will be
displayed with this color as its background in the Main Window and entry helpers of
XBRL View. Note that a color setting for a given namespace applies for that
namespace across all taxonomy documents opened in XBRL View.
When you have finished editing in the Namespaces dialog, click OK to make your editing
changes take effect.
In addition to defining the target namespace (specifying it, that is), the target namespace must
also be declared on the xs:schema element so that it is in scope for the entire length of the
document. The listing below declares the namespace that is the target namespace.
In the listing above, the namespace is declared on the xs:schema element and is given a prefix
of ns1.
To modify only the declaration of the target namespace (but not its definition) or the declaration
of any namespace, edit the prefix and value of the namespace in the Namespace Prefixes
dialog (XBRL | Namespace Prefixes command).
In the next step we will take a closer look at the import mechanism of XBRL View.
To import a taxonomy, do the following: Right-click in the Overview entry helper in XBRL View
and select the menu command Import/Reference. This pops up the Reference Schema dialog
(screenshot below), in which you can specify a taxonomy to import or a linkbase to reference.
There are three import/reference options: (i) a standard taxonomy (US-GAAP or IFRS); (ii) any
other taxonomy (reference schema); and (iii) a linkbase. If you are importing a non-standard
taxonomy, select the Reference Schema radio button, click the Browse button of the Schema
Location text box, and browse for the taxonomy you want. When you are done, click Finish.
The selected taxonomy will be imported and its elements and relationships will be displayed in
XBRL View.
You can delete an imported taxonomy by right-clicking it in the Overview entry helper
and selecting Remove.
After you have imported a taxonomy, you can extend the taxonomy as required.
Note: If you find that a large taxonomy such as US-GAAP slows down your editing, use the
filter in the main window to limit the display to elements created in the new, extending
taxonomy. This will speed up editing considerably.
Import mechanism
The effect of adding a standard import as described above is to add an xs:import element to
the new taxonomy file. The xs:import element specifies the namespace and location of the
taxonomy to be imported (listing below).
<xs:import namespace="http://xbrl.us/us-gaap-all/2008-03-31"
schemaLocation="
http://xbrl.us/us-gaap/1.0/elts/us-gaap-all-2008-03-31.xsd"/>
In the listing above, the schemaLocation attribute specifies that the taxonomy is to be loaded
via the Internet. But this URI maps, via XMLSpy's catalog mechanism, to a local copy of the US-
GAAP taxonomy (that is delivered with your XMLSpy package).
To locate a locally saved taxonomy, a local address can be used directly to locate the
taxonomy. Alternatively, a web address can be used which is mapped to a local address via a
catalog file. Accessing taxonomies from local locations will greatly speed up your work.
In the next step, we will take a closer look at linkbase files and the referencing mechanism.
In the section, Importing a Taxonomy, you have seen how a taxonomy can be imported via the
Overview entry helper. The imported taxonomy is listed among the imported schemas in the
Overview entry helper.
In this section, we show how the Overview entry helper can be used to manage linkbase files.
The four operations for managing linkbases are all accessed via the Overview entry helper's
context menu. They are:
Adding new linkbases and saving them with the taxonomy.
Setting the linkbase kind. In cases where the linkbase type (calculation, definition,
presentation, label, or reference) is not know to XMLSpy, the linkbase type can be
explicitly specified.
Setting a linkbase as the default linkbase for a particular type of relationship linkbase. If
there is more than one linkbase for a particular type of relationship, say, label
relationships, then new labels that you create in the Taxonomy Editor will be created in
the default label linkbase.
Deleting linkbases.
Note: There are five types of relationships: (i) definition, (ii) calculation, (iii) presentation, (iv)
label, and (v) reference. Separate linkbase files can be created for each of these
relationship types.
entry helper with a default name. Note that the new linkbase is created as the default
linkbase of its relationship type (indicated by the filename being in boldface).
2. Right-click the default name, select Rename, and edit the name.
3. A newly created linkbase file is physically saved at a particular location only when the
main taxonomy file is saved the next time. See below for details.
Deleting a linkbase
A linkbase can be removed from the taxonomy by right-clicking it and selecting Remove.
In order to test some of the commands introduced in this section, do the following: Create a
linkbase file by using the Add New Linkbase command and creating any linkbase kind you like.
Rename it as described above. Notice that it is now the default linkbase of its relationship type
(indicated by its name being displayed in bold). Select it and set it to be some other relationship
type (using the Set Linkbase Kind command). Notice that the file is not the default linkbase of
its new relationship type. Now delete the linkbase (using the Remove command). Since one of
the original linkbase files is now no longer a default linkbase, set it as the default linkbase of its
relationship type.
In the next step, we will add new elements to the main taxonomy file (or concept definitions file).
The new element with a substitution group of xbrli:item and with a default name is added to
the list of elements in the display (screenshot below).
For a description of the element box, see Main Window: Elements Tab. You can now edit the
properties of the element in the main window in the following ways.
The name of the element can be changed by double-clicking the default name and
entering the correct name. Note that you must also enter the correct namespace prefix
for the name.
The substitution group of the element can be changed by expanding the element box—
click the plus icon to do this—and then selecting the required substitution group from
this field's dropdown list (screenshot below).
To change the Balance, Period, Abstract, or Nillable property, click the corresponding
icon to the left of the element name and select one of the options from the box that
pops up.
To add a label linkrole for the element, right-click anywhere in the element box and
select the Add Label Linkrole command. A row for the label linkrole is added; in this
row you can enter the label linkrole or select an option from the combo box. Note that if
no label linkbase file is associated with the taxonomy, one will be created now and will
be displayed in the Overview entry helper.
A label can be added for a label linkrole by right-clicking the label linkrole and selecting
the Add Label command. To enter the details of the label, either double-click in the
field to be edited and enter the new value, or select the new value from the respective
combo boxes. The changes you make to labels will be saved to the label linkbase when
the main taxonomy file is saved.
References are added to the reference linkbase in the same way that labels are added
to the label linkbase. First, a reference linkrole is added for the element, then a
reference is added for a specific reference linkrole.
Element properties can also be edited in the Details entry helper. See Entry Helpers in XBRL
View for a description of how to do this.
The first element we will create is the item nanonull:OnboardAndOther, which represents
revenues from the sale of items on board Nanonull's cruise ships. This specific revenue head is
not available in the US-GAAP taxonomy, which is why it must now be created as an extension
of US-GAAP. As a new element created specially for the Nanonull taxonomy, it must be created
in the Nanonull namespace (http://www.altova.com/nanonull), which has been declared
with a prefix of nanonull. Creating the element with this prefix will put this element in the
Nanonull namespace.
1. Click the Add New Element icon in the Main Window (screenshot below).
A new element with a substitution group of xbrli:item and with a default name is
added to the list of elements in the display (screenshot below).
4. Now click to the left of the clock icon and, from the popup that appears, select credit (
screenshot below).
Another cost to be included is for commissions to agents. This should be taken care of with a
debit element called nanonull:CruiseCommissionsTransportationAndOther. Create this
element exactly as you did nanonull:CostOfOnboardAndOther.
Finally, we add three abstract elements, Asia, Europe, and US, so that concepts can be
grouped by region. Since the elements are used only for grouping purposes and will not
themselves have values, they are known as abstract elements. What type such an element has
is therefore immaterial. It is best to give an abstract element a type that matches its semantics.
For example, we have given the abstract elements Asia, Europe, and US, a type of
stringItemType. Create the nanonull:Asia, nanonull:Europe, and nanonull:USA elements
just as you created the previous elements. The only difference this time will be that the value of
the Abstract attribute must be set to Abstract (actual attribute value in the XSD file will be true)
and there will be no xbrli:balance attribute.
In the next step we will specify linkroles for the new taxonomy. These linkroles will be needed
when we create new relationships.
<link:definitionLink xlink:type="extended"
xlink:role="
http://www.nanonull.com/taxonomy/role/SegmentRevenueAndOperatingIncome">
The value of the xlink:role attribute in the definition link (as in the definition link listed above)
must be the value of the roleURI attribute of one of the linkroles set to be used on definition
relationships (see listing below). A linkrole (as in the listing below) is contained in the appinfo
element of the taxonomy.
<xs:appinfo>
<link:roleType id="SegmentRevenueAndOperatingIncome"
roleURI="
http://www.nanonull.com/taxonomy/role/SegmentRevenueAndOperatingIncome">
<link:definition>006091 - Disclosure - Segment Revenue and Operating
Income</link:definition>
<link:usedOn>link:calculationLink</link:usedOn>
<link:usedOn>link:definitionLink</link:usedOn>
<link:usedOn>link:presentationLink</link:usedOn>
</link:roleType>
</xs:appinfo>
A linkrole can be used in the containing elements of other relationship kinds besides in
definitionLink elements (for example, in calculationLink and presentationLink
elements). In the listing above, notice that there are usedOn elements that specify in which kind
of relationships this linkrole may be used.
To create linkroles in a concept definitions file (main taxonomy file), in XBRL View, click the
menu command XBRL | Linkroles. This pops up the Link Roles dialog (screenshot below).
In the Taxonomies tab, select the taxonomy and click Add to add a linkrole. Then specify the
linkrole's URI and ID (refer to listing above). Now specify for which kinds of relationships this
linkrole should be available; do this by checking the check boxes of the required relationship
kinds (see screenshot above).
In the next step we will create relationships for the new taxonomy.
While reading the description below, we recommend that you open a finished taxonomy in
XBRL View. You can find the Nanonull taxonomy (nanonull.xsd) in the folder C:\Documents
and Settings\<username>\My Documents\Altova\XMLSpy2011\Examples\XBRLExamples
\Nanonull.
If the required linkrole is not available, this is because it has not been defined either in the
taxonomy or for the current relationship kind. See Relationships and Linkroles for details about
linkroles and how to create them.
In the screenshot above the highlighted element is the inserted element reference. It has three
arcs, one to a hypercube element and two to item elements. These three elements are at the to
end of their respective arcs and the from-to relationship is defined by the corresponding
arcoles, which are displayed in the Arcrole column.
To insert an arc on an element reference or element, right-click the from element and select
Insert Arc from the context menu that pops up. This causes the Insert Arc dialog (screenshot
below) to appear. Select the element to be created at the to end of the arc. To filter the view in
this dialog, switch on the filter and specify a condition for the filter (see Entry Helpers in XBRL
View for a description of how to do this).
The element will be inserted with a default arcrole. You can change the arcrole by selecting an
alternative from the dropdown list of the arcrole (screenshot below).
Note: Elements, with arcs, can also be added by dragging them from the Global Elements
entry helper.
The screenshot above shows the elements to add with arcs. The screenshot below shows the
arcroles of the newly added elements.
You can compare the taxonomy you have created with that supplied with your XMLSpy
package. The supplied taxonomy (nanonull.xsd) is in the folder C:\Documents and
Settings\<username>\My Documents\Altova\XMLSpy2011\Examples\XBRLExamples
\Nanonull.
The weight attribute can also be modified in the Details entry helper (see below).
The following entries appear in context menus in the main window of the relationships tabs.
Insert element reference: Available on extended linkroles. Adds an element under the
linkrole that will always be at the from end of arcs.
Delete element reference: Available on element references immediately under a
linkrole.
Insert arc: Available on elements. Inserts an arc and pops up a dialog in which the
element to be at the to end of the arc can be selected.
Set target role: Sets a target role on the selected element.
Add label linkrole: Adds a label linkrole to the selected element.
Add reference linkrole: Adds a reference linkrole to the selected element.
Override arc: Replaces the (impicit) optional value of the use attribute of the arc with
the prohibited value, thus negating the arc.
Remove arc: Removes the selected arc.
Show in global elements: Highlights the selected element in the Global Elements entry
helper.
Attributes which cannot be edited in the graphical display in the main window—such as order
and priority—can be edited in the Details entry helper.
Selecting any of these access methods pops up the Find dialog (screenshot below).
Usage is as follows:
Enter the search term in the Find what text field of the Find dialog (screenshot above)
and check the required options
Specify the XBRL component types to be searched in the Types pane
Execute the command using the Find Next or Find All button
Use the Find in Schemas window to view the search results and navigate to a
component quickly
Note: A whole word is considered to be delimited by any character that is not alphanumeric or
the underscore character. So the search term asset will return the text xbrl:asset,
since the colon character (:) is considered to be a word delimiter.
Regular expressions
You can use regular expressions to further refine your search criteria. A pop-up list is available
to help you build regular expressions. To access this list, click the > button to the right of the
input field for the search term.
Clicking on the required expression description inserts the corresponding expression syntax
character in the input field. Given below is a list of regular expression syntax characters.
Find Next
The Find Next command displays, in the Find in XBRL window (screenshot below), the next
instance of the search term. The search for the next instance will start at the next cell from the
current cursor position in the active document. The Find Next process can be continued till all
instances in the document are displayed.
Find All
The Find All command displays all instances of the search term, together with a summary of
the search, in the Find in XBRL window (screenshot below).
The result provides: (i) a summary of the XBRL component types that were searched; (ii) a list
of the found instances of the search term, ordered according to linkbase; and (iii) statistics
about the search, including the matches found and the time taken for the search. Each linkbase
group can be expanded or collapsed to view the matches in that group. Clicking a match
highlights the corresponding element in the XBRL document in the Main Window.
For information about the features of the Find in XBRL window, see the section Results and
Information.
The internal structure and internal folder and file names of an OOXML file vary according to the
document type. However, there is a common basic structure: an XML file called
[Content_Types].xml at the root of the directory structure, and three directories: _rels,
docProps, and a directory specific to the document type (in the case of .docx documents, for
example, this folder would be called word; xl in .xlsx documents, and ppt in .pptx
documents).
OOXML File
|-- File: [Content_Types].xml
|-- Folder: _rels
|-- Folder: docProps
|-- Folder: word/xl/ppt
The _rels folder contains a rels.xml file, which specifies the relationships between
the various files in the package.
The docProps folder contains app.xml and core.xml, which describe key document
properties.
The word, xl, and ppt folders contain XML fies that hold the content of the document.
For example, in the word folder, the file document.xml contains the core content of the
document.
Folder View on the left-hand side shows the folders in the package, whereas the Main Window
shows the files in the folder selected in Folder View. In Archive View, files and folders can be
added to and deleted from the archive. Also, files can be opened quickly for editing in XMLSpy
by double-clicking the file in Archive View.
ZIP files
ZIP files archive multiple files in a lossless data compression package. These files can be of
various types. In XMLSpy's Archive View, ZIP files can be created, the internal structure
modified, and files in the archive edited. These operations are described in the ZIP Files sub-
section of this section.
An existing OOXML file is opened in Archive View via the Open dialog (File | Open) of XMLSpy.
OOXML files are saved with the File | Save (Ctrl+S) command. This command saves the
structure and relationships of the OOXML file.
An internal OOXML document—that is, a document within an OOXML file package—is opened
from Archive View by double-clicking it, or by selecting it in the Main Window and clicking the
Open document command button. The document opens in a separate XMLSpy window. After
editing it, simply save the document to save it back to the OOXML archive; there is no need to
save the OOXML file itself.
The XSLT and XQuery files are intended to demonstrate how XSLT and XQ can be used to
access and transform data in OOXML files. To run the XSLT and XQuery documents, you can
use any of the following options:
Open the OOXML file in Archive View. In Folder View, select Archive and then click
the menu command XSL/XQuery | XSL Transformation (for an XSLT transformation)
or XSL/XQuery | XQuery Execution (for an XQuery execution). Browse for the XSLT
or XQuery file and click OK.
In the Project Window of XMLSpy, right-click the .xlsx or .docx file in the Office2007
folder of the Examples project (screenshot below), and select the transformation
command. Browse for the transformation file and click OK.
Open the XSLT or XQuery file in XMLSpy and click the menu command XSL/XQuery |
XSL Transformation and XSL/XQuery | XQuery Execution, respectively. When
prompted for the XML file to transform, browse for the .docx, .xlsx , or .pptx file
(according to whether the XSLT/XQ document is intended for Word or Excel).
You can also run these operations using AltovaXML, which is a standalone package
containing the Altova XSLT and XQuery Engines.
An existing ZIP file is opened in Archive View via the Open dialog (File | Open) of XMLSpy.
Note: Creating a new ZIP file is different than creating a new OOXML file in that you are not
prompted for a location to save the file before the archive is opened in Archive View.
For the ZIP file to be saved from the empty archive that is opened in Archive View, you
must explicitly use the File | Save (Ctrl+S) command..
13 Databases
XMLSpy enables you to connect to a variety of databases (DBs) and then perform operations
such as querying the DB, importing the DB structure as an XML Schema, generating an XML
data file from the DB, and exporting data to a DB. Each DB-related feature is available in
XMLSpy as a menu command, and is described in the User Reference section of this
documentation under the respective command. A complete list of these command is given
below, with links to the respective descriptions.
Note: If you are using the 64-bit version of XMLSpy, ensure that you have access to the 64-bit
database drivers needed for the specific database you are connecting to.
Datatype conversions
When converting data between XML documents and DBs, datatypes must necessarily be
converted to types appropriate for the respective formats. The way XMLSpy converts datatypes
is given in the appendices Datatypes in DB-Generated XML Schemas and Datatypes in DBs
Generated from XML Schemas.
Altova DatabaseSpy
Altova's DatabaseSpy is a multi-database query and DB design tool that offers additional DB
functionality to that available in XMLSpy. For more details about Altova DatabaseSpy, visit the
Altova website.
Each option is described in the subsections of this section. The descriptions in this section
explain only the connection mechanism. The dialogs that appear subsequent to the connection
process are dependent on the specific command being executed, and these dialogs are
therefore described in the sections relating to that specific command. For example, if you are
looking for a description of the command Convert | Import Database Data, the description for
the connection process is in this section, but the selection of DB tables is described in the
section Convert | Import Database Data.
Note: If you are using the 64-bit version of XMLSpy, ensure that you have access to the 64-bit
database drivers needed for the specific database you are connecting to.
MS Access
Carry out the following steps to connect to an MS Access database. Select Microsoft Access
(ADO) (screenshot below), and click Next.
In the Connect to MS Access dialog that pops up, browse for the MS Access database, and
click Next. The connection to the data source is established. For information about subsequent
dialogs, refer to the description of the command being executed.
IBM DB2
In the first screen of the Connection Wizard (see first screenshot in this section), select IBM
DB2 and click Next. The Configuration dialog (screenshot below) pops up. The wizard will then
guide you in configuring the connection to the IBM DB2 database and making the connection.
These steps consist essentially of selecting the appropriate driver to connect to the DB, then
locating the DB, and entering user information that enables you to connect.
In the Configuration dialog above, select an existing data source, or create a new data source
with an appropriate driver (additional drivers can be added to the list of available drivers by
clicking the Edit Drivers button and selecting the required drivers). In the following screen you
will be prompted for user information (ID and password). Clicking OK will establish the
connection with the database. Also see ODBC Connections for more details. For information
about subsequent dialogs, refer to the description of the command being executed.
Select the required database and click Connect. The connection to the database is established.
For information about subsequent dialogs, refer to the description of the command being
executed.
1. In the Connect to Data Source dialog, select ADO Connections. The ADO Connections
box appears (screenshot below).
2. Click the Build button. The Data Link Properties dialog (screenshot below) opens.
3. Select Microsoft OLE DB Provider for ODBC Drivers from the list and click Next. The
Connection tab is activated. (For Microsoft SQL DBs, we recommend Microsoft OLE
DB Provider for SQL Server; for Oracle, MySQL, Sybase, and IBM DB2 DBs, Microsoft
OLE DB Provider for ODBC Drivers.)
4. Build a connection string via the Build button (the dialog which pops up prompts you for
a data source and user information). In the case of some databases (such as Microsoft
SQL Server), you do not build a connection string but instead select the server and
database from combo box listings.
5. If login information is required, enter a user name and password, and check the Allow
Saving Password check box.
6. Click OK. The Data Link Properties dialog closes. The connection string appears in the
ADO Connections box (screenshot below).
7. Click the Connect button. The connection to the data source is established. For
information about subsequent dialogs, refer to the description of the command being
executed.
Note: For an ADO connection to MS SQL Server via the driver SQL Server Native Client 10.0
the following property values must be set in the All tab of the Data Link Properties
dialog: (i) Set the property value of Integrated Security to a space character; (ii) Set the
property value of Persist Security Info to true.
2. Select one of the options for specifying a Data Source Name (DSN). If you select
System DSN or User DSN, the available DSNs are displayed in the Data Source pane.
If you select File DSN, you are prompted to browse for the DSN file. Alternatively, you
can build a connection string to the DB by selecting the Build a Connection String
option.
3. If you wish to add a DSN to those in the Data Source pane, click the Create a New DSN
icon .
4. In the Create an ODBC DSN dialog that appears, select the required driver, then click
the User DSN or System DSN button.
5. In the dialog that appears (screenshot below), select the DB alias and give it a DSN.
6. Click OK to finish. The DB is added as a Data Source to the list in the Data Source
pane.
7. After you have selected the DataSource (via the System DSN or User DSN option), or
selected a DSN File (File DSN option), or built a connection string (Connection String
option), click Connect.
8. When you are prompted for your user ID and password, enter these and then click OK.
9. You will be asked to choose between connecting to the the database either natively or
via the ODBC API (see screenshot below).
Select the Natively option, unless there are difficulties with the connection or if you
prefer to use the ODBC API. Then click OK. The connection is established. For
information about subsequent dialogs, refer to the description of the command being
executed.
Note: The listing in the data source pane (when the System DSN or User DSN option is
selected) can be edited using the Edit Selected DSN, Remove Selected DSN, and
Refresh Listed DSNs icons at the bottom of the ODBC Connections screen.
Clicking OK pops up a dialog that prompts for user information, including the User ID and
password. When you click OK in this dialog, the connection string is entered in the ODBC
Connections screen.
Select the required global resource and click Connect. The connection to the database is
established. For information about subsequent dialogs, refer to the description of the command
being executed.
The available root object for each of the supported databases is also listed.
Note: If you are using the 64-bit version of XMLSpy, ensure that you have access to the 64-bit
database drivers needed for the specific database you are connecting to.
Therefore, when a global resource is used as an input, the global resource can be switched
among its configurations. This is done easily via controls in the GUI. For example, if an XSLT
stylesheet for transforming an XML document is assigned via a global resource, then we can
set up multiple configurations for the global resource, each of which points to a different XSLT
file. After setting up the global resource in this way, switching the configuration would switch the
XSLT file used for the transformation.
A global resource can not only be used to switch resources within an Altova application, but also
to generate and use resources from other Altova applications. So, files can be generated on-
the-fly in one Altova application for use in another Altova application. All of this tremendously
eases and speeds up development and testing. For example, an XSLT stylesheet in XMLSpy
can be used to transform an XML file generated on-the-fly by an Altova MapForce mapping.
Click the menu command Tools | Customize to display the Customize dialog. Then
select the Toolbars tab and check the Global Resources option. This switches on the
display of the Global Resources toolbar (screenshot below).
Once the toolbar is displayed, click the Manage Global Resources icon. This pops up
the Global Resources dialog.
You can also re-name the file and save it to any location, if you wish. Consequently, you may
have multiple Global Resources XML files. However, only one of these Global Resources XML
File can be active at any time, and only the definitions contained in this file will be available to
the application.
To select a Global Resources XML file to be the active file, in the Manage Global Resources
dialog (screenshot below), browse for it in the Definitions File entry and select it.
To add a global resource, click the Add button and define the global resource in the Global
Resource dialog that pops up (see description below). After you define a global resource and
save it, the global resource (or alias) is added to the library of global definitions in the selected
Global Resources XML File. To edit a global resource, select it and click Edit. This pops up the
Global Resource dialog, in which you can make the necessary changes (see the descriptions
of files, folders, and databases in the sub-sections of this section). To delete a global resource,
select it and click Delete.
After you finish adding, editing, or deleting, make sure to click OK in the Manage Global
Resources dialog to save your modifications to the Global Resources XML File.
In the Manage Global Resources dialog (screenshot above), when you click the Add button,
you can select whether you wish to add a file-type, folder-type, or database-type resource. How
to add and edit each type of resource is described in the sub-sections of this section.
14.1.1 Files
In the Global Resource dialog for Files (screenshot below), you can add a file resource as
follows:
2. The Configurations pane will have a configuration named Default (screenshot above).
This Default configuration cannot be deleted nor have its name changed. You can enter
as many additional configurations for the selected alias as you like. Add a configuration
by clicking the Add Configuration icon and, in the Add Configuration dialog
which pops up, enter the configuration name. Click OK. The new configuration will be
listed in the Configurations pane. Repeat for as many configurations as required for this
particular alias (global resource). You can also copy a configuration (using the Add
Configuration as Copy icon) and then modify it.
3. Select one of the configurations in the Configurations pane and then define the
resource to which this configuration will map. In the Settings for Configuration X pane,
you can select whether the resource is a file, or the result of either an Altova MapForce
or Altova StyleVision transformation. After selecting the resource type by clicking its
radio button, browse for the file, MapForce file, or StyleVision file. Where multiple inputs
or outputs for the transformation are possible, a selection of the options will be
presented. For example, if the Result of StyleVision Transformation was selected as the
resource type, the output options are displayed according to the what edition of
StyleVision is installed (the screenshot below shows the outputs for Enterprise Edition).
Select the radio button of the desired option (in the screenshot above, 'HTML output' is
selected). The result of a transformation can itself be saved as a global resource or as
a file path (click the icon and select, respectively, Global Resource or Browse). If
neither of these two saving options is selected, the transformation result will be loaded
as a temporary file when the global resource is invoked.
4. Specify a resource for each configuration (that is, repeat Step 3 above for the various
configurations you have created).
5. Click OK in the Global Resource dialog to save the alias and all its configurations as a
global resource. The global resource will be listed under Files in the Manage Global
Resources dialog.
In a MapForce transformation that has multiple output schemas, you can select which one of
the output schemas should be used for the global resource by clicking its radio button (
screenshot below). The XML file that is generated for this schema can be saved as a global
resource or as a file path (click the icon and select, respectively, Global Resource or
Browse). If neither of these options is selected, a temporary XML file is created when the global
resource is used.
Note that each Input can also be saved as a global resource or as a file path (click the icon
and select, respectively, Global Resource or Browse).
14.1.2 Folders
In the Global Resource dialog for Folders (screenshot below), you can add a folder resource as
follows:
which pops up, enter the configuration name. Click OK. The new configuration will be
listed in the Configurations pane. Repeat for as many configurations as required for this
particular alias (global resource).
2. Select one of the configurations in the Configurations pane and browse for the folder
you wish to create as a global resource.
3. Specify a folder resource for each configuration (that is, repeat Step 3 above for the
various configurations you have created).
4. Click OK in the Global Resource dialog to save the alias and all its configurations as a
global resource. The global resource will be listed under Folders in the Manage Global
Resources dialog.
14.1.3 Databases
In the Global Resource dialog for Databases (screenshot below), you can add a database
resource as follows:
listed in the Configurations pane. Repeat for as many configurations as required for this
particular alias (global resource).
2. Select one of the configurations in the Configurations pane and click the Choose
Database icon. This pops up the Create Global Resources Connection dialog (
screenshot below).
Select whether you wish to create a connection to the database using the Connection
Wizard, an existing connection, an ADO Connection, or an ODBC Connection.
Complete the definition of the connection method as described in the section
Connecting to a Database. You can use either the Connection Wizard, ADO
Connections, or ODBC Connections. If a connection has already been made to a
database from XMLSpy, you can click the Existing Connections icon and select the DB
from the list of connections that is displayed.
3. If you connect to a database server, you will be prompted to select a DB Root Object on
the server. The Root Object you select will be the Root Object that is loaded when this
configuration is used. If you choose not to select a Root Object, then you can select the
Root Object at the time the global resource is loaded.
4. Specify a database resource for each configuration (that is, repeat Steps 3 and 4 above
for the various configurations you have created).
5. Click OK in the Global Resource dialog to save the alias and all its configurations as a
global resource. The global resource will be listed under databases in the Manage
Global resources dialog.
Selecting a file-type global resource assigns the file. Selecting a folder-type global resource
causes an Open dialog to open, in which you can brows for the required file. The path to the
selected file is entered relative to the folder resource. So if a folder-type global resource were to
have two configurations, each pointing to different folders, files having the same name but in
different folders could be targeted via the two configurations. This could be useful for testing
purposes.
In the Open Global Resource dialog, you can switch to the file dialog or the URL dialog by
clicking the respective button at the bottom of the dialog. The Manage Global Resources
icon in the top right-hand corner pops up the Manage Global Resources dialog.
Usage scenarios
File-type and folder-type global resources can be used in the following scenarios:
Opening global resources
Saving as global resource
Assigning files for XSLT transformations
XSLT transformation and XQuery executions
Assigning an SPS
Select an alias and the click Save. If the alias is a file alias, the file will be saved directly. If the
alias is a folder alias, a dialog will appear that prompts for the name of the file under which the
file is to be saved. In either case the file will be saved to the location that was defined for the
currently active configuration.
Note: Each configuration points to a specific file location, which is specified in the definition of
that configuration. If the file you are saving as a global resource does not have the
same filetype extension as the file at the current file location of the configuration, then
there might be editing and validation errors when this global resource is opened in
XMLSpy. This is because XMLSpy will open the file assuming the filetype specified in
the definition of the configuration.
Assigning an SPS
When assigning a StyleVision stylesheet to an XML file (Authentic | Assign StyleVision
Stylesheet), you can select a global resource to locate the stylesheet. Click the Browse button
and then the Switch to Global Resource button to pop up the Open Global Resource dialog (
screenshot at top of section). With a global resource selected as the assignment, the Authentic
View of the XML document can be changed merely by changing the active configuration in
XMLSpy.
When you click the Global Resources icon in the Open Database dialog, all the database-type
global resources that have been defined in the currently active Global Resources XML File are
displayed. Select the required global resource and click Connect. If the selected global
resource has more than one configuration, then the database resource for the currently active
configuration (check Tools | Active Configuration or the Global Resources toolbar) is used,
and the connection is made. You must now select the data structures and data to be used as
described in Creating an XML Schema from a DB and Importing DB data.
As an example of how to change configurations, consider the case in which an XSLT file has
been assigned to an XML document via a global resource with multiple configurations. The
XSLT file can be switched merely by changing the configuration of the global resource. This can
be done in two ways:
When you hover over the menu command Tools | Active Configuration, a submenu
with a list of all configurations in the Global Resources XML File pops out. Select the
required configuration.
In the combo box of the Global Resources toolbar (screenshot below), select the
required configuration. (The Global Resources toolbar can be toggled on and off with
the menu command Tools | Customize | Toolbars | Global Resources.)
In this way, by changing the active configuration, you can change source files that are assigned
via a global resource.
15 Projects
A project is a collection of files that are related to each other in some way you determine. For
example, in the screenshot below, a project named Examples collects the files for various
examples in separate example folders, each of which can be organized further into sub-folders.
Within the Examples project, for instance, the OrgChart example folder is organized further into
sub-folders for XML, XSL, and Schema files.
Projects thus enable you to gather together files that are used together and to access them
quicker. Additionally, you can define schemas and XSLT files for individual folders, thus
enabling the batch processing of files in a folder.
This section describes how to create and edit projects and how to use projects.
Project structure
A project has a tree structure of folders and files. Folders and files can be created at any level
and to an unlimited depth. Do this by selecting a folder in the Project Window and then using
the commands in the Project menu or context menu to add folders, files, or resources. Folders,
files, and resources that have been added to a project can be deleted or dragged to other
locations in the project tree.
When a new project is created, the default project structure organizes the project by file type
File-type extensions are associated with a folder via the property definitions for that folder.
When a file is added to a folder, it is automatically added to the appropriate child folder
according to the file-type extension. For each folder, you can define what file-type extensions
are to be associated with it.
To add an object, select the relevant folder and then the required command from the Project
menu or context menu of the selected folder. The following objects are available for addition to
a project folder
Project folders (green) are folders that you add to the project in order to structure the
project's contents. You can define what file extensions are to be associated with a
project folder (in the properties of that folder). When files are added to a folder, they are
automatically added to the first child folder that has that file's extension associated with
it. Consequently, when multiple files are added to a folder, they will be distributed by file
extension among the child folders that have the corresponding file-extension
associations.
External folders (yellow) are folders in a file system. When an external folder is added
to a folder, the external folder and all its files, sub-folders, and sub-folder files are
included in the project. Defining file extensions on an external folder serves to filter the
files available in the project.
External web folders are like external folders, except that they are located on a web
server and require user authentication to access. Defining file extensions on an external
web folder serves to filter the files available in the project.
Files can be added to a folder by selecting the folder and then using one of the three
Add-File commands: (i) Add Files, to select the file/s via an Open dialog; (ii) Add
Active File, to add the file that is active in the Main Window; (iii) Add Active and
Related Files, additionally adds files related to an active XML file, for example, an XML
Schema or DTD. Note that files associated by means of a processing instruction (for
example, XSLT files), are not considered to be related files.
Global Resources are aliases for file, folder, and database resources. How they are
defined and used is described in the section on Global Resources.
URLs identify a resource object via a URL.
An Altova Scripting Project, which is a .asprj file, can be assigned to an XMLSpy
project. This will make macros and other scripts available to the project. How to create
a Scripting Project and assign one to an XMLSpy project is described in the section,
Scripting.
Project properties
The properties of a folder are stored in the Properties dialog of that folder. It is accessed by first
selecting the folder and then the Properties command in the Project menu or context menu
(obtained by right-clicking the folder). Note that properties can be defined not only for the top-
level project folder, but also for folders at various levels of the project hierarchy. The following
properties of a folder can be defined and edited in the Properties dialog:
Folder name: cannot be edited for the top-level project folder (for which, instead of a
name, a filepath is displayed).
File extensions: cannot be edited for the top-level project.
Validation: specifies the DTD or XML Schema file that should be used to validate XML
files in a folder.
Transformations: specifies (i) the XSLT files to be used for transforming XML files in the
folder, and (ii) the XML files to be transformed with XSLT files in the folder.
Destination files: for the output of transformations, specifies the file extension and the
folder where the files are to be saved.
SPS files for Authentic View: specifies the SPS files to be used so that XML files in a
folder can be viewed and edited in Authentic View.
Saving projects
Any changes you make to a project, such as adding or deleting a file, or modifying a project
property, must be saved with the Save Project command.
Refreshing projects
If a change is made to an external folder, this change will not be reflected in the Project Window
till the project is refreshed.
Batch processing
The commands for batch processing of files in a folder, whether the top-level project folder or a
folder at any other level, are available in the context menu of that folder (obtained by right-
clicking the folder). The steps for batch processing are as follows:
1. Define the files to be used for validation or transformation in the Properties dialog of
that folder.
2. Specify the folder in which the output of transformations should be saved. If no output
folder is specified for a folder, the output folder of the next ancestor folder in the project
tree is used.
3. Use the commands in the context menu for batch execution. If you use the
corresponding commands in the XML, DTD/Schema, or XSL/XQuery menus, the
command will be executed only on the document active in the Main Window, not on any
project folder in the Project Window.
The following commands in the context menu of a project folder (top-level or other) are
available for batch processing:
Well-formed check: If any error is detected during the batch execution, it is reported in
the Messages Window.
Validation: If any error is detected during the batch execution, it is reported in the
Messages Window.
Transformations: Transformation outputs are saved to the folder specified as the output
folder in the Properties dialog of that folder. If no folder is specified, the output folder of
the next ancestor project folder is used. If no ancestor project folder has an output
folder defined, a document window is opened and the results of each transformation is
displayed successively in this document window. An XSL-FO transformation transforms
an XML document or FO document to PDF.
Generate DTD / XML Schema: Before the schemas are generated, you are prompted to
specify an output folder. The generated schema files are saved to this folder and
displayed in separate windows in the GUI.
Note: To execute batch commands use the context menu of the relevant folder in the Project
Window. Do not use the commands in the XML, DTD/Schema, or XSL/XQuery menus.
These commands will be executed on the document active in the Main Window.
16 File/Directory Comparisons
XMLSpy provides a File Comparison feature and a Directory Comparison feature that are linked
to each other. File Comparisons and Directory Comparisons are started with the Compare
Open File With and Compare Directories commands in the Tools menu, respectively.
Comparison options for file comparisons can be defined in the Settings dialog, which is
accessed by clicking the Compare Options command in the Tools menu.
Each of these commands is described in detail in the User Reference section. In the sub-
sections of this section we provide an overview of the File Comparisons and Directory
Comparisons mechanisms.
The settings current in the Compare Options dialog when a File Compare session is
started are the settings that will be active for that session.
You can choose to compare the files as XML files (where document structure is also
evaluated) or as Text files. This choice is made by selecting, in the Settings dialog,
either (i) Grid View or Text View (Textual Comparison Only unchecked) for XML
comparisons, or (ii) Text View (Textual Comparison Only checked) for text
comparisons.
The two files appear in adjacent panes in the selected view (Grid View or Text View)
and the differences are highlighted in both files (screenshot below).
A Compare Files control window also pops up which enables you to navigate through
the differences and to merge them.
The Settings dialog offers several options for specifying what aspects of the XML documents
should be considered for the comparison, and what aspects ignored. For more details, see the
Compare Options section in the User Reference.
Zip archives can also be included in the comparison by including the Zip file extension in the list
of file types to evaluate.
Directories are compared to indicate missing files and whether files of the same name are
different or not. The comparisons between files are based on the settings in the Settings dialog.
The results of the directory comparison are displayed in a separate window (screenshot below).
For details about how to read the symbols and manage the view in the Compare Directories
window, see the description of the Compare Directories command in the User Reference. You
can then double-click a file row to directly start a file comparison.
17 Source Control
Altova has implemented the Microsoft Source Code Control Interface (MSSCCI) v1.1 – v1.3 in
XMLSpy, so that XMLSpy now supports Microsoft SourceSafe and other compatible
repositories. Altova has tested support with a large number of drivers and revision control
systems; these are listed in the section, Supported Version Control Systems.
Please note:
The 64-bit version of XMLSpy automatically supports any of the supported 32-bit
source control programs mentioned in this documentation.
When using a 64-bit version of XMLSpy with a 32-bit source control program, the
"Perform background status updates every... ms" option (Tools | Options) is
automatically greyed-out and cannot be selected!
HKEY_LOCAL_MACHINE\SOFTWARE\SourceCodeControlProvider\InstalledSCCProviders
Note that Source Control (SC) plug-ins are not automatically installed by all SC products.
Please read the documentation supplied with your specific SC software for more information
about plug-ins.
Note that a Source Control project is not the same as an XMLSpy project. Source Control
projects are directory dependent, whereas XMLSpy projects are logical constructions without
direct directory dependence.
In this section
This section as organized as follows:
Supported Source Control Systems lists the Source Control Systems (SCSs) that are
supported by XMLSpy. Systems are listed alphabetically by server, and for each server
the supported clients are also listed.
Installing Source Control Systems contains notes about how to install the various SCSs.
SCSs and Altova DiffDog Differencing describes how various Source Control Systems
can be set up to carry out differencing with Altova DiffDog.
Menu commands
The menu commands for using Source Control Systems are in the submenu Project | Source
Control and are described in the User Reference section.
AccuRev
Version: AccuRev 4.7.0 Windows
Clients: AccuBridge for Microsoft SCC 2008.2
Bazaar
Version: Bazaar 1.9 Windows
Clients: Aigenta Unified SCC 1.0.6
Mercurial
Version: Mercurial 1.0.2 for Windows
Clients: Sergey Antonovs HgSCC 1.0.1
Perforce 2008
Version: P4S 2008.1
Clients: Perforce P4V 2008.1
PureCM
Version: PureCM Server 2008/3a
Clients: PureCM Client 2008/3a
Serena Dimensions
Version: Dimensions Express/CM 10.1.3 for Win32 Server
Clients: Serena Dimensions 10.1.3 for Win32 Client
Softimage Alienbrain
Version: Alienbrain Server 8.1.0.7300
Clients: Softimage Alienbrain Essentials/Advanced Client 8.1.0.7300
SourceGear Fortress
Version: 1.1.4 Server
Clients: SourceGear Fortress 1.1.4 Client
SourceGear SourceOffsite
Version: SourceOffsite Server 4.2.0
Clients: SourceGear SourceOffsite Client 4.2.0 (Windows)
SourceGear Vault
Version: 4.1.4 Server
Clients: SourceGear Vault 4.1.4 Client
1. To install ComponentSoftware CS-RCS (PRO) start the setup and choose the option
“Workstation Setup”.
2. Specify your repository tree root and when the installation is finished, restart your
machine as requested.
3. Use the “ComponentSoftware RCS Properties” to choose, or create, a project and to
specify a work folder.
To integrate with Altova products, it is sufficient to install only the client. Check only the client
check box.
Provide a server name and the license server element(s) following the examples
provided by the installer (port@server_name).
Provide a configuration description name by editing a name you like and insert the path
to a Release area. This path must specify a shared folder.
You can create a new folder on your machine, share it, and use it a Release Area. (In
Vista, you must set the Network discovery to "on" in Network and Sharing Center to set
this path.) The Release Area is now created, some files are copied into it and a shortcut
is created sitedefs.lnk.
When all files are copied, continue by clicking the shortcut from Windows Explorer. A
In Vista, the second setup could generate the internal error: 2739. In this case, start Windows
Explorer and go to C:\Windows\System32.
Right click and run “cmd.exe” “As Administrator”. A command window pops up.
Type “regsvr32 jscript.dll”.
Launch the setup again.
To work with files stored in ClearCase, you should create a view that points to your ClearCase
project.
When working with Altova products, setting the “Auto Commit” Mode is recommended.
Auto Commit Mode is found in the advanced Source Control options.
After defining a workspace, you can start to work.
Mercurial
see under Sergey Antonovs HgScc 1.0.1
http://www.perforce.com/
The Perforce Visual Client (P4V) offers a choice:
To install all client features (default behavior)
To install only the “SCC Plug-in (P4SCC)” feature.
The default installation will work correctly with all Altova products.
To install Qumasoft QVCS-Enterprise client, run the installer. If your operating system is Vista,
you must modify the installation directory from the default value “C:\Program
Files\QVCS-Enterprise Client” to “C:\QVCS-Enterprise Client”. This must be done as Vista does
not let applications write to the C:\Program Files area. 1. Edit the “setEnv.cmd” file that resides
in the installation directory so that the JAVA_HOME environment variable points to the location
of your JVM.
If you work with Vista you might have problem when saving the file.
1. If this is the case, start Windows Explorer and go to C:\Windows\System32.
2. Right click and run “cmd.exe” “As Administrator”.
3. A command window pops up.
4. Type “cd <installation folder of the QVCS –Enterprise client>”
5. Type “Notepad setEnv.cmd” and then edit the file and save it.
6. From the installation directory of the Qumasoft QVCS-Enterprise client run the batch file
“gui.bat”.
7. Add a server from the “Server menu” specifying the requested name, IP address and
ports, log in and define a local workspace.
If your operating system is Vista, you must modify the installation directory from the
default value “C:\Program Files\QVCSBin“ to “C:\QVCSBin”. This must be done as
Vista does not let applications write to the C:\Program Files area.
After installation is finished, launch the QVCS 3.10 client, create a new user and
enable Ide integration by selecting the submenu “Ide Integration” in the Admin menu
and adding QVCS as a Version Control Tool.
Create a project and set a workspace.
When using a 64-bit version of XMLSpy with a 32-bit source control program, the "Perform
background status updates every... ms" option (Tools | Options) is automatically greyed-out
and cannot be selected!
The "Perform background status updates every xx ms" check box is unchecked per default,
which means that status updates are not performed at all. Activate the check box and enter a
value in the field, if you want to perform status updates every xx ms. For 64-bit versions using
32-bit source control plugins, this option has no effect.
In the Source Control tab, select the required Source Control System and then click the
Advanced button. The dialog box that opens will be different for each Source Control System.
For the setup process, note the following:
If you have performed a standard installation of Altova DiffDog, the file path to the
Altova DiffDog executable is:
c:\program files\altova\diffdog2011\DiffDog.exe
If Altova DiffDog is installed elsewhere on your system, insert the appropriate value
when the filepath is required.
Warning: Do not perform these settings from the Altova product options, as there is no
possibility of inserting the external application parameters.
Warning: When using the default diff editor CvsConflictEditor, you might have problems
comparing files with excessively long lines. We recommended that you "pretty print" all files
(particularly .ump files) before storing them in the repository. This limits the line length, thus
avoiding problems with the CVSConflictEditor.
Mercurial
see under Sergey Antonovs HgScc 1.0.1
Warning: When using the default differencing editor CvsConflictEditor, you might have
problems comparing files with excessively long lines. We recommended that you "pretty print"
all files (particularly .ump files) before storing them in the repository. This limits the line length,
thus avoiding problems with the CVSConflictEditor.
Warning: It is possible that the new settings will only be applied after a Windows log off.
Warning: The default differencing editor CvsConflictEditor, has problems comparing files with
excessively long lines. We recommended that you "pretty print" all files (particularly .ump files)
before storing them in the repository. This limits the line length, avoiding problems with the
CVSConflictEditor.
Note: The screenshots in this section are of Visual Studio version 2005. If you are using
another version, there could be differences between the screenshots and your version.
Once the integration package has been installed, you will be able to use XMLSpy in the Visual
Studio environment.
Note: The screenshots in this section are of Visual Studio version 2005. If you are using
another version, there could be differences between the screenshots and your version.
development environment.
Projects: XMLSpy projects are handled as Visual Studio projects.
Customize Toolbars, Customize Commands: The Toolbars and Commands tabs (
screenshot below) in the Customize dialog (Tools | Customize) contain both visual
Studio commands as well as XMLSpy commands.
Views: In the View menu, the two commands, XMLSpy Tool Windows and XMLSpy
View, contain options to toggle on entry helper windows and other sidebars, switch
between the editing views, and toggle certain editing guides on and off.
XMLSpy Help: This XMLSpy menu appears as a submenu in Visual Studio's Help
menu.
Note: The screenshots in this section are of Visual Studio version 2005. If you are using
another version, there could be differences between the screenshots and your version.
2. Select New Vertical Tab Group. This creates a new tab containing just the selected
tab (screenshot below).
Note: The screenshots in this section are of Visual Studio version 2005. If you are using
another version, there could be differences between the screenshots and your version.
19 XMLSpy in Eclipse
Eclipse 3.x is an open source framework that integrates different types of applications delivered
in the form of plugins.
The XMLSpy Plugin for Eclipse enables you to access the functionality of XMLSpy from within
the Eclipse 3.4 / 3.5 / 3.6 Platform. It is available on Windows platforms. In this section, we
describe how to install the XMLSpy Plugin for Eclipse and how to set up the XMLSpy
perspective and XMLSpy Debugger perspectives. After you have done this, components of the
XMLSpy GUI and XMLSpy menu commands will be available within the Eclipse GUI.
Note:
Source Control functionality, which is available in the standalone version, is not
supported in the Eclipse version.
After these have been installed, you can install the XMLSpy Plugin for Eclipse, which is
contained in the XMLSpy Integration Package (see below). (Please note: You must use the
integration package corresponding to your XMLSpy version (current version is 2011).)
Note on JRE
If, on opening a document in Eclipse, you receive the following error message:
java.lang.UnsupportedClassVersionError: com/altova/....
(Unsupported major.minor version 49.0)
it indicates that Eclipse is using an older JRE. Since Eclipse uses the PATH environment
variable to find a javaw.exe, the problem can be solved by fixing the PATH environment variable
so that a newer version is found first. Alternatively, start Eclipse with the command line
parameter -vm, supplying the path to a javaw.exe of version 1.5 or higher.
4. In the next dialog ((Eclipse) Installation Location, screenshot below), you can choose
whether the Install Wizard should integrate the XMLSpy Plugin into Eclipse during the
installation (the "Automatic" option) or whether you will integrate the XMLSpy Plugin into
Eclipse (via the Eclipse GUI) at a later time.
We recommend that you let the Installation Wizard do the integration. Do this by
checking the Automatic option and then browsing for the folder in which the Eclipse
executable (eclipse.exe) is located. Click Next when done. If you choose to manually
integrate XMLSpy Plugin for Eclipse in Eclipse, select the Manually option (screenshot
below). See the section below for instructions about how to manually integrate from
within Eclipse.
5. Complete the installation. If you set up automatic integration, the XMLSpy Plugin for
Eclipse will be integrated in Eclipse and will be available when you start Eclipse the next
time. Otherwise, you will have to manually integrate the plug-in (see below).
8. An Installation review dialog box allowing you to confirm that the checked items will be
installed opens.
9. Click Next to continue.The Review License dialog opens.
10. Read the license terms and, if you accept them, click I accept the terms.... Then click
Finish to complete the installation.
If there are problems with the plug-in (missing icons, for example), start Eclipse with the -clean
flag.
XMLSpy Perspective
In Eclipse, a perspective is a configured GUI view with attendant functionality. When the
XMLSpy Plugin for Eclipse is integrated in Eclipse, a default XMLSpy perspective is
automatically created. This perspective is a GUI that includes XMLSpy's GUI elements: its
editing views, menus, entry helpers, and other sidebars.
When a file having a filetype associated with XMLSpy is opened (.xml, for example), this file
can be edited in the XMLSpy perspective. Similarly, a file of another filetype can be opened in
another perspective in Eclipse. Additionally, for any active file, you can switch the perspective,
thus allowing you to edit or process that file in another environment. There are therefore two
main advantage of perspectives:
1. Being able to quickly change the working environment of the active file, and
2. Being able to switch between files without having to open a new development
environment (the associated environment is available in a perspective)
The empty window or the active document will now have the XMLSpy perspective. This is how
the user switches the perspective via the menu. To access a perspective faster from another
perspective, the required perspective can be listed in the Open Perspective submenu, above
the Other item; this setting is in the customization dialog.
Perspectives can also be switched when a file is opened or made active. The perspective of the
application associated with a file's filetype will be automatically opened when that file is opened
for the first time. Before the perspective is switched, a dialog appears asking whether you wish
to have the default perspective automatically associated with this filetype. Check the Do Not Ask
Again option if you wish to associate the perspective with the filetype without having to be
prompted each time a file of this filetype is opened, and then click OK.
In the Shortcuts tab of the Customize Perspective dialog, you can set shortcuts for submenus.
Select the required submenu in the Submenus combo box. Then select a shortcut category,
and check the shortcuts you wish to include for the perspective.
In the Commands tab, you can add command groups. To display the commands in a command
group, select the required command group from among the available command groups
(displayed in the Command Groups pane). The commands in this group are displayed in a tree
in the right-hand side pane, ordered hierarchically in the menu in which it will appear. If you wish
to include the command group, check its check box.
Click OK to complete the customization and for the changes to take effect.
These are for: (i) opening the XMLSpy Help, and (ii) creating new XMLSpy documents .
The empty window or the active document will now have the perspective of the selected
debugger. This is how the user switches the perspective via the menu. To access a perspective
faster from another perspective, the required perspective can be listed in the Open
Perspective submenu, above the Other item; this setting is in the customization dialog.
For a description of how to use the debuggers, see the respective sections in this
documentation: XSLT and XQuery, and WSDL and SOAP.
20 Code Generator
XMLSpy includes a built-in code generator which can automatically generate Java, C++ or C#
class files from XML Schema definitions
The implementation of any custom XML software application ultimately requires writing
programmatic access methods within your code to create, validate, process, transform, modify
or perform any in-memory operation on an XML document.
Program coding is most commonly done through the use of high-level XML processing
Application Program Interfaces (API) such as Microsoft MSXML and Apache Xerces Version
2.6.0 and higher, which are freely available for various programming languages.
In the case of complex schemas which import schema components from multiple namespaces,
XMLSpy preserves this information by generating the appropriate C#, or C++ namespaces or
Java packages.
Additional code is implemented, such as functions which read XML files into a Document Object
Model (DOM) in-memory representation, write XML files from a DOM representation back to a
system file, or to convert strings to XML DOM trees and vice versa.
C++
The C++ generated output uses either MSXML 6.0, or Apache Xerces 2.6 or later. Both
MapForce and XMLSpy generate complete project and solution/workspace files for Visual C++
6.0 or Visual Studio 2005 to 2010 directly. .sln and .vcproj files are generated in addition to the
.dsw /.dsp files for Visual Studio 6.0. The generated code optionally supports MFC, e.g. by
generated CString conversion methods.
Please note:
When building C++ code for Visual Studio 2005/2008/2010 and using a Xerces library
precompiled for Visual C++ 6.0, a compiler setting has to be changed in all projects of
the solution:
C#
The generated C# code uses the .NET XML classes (System.Xml) and can be used from any
.NET capable programming language, e.g. VB.NET, Managed C++, J# or any of the several
languages that target the .NET platform. Project files can be generated for Visual Studio 2005,
2008 and 2010.
Java
The generated Java output is written against the industry-standard Java API for XML Parsing
(JAXP) and includes a JBuilder project file, an Ant build file and project files for Eclipse. Java 5
(JDK 1.5) or higher is supported.
Additionally you can build your own templates to automate the generation of anything
imaginable, for example: EJB's, WSDL files, SQL scripts, ASP or WML code.
XMLSpy's schema editor is well suited as a software modeling and prototyping tool, allowing
XML applications to be rapidly prototyped at a high level in XML Schema and then automatically
generated. Changes to an application's XML Schema content model can be immediately
reconciled with a software implementation simply by re-running the code generator.
Version 2010 R3
Support for Microsoft Visual Studio 2010
Support for MSXML 6.0 in generated C++ code
Support for 64-bit targets for C++ and C# projects
Version 2010 R2
Code generation for C++ for the Linux platform
Version 2010
Enumeration facets from XML schemas are now available as symbolic constants in the
generated classes (using 2007r3 templates).
Apache Xerces version 3.x support added. (older versions starting from Xerces 2.6.x
are still supported.)
Version 2009
No new updates.
Version 2008 R2
Support for generation of Visual Studio 2008 project files for C# and C++ has been
added.
Version 2008
The new 2007 R3-style SPL templates have been further enhanced:
Version 2007 R3
Code Generator has been redesigned for version 2007 release 3 to simplify usage of the
generated code, reduce code volume and increase performance.
Handling of XML documents and nodes with explicit ownership, to avoid memory leaks
and to enable multi-threading
New syntax to avoid name collisions
New data types for simpler usage and higher performance (native types where
possible, new null handling, ...)
Attributes are no longer generated as collections
Simple element content is now also treated like a special attribute, for consistency
New internal object model (important for customized SPL templates)
Compatibility mode to generate code in the style of older releases
1. Open the schema you want to generate source code for (e.g., AddressLast).
Open the AddressLastTest.cpp file and write your test code into the Example() function.
Linux/GCC support
The "Makefile for Linux/GCC" option adds Makefiles to the generated code with the C++ source
files being generated so that they are portable using #ifdef constructs to support different
compilers and operating systems.
Note that only Xerces 3.x on Linux, with the current template version (2007r3 compatible) is
supported. Enabling the "MFC support" check box will have no effect on compilation with
Linux/GCC.
Compatibility Mode
Depending on the value of the setting "Generate code compatible to", the generated classes
have different names, members and methods. The following description applies to version
2007r3 and later only. For the other settings please refer to the chapter about using generated
code compatible to old versions. There were no compatibility-breaking changes since version
2007r3.
Generated Libraries
When XMLSpy generates code from an XML Schema or DTD, the following libraries are
generated:
Name Purpose
Altova Base library containing common runtime support, identical for every schema
AltovaXML Base library containing runtime support for XML, identical for every schema
YourSchema Library containing declarations generated from the input schema, named as the
schema file or DTD
YourSchema Test application skeleton (XMLSpy only)
Test
The test application skeleton is a compilable application that calls an empty Example() method.
You can add your test code into this method for easy and quick testing of your new generated
library.
The namespaces from the XML Schema are converted to packages in Java or namespaces in
C# or C++ code, using the namespace prefix from the schema as code namespace. The
complete library is enclosed in a package or namespace derived from the schema file name, so
you can use multiple generated libraries in one program without name conflicts.
Data Types
XML Schema has a much more elaborate data type model than Java, C# or C++. Code
Generator converts the 44 XML Schema types to a couple of language-specific primitive types,
or to classes delivered with the Altova library. The mapping of simple types can be configured in
the SPL template.
Complex types and derived types defined in the schema are converted to classes in the
generated library.
Generated Classes
XMLSpy generally generates one class per type found in the XML Schema, or per element in
the DTD. One additional class per library is generated to represent the document itself, which
can be used for loading and saving the document.
Memory Management
A DOM tree is comprised of nodes, which are always owned by a specific DOM document -
even if the node is not currently part of the document's content. All generated classes are
references to the DOM nodes they represent, not values. This means that assigning an
instance of a generated class does not copy the value, it only creates an additional reference to
the same data.
To keep things simple, we will work with a very small xsd file, the source code is shown below.
Save this as Library.xsd if you want to get the same results as our example:
</xs:simpleType>
</xs:schema>
We will only use this schema file in this example, it will therefore be easy to figure out the
differences between the different programming languages in the following code examples.
Please note that the generated classes will be named differently from xsd to xsd file. When
working with your own schemas or other samples, make sure you adapt the names of the
functions and variables.
Generated Packages
Name Purpose
com.altova Base package containing common runtime support, identical for every schema
com.altova.xm Base package containing runtime support for XML, identical for every schema
l
com.YourSche Package containing declarations generated from the input schema, named as
ma the schema file or DTD
com.YourSche Test application skeleton (XMLSpy only)
maTest
DOM Implementation
The generated Java code uses JAXP (Java API for XML Processing) as the underlying DOM
interface. Please note that the default DOM implementation delivered with Java 1.4 does not
automatically create namespace attributes when serializing XML documents. If you encounter
problems, please update to Java 5 or later.
Data Types
The default mapping of XML Schema types to Java data types is:
All XML Schema types not contained in this list are derived types, and mapped to the same
Java type as their respective base type.
Method Purpose
static Doc loadFromFile(String fileName) Loads an XML document from a file
static Doc loadFromString(String xml) Loads an XML document from a string
static Doc loadFromBinary(byte[] xml) Loads an XML document from a byte array
void saveToFile(String fileName, boolean Saves an XML document to a file with the
prettyPrint, String encoding = "UTF-8") specified encoding. If no encoding is specified,
UTF-8 is assumed.
void SaveToFile(String fileName, boolean Saves an XML document to a file with the
prettyPrint, String encoding, boolean specified encoding. Byte order and Unicode
bigEndian, boolean writeBOM) byte-order mark can be specified for Unicode
encodings.
String saveToString(boolean prettyPrint) Saves an XML document to a string
byte[] saveToBinary(boolean prettyPrint, Saves an XML document to a byte array with
String encoding = "UTF-8") the specified encoding. If no encoding is
specified, UTF-8 is assumed.
byte[] saveToBinary(boolean prettyPrint, Saves an XML document to a byte array with
String encoding, boolean bigEndian, boolean the specified encoding. Byte order and Unicode
writeBOM) byte-order mark can be specified for Unicode
encodings.
static Doc createDocument() Creates a new, empty XML document.
void setSchemaLocation(String Adds an xsi:schemaLocation or
schemaLocation) xsi:noNamespaceSchemaLocation attribute to
the root element. A root element must already
exist.
Method Purpose
boolean exists() Returns true if the attribute exists
void remove() Removes the attribute from its parent element
AttributeType getValue() Gets the attribute value
void setValue(AttributeType value) Sets the attribute value
int getEnumerationValue() Generated for enumeration types only. Returns
one of the constants generated for the possible
values, or Invalid if the value does not match
any of the enumerated values in the schema.
void setEnumerationValue(int) Generated for enumeration types only. Pass
one of the constants generated for the possible
values to this method to set the value.
com.altova.xml.meta.Attribute getInfo() Returns an object for querying schema
information (see below)
Method Purpose
MemberType first() Returns the first instance of the member
element
MemberType at(int index) Returns the member element specified by the
index
MemberType last() Returns the last instance of the member
element
MemberType append() Creates a new element and appends it to its
parent
boolean exists() Returns true if at least one element exists
int count() Returns the count of elements
void remove() Deletes all occurrences of the element from its
parent
void removeAt(int index) Deletes the occurrence of the element
specified by the index
java.util.Iterator iterator() Returns an object for iterating instances of the
member element.
MemberType getValue() Gets the element content (only generated if
element can have simple or mixed content)
void setValue(MemberType value) Sets the element content (only generated if
element can have simple or mixed content)
int getEnumerationValue() Generated for enumeration types only. Returns
one of the constants generated for the possible
values, or Invalid if the value does not match
any of the enumerated values in the schema.
void setEnumerationValue(int) Generated for enumeration types only. Pass
one of the constants generated for the possible
values to this method to set the value.
com.altova.xml.meta.Element getInfo() Returns an object for querying schema
information (see below)
The following Java code was used to create this file. The classes Library2, LibraryType and
BookType are generated out of the schema and represent the complete document, the type of
the <Library> element, and the complex type BookType, which is the type of the <Book>
element. Note that the automatic name de-collision renamed the Library class to Library2 to
avoid a possible conflict with the library namespace name.
protected static void example() throws Exception {
// create a new, empty XML document
Library2 libDoc = Library2.createDocument();
Note that all elements are created by calling append(), and that attributes (like ISBN in the
example) can simply be accessed like structure members.
Note the type of the book.Author member: xs.stringType is a generated class for any element
with simple string content. Similar classes are generated for all other XML Schema types.
Of course you can also load a document, modify it by adding or deleting elements and
attributes, and then save the changed file back to disk.
Error Handling
Errors are reported by exceptions. The following exception classes are defined in the
namespace com.altova:
Class Description
java.lang.Error Internal program logic error (independent of input
data)
java.lang.Exception Base class for runtime errors
java.lang.IllegalArgumentsException A method was called with invalid argument values, or
a type conversion failed.
java.lang.ArithmeticException Exception thrown when a numeric type conversion
fails.
Accessing Metadata
The generated library allows accessing static schema information via the following classes. The
methods that return one of the metadata classes return null if the respective property does not
exist.
com.altova.xml.meta.SimpleType
Method Purpose
SimpleType getBaseType() Returns the base type of this type
String getLocalName() Returns the local name of the type
String getNamespaceURI() Returns the namespace URI of the type
int getMinLength() Returns the value of this facet
int getMaxLength() Returns the value of this facet
int getLength() Returns the value of this facet
int getTotalDigits() Returns the value of this facet
int getFractionDigits() Returns the value of this facet
String getMinInclusive() Returns the value of this facet
String getMinExclusive() Returns the value of this facet
String getMaxInclusive() Returns the value of this facet
String getMaxExclusive() Returns the value of this facet
String[] getEnumerations() Returns a list of all enumeration facets
String[] getPatterns() Returns a list of all pattern facets
int getWhitespace() Returns the value of the whitespace facet,
which is one of:
com.altova.typeinfo.WhitespaceType.Whitespa
ce_Unknown
com.altova.typeinfo.WhitespaceType.Whitespa
ce_Preserve
com.altova.typeinfo.WhitespaceType.Whitespa
ce_Replace
com.altova.typeinfo.WhitespaceType.Whitespa
ce_Collapse
com.altova.xml.meta.ComplexType
Method Purpose
Attribute[] GetAttributes() Returns a list of all attributes
Element[] GetElements() Returns a list of all elements
ComplexType getBaseType() Returns the base type of this type
String getLocalName() Returns the local name of the type
String getNamespaceURI() Returns the namespace URI of the type
SimpleType getContentType() Returns the simple type of the content
Element findElement(String localName, String Finds the element with the specified local name
namespaceURI) and namespace URI
Attribute findAttribute(String localName, Finds the attribute with the specified local name
String namespaceURI) and namespace URI
com.altova.xml.meta.Element
Method Purpose
ComplexType getDataType() Returns the type of the element. Note that this
is always a complex type even if declared as
simple in the original schema. Use
getContentType() of the returned object to get
the simple content type.
com.altova.xml.meta.Attribute
Method Purpose
SimpleType getDataType() Returns the type of the attribute content
boolean isRequired() Returns true if the attribute is required
String getLocalName() Returns the local name of the attribute
String getNamespaceURI() Returns the namespace URI of the attribute
Generated Libraries
Name Purpose
Altova Base library containing common runtime support, identical for every schema
AltovaXML Base library containing runtime support for XML (MSXML or Xerces), identical
for every schema
YourSchema Library containing declarations generated from the input schema, named as the
schema file or DTD
YourSchema Test application skeleton (XMLSpy only)
Test
DOM Implementations
The generated C++ code supports either Microsoft MSXML or Apache Xerces 2.6 or higher,
depending on code generation settings. The syntax for using the generated code is identical for
both DOM implementations.
Character Types
The generated C++ code can be compiled with or without Unicode support. Depending on this
setting, the types string_type and tstring will both be defined to std::string or std::wstring,
consisting of narrow or wide characters. To use Unicode characters in your XML file that are not
representable with the current 8-bit character set, Unicode support must be enabled. Please
take care with the _T() macros. This macro ensures that string constants are stored correctly,
whether you're compiling for Unicode or non-Unicode programs.
Data Types
The default mapping of XML Schema types to C++ data types is:
All XML Schema types not contained in this list are derived types, and mapped to the same C++
type as their respective base type.
Method Purpose
static CDoc LoadFromFile(const string_type& Loads an XML document from a file
fileName)
static CDoc LoadFromString(const Loads an XML document from a string
string_type& xml)
static CDoc LoadFromBinary(const Loads an XML document from a byte array
std:vector<unsigned char>& xml)
void SaveToFile(const string_type& fileName, Saves an XML document to a file with the
bool prettyPrint, const string_type& encoding = specified encoding. If no encoding is specified,
"UTF-8") UTF-8 is assumed.
void SaveToFile(const string_type& fileName, Saves an XML document to a file with the
bool prettyPrint, const string_type& encoding, specified encoding. Byte order and Unicode
bool bigEndian, bool writeBOM) byte-order mark can be specified for Unicode
encodings.
string_type SaveToString(bool prettyPrint) Saves an XML document to a string
std::vector<unsigned char> SaveToBinary Saves an XML document to a byte array with
(bool prettyPrint, const string_type& encoding = the specified encoding. If no encoding is
"UTF-8") specified, UTF-8 is assumed.
std::vector<unsigned char> SaveToBinary Saves an XML document to a byte array with
(bool prettyPrint, const string_type& encoding, the specified encoding. Byte order and Unicode
bool bigEndian, bool writeBOM) byte-order mark can be specified for Unicode
encodings.
static CDoc CreateDocument() Creates a new, empty XML document. Must be
released using DestroyDocument().
void DestroyDocument() Destroys a document. All references to the
document and its nodes are invalidated. This
must be called when finished working with a
document.
void SetSchemaLocation(const string_type& Adds an xsi:schemaLocation or
schemaLocation) xsi:noNamespaceSchemaLocation attribute to
the root element. A root element must already
exist.
Method Purpose
bool exists() Returns true if the attribute exists
void remove() Removes the attribute from its parent element
int GetEnumerationValue() Generated for enumeration types only. Returns
one of the constants generated for the possible
values, or Invalid if the value does not match
any of the enumerated values in the schema.
void SetEnumerationValue(int) Generated for enumeration types only. Pass
one of the constants generated for the possible
values to this method to set the value.
altova::meta::Attribute info() Returns an object for querying schema
information (see below)
In addition, assignment and conversion operators from/to the attribute's native type are created,
so it can be used directly in assignments.
Method Purpose
MemberType first() Returns the first instance of the member
element
MemberType operator[](unsigned int index) Returns the member element specified by the
index
MemberType last() Returns the last instance of the member
element
MemberType append() Creates a new element and appends it to its
parent
bool exists() Returns true if at least one element exists
For simple and mixed content elements, assignment and conversion operators from/to the
element's native type are created, so it can be used directly in assignments.
The following C++ code was used to create this file. The classes CLibrary, CLibraryType and
CBookType are generated out of the schema and represent the complete document, the type of
the <Library> element, and the complex type BookType, which is the type of the <Book>
element.
using namespace Library;
void Example()
{
// create a new, empty XML document
CLibrary libDoc = CLibrary::CreateDocument();
// destroy the document - all references to the document and any of its
nodes become invalid
libDoc.DestroyDocument();
}
Note that all elements are created by calling append(), and that attributes (like ISBN in the
example) can simply be accessed like structure members. Remember to destroy the document
when you are finished using it.
// destroy the document - all references to the document and any of its
nodes become invalid
libDoc.DestroyDocument();
}
To access the contents of attributes and elements as strings for the cout << operator, an explicit
cast to tstring is required.
Of course you can also load a document, modify it by adding or deleting elements and
attributes, and then save the changed file back to disk.
Error Handling
Errors are reported by exceptions. The following exception classes are defined in the
namespace altova:
All exception classes contain a message text and a pointer to a possible inner exception.
Method Purpose
string_type message() Returns a textual description of the exception
std::exception inner() Returns the exception that caused this exception, if
available, or NULL
Accessing Metadata
The generated library allows accessing static schema information via the following classes. All
methods are declared as const. The methods that return one of the metadata classes return a
NULL object if the respective property does not exist.
altova::meta::SimpleType
Method Purpose
operator bool() Returns true if this is not the NULL SimpleType
operator !() Returns true if this is the NULL SimpleType
SimpleType GetBaseType() Returns the base type of this type
string_type GetLocalName() Returns the local name of the type
altova::meta::ComplexType
Method Purpose
operator bool() Returns true if this is not the NULL
ComplexType
operator !() Returns true if this is the NULL ComplexType
std::vector<Attribute> GetAttributes() Returns a list of all attributes
std::vector<Element> GetElements() Returns a list of all elements
ComplexType GetBaseType() Returns the base type of this type
string_type GetLocalName() Returns the local name of the type
string_type GetNamespaceURI() Returns the namespace URI of the type
SimpleType GetContentType() Returns the simple type of the content
Element FindElement(const char_type* Finds the element with the specified local name
localName, const char_type* namespaceURI) and namespace URI
Attribute FindAttribute(const char_type* Finds the attribute with the specified local name
localName, const char_type* namespaceURI) and namespace URI
altova::meta::Element
Method Purpose
operator bool() Returns true if this is not the NULL Element
operator !() Returns true if this is the NULL Element
ComplexType GetDataType() Returns the type of the element. Note that this
is always a complex type even if declared as
simple in the original schema. Use
GetContentType() of the returned object to get
the simple content type.
unsigned int GetMinOccurs() Returns the minOccurs value defined in the
schema
unsigned int GetMaxOccurs() Returns the maxOccurs value defined in the
schema
string_type GetLocalName() Returns the local name of the element
string_type GetNamespaceURI() Returns the namespace URI of the element
altova::meta::Attribute
Method Purpose
Generated Libraries
Name Purpose
Altova Base library containing common runtime support, identical for every schema
AltovaXML Base library containing runtime support for XML, identical for every schema
YourSchema Library containing declarations generated from the input schema, named as the
schema file or DTD
YourSchema Test application skeleton (XMLSpy only)
Test
DOM Implementation
The generated C# code uses the .NET standard System.XML library as the underlying DOM
implementation.
Data Types
The default mapping of XML Schema types to C# data types is:
All XML Schema types not contained in this list are derived types, and mapped to the same C#
type as their respective base type.
In addition to the classes for the types declared in the XML Schema, the document class is
generated. It contains all possible root elements as members, and in addition the following
methods ("Doc" stands for the name of the generated document class itself):
Method Purpose
static Doc LoadFromFile(string fileName) Loads an XML document from a file
static Doc LoadFromString(string xml) Loads an XML document from a string
static Doc LoadFromBinary(byte[] xml) Loads an XML document from a byte array
void SaveToFile(string fileName, bool Saves an XML document to a file with the
prettyPrint, string encoding = "UTF-8") specified encoding. If no encoding is specified,
UTF-8 is assumed.
string SaveToString(bool prettyPrint) Saves an XML document to a string
byte[] SaveToBinary(bool prettyPrint, string Saves an XML document to a byte array with
encoding = "UTF-8") the specified encoding. If no encoding is
specified, UTF-8 is assumed.
static Doc CreateDocument() Creates a new, empty XML document
static Doc CreateDocument(string encoding) Creates a new, empty XML document, with
encoding of type "encoding".
void SetSchemaLocation(string Adds an xsi:schemaLocation or
schemaLocation) xsi:noNamespaceSchemaLocation attribute to
the root element. A root element must already
exist.
void SetDTDLocation(string dtdLocation) Adds a DOCTYPE declaration with the
specified system ID. A root element must
already exist.
Method/Property Purpose
bool Exists() Returns true if the attribute exists
void Remove() Removes the attribute from its parent element
AttributeType Value Sets or gets the attribute value
int EnumerationValue Generated for enumeration types only. Sets or
gets the attribute value using one of the
constants generated for the possible values,
reading returns Invalid if the value does not
match any of the enumerated values in the
schema.
Method/Property Purpose
MemberType First Returns the first instance of the member
element
MemberType this[int index] Returns the member element specified by the
index
MemberType At(int index) Returns the member element specified by the
index
MemberType Last Returns the last instance of the member
element
MemberType Append() Creates a new element and appends it to its
parent
bool Exists Returns true if at least one element exists
int Count Returns the count of elements
void Remove() Deletes all occurrences of the element from its
parent
void RemoveAt(int index) Deletes the occurrence of the element
specified by the index
System.Collections.IEnumerator Returns an object for iterating instances of the
GetEnumerator() member element.
MemberType Value Sets or gets the element content (only
generated if element can have mixed or simple
content)
int EnumerationValue Generated for enumeration types only. Sets or
gets the element value using one of the
constants generated for the possible values,
reading returns Invalid if the value does not
match any of the enumerated values in the
schema.
Altova.Xml.Meta.Element Info Returns an object for querying schema
information (see below)
The following C# code was used to create this file. The classes Library2, LibraryType and
BookType are generated out of the schema and represent the complete document, the type of
the <Library> element, and the complex type BookType, which is the type of the <Book>
element. Note that the automatic name de-collision renamed the Library class to Library2 to
avoid a possible conflict with the library namespace name.
using Library;
...
protected static void Example()
{
// create a new, empty XML document
Library2 libDoc = Library2.CreateDocument();
Note that all elements are created by calling Append(), and that attributes (like ISBN in the
example) can simply be accessed like structure members.
using Library;
...
protected static void Example()
{
// load XML document
Library2 libDoc = Library2.LoadFromFile("Library1.xml");
{
// output values of ISBN attribute and (first and only)
title element
Console.WriteLine("ISBN: " + book.ISBN.Value);
Console.WriteLine("Title: " + book.Title.First.Value);
Note the type of the book.Author member: xs.stringType is a generated class for any element
with simple string content. Similar classes are generated for all other XML Schema types.
Of course you can also load a document, modify it by adding or deleting elements and
attributes, and then save the changed file back to disk.
Error Handling
Errors are reported by exceptions. The following exception classes are defined in the
namespace Altova:
Class Description
System.Exception Base class for runtime errors
System.ArgumentException A method was called with invalid argument values, or
a type conversion failed.
System.FormatException A value in the lexical space cannot be converted to
value space.
System.InvalidCastException A value cannot be converted to another type.
System.OverflowException A source value cannot be represented in target
domain.
Accessing Metadata
The generated library allows accessing static schema information via the following classes. The
properties that return one of the metadata classes return null if the respective property does not
exist.
Altova.Xml.Meta.SimpleType
Method/Property Purpose
SimpleType BaseType Returns the base type of this type
string LocalName Returns the local name of the type
string NamespaceURI Returns the namespace URI of the type
XmlQualifiedName QualifiedName Returns the qualified name of this type
int MinLength Returns the value of this facet
int MaxLength Returns the value of this facet
int Length Returns the value of this facet
int TotalDigits Returns the value of this facet
int FractionDigits Returns the value of this facet
string MinInclusive Returns the value of this facet
string MinExclusive Returns the value of this facet
string MaxInclusive Returns the value of this facet
string MaxExclusive Returns the value of this facet
string[] Enumerations Returns a list of all enumeration facets
string[] Patterns Returns a list of all pattern facets
WhitespaceType Whitespace Returns the value of the whitespace facet,
which is one of:
Unknown
Preserve
Replace
Collapse
Altova.Xml.Meta.ComplexType
Method/Property Purpose
Attribute[] Attributes Returns a list of all attributes
Element[] Elements Returns a list of all elements
ComplexType BaseType Returns the base type of this type
string LocalName Returns the local name of the type
string NamespaceURI Returns the namespace URI of the type
XmlQualifiedName QualifiedName Returns the qualified name of this type
SimpleType ContentType Returns the simple type of the content
Element FindElement(string localName, string Finds the element with the specified local name
namespaceURI) and namespace URI
Attribute FindAttribute(string localName, Finds the attribute with the specified local name
string namespaceURI) and namespace URI
Altova.Xml.Meta.Element
Method/Property Purpose
ComplexType DataType Returns the type of the element. Note that this
is always a complex type even if declared as
simple in the original schema. Use the
ContentType property of the returned object to
get the simple content type.
int MinOccurs Returns the minOccurs value defined in the
schema
int MaxOccurs Returns the maxOccurs value defined in the
schema
string LocalName Returns the local name of the element
string NamespaceURI Returns the namespace URI of the element
XmlQualifiedName QualifiedName Returns the qualified name of the element
Altova.Xml.Meta.Attribute
Method/Property Purpose
SimpleType DataType Returns the type of the attribute content
bool Required() Returns true if the attribute is required
string LocalName Returns the local name of the attribute
string NamespaceURI Returns the namespace URI of the attribute
XmlQualifiedName QualifiedName Returns the qualified name of the attribute
The following chapters describe usage of the generated classes when using one of the following
compatibility options:
Please note that these compatibility options will be removed in a future version.
Version 2005r3:
Code generated code for XML schemas up till V2005R3 uses a static DOM document instance
as parent for all nodes. This allows creating free-standing nodes that can be added to a
document later, but may rise issues with multi-threading or memory management.
{
LibraryTypel
i
b=new LibraryType();
BookType book = new BookType();
book.addISBN(new Schem aString("0764549642"));
book.addTitle(new Schem aString("The XM L SpyHandbook"));
book.addAuthor(new Schem aStri ng("Al
tova"));
li
b.addBook(book);
Li
braryDocdoc=new Li braryDoc();
doc.setRootEl em entNam e("http://www.nanonul l
.com /Li
brarySam pl
e","Li
brary");
doc.setSchem aLocati on("Li
brary.xsd");//opti
onal
doc.save("Li
brary1.xml
",l
i
b);
}
Version 2007r3:
The code generated by version 2007r3 has been completely redesigned to allow for
multi-threading, avoid name collisions, and simplify the usage of the libraries. For details, see
Using the generated code library.
Java:
To give a general overview, here is the code to create a test file:
doc.setSchemaLocation( "Library.xsd" );
We create the root element, passing to the method the document object that we have already
generated, the namespace of library.xsd, and the name of the root element in the schema:
We now have a new Library object. All we have to do is fill it with Book objects. Look at the
schema again and notice that books are stored as a sequence within the Library.
The next step is to make an object of BookType and fill the new object.
<xs:complexType name="BookType">
<xs:sequence>
<xs:element name="Title" type="xs:string"/>
<xs:element name="Author" type="xs:string" maxOccurs="unbounded"/>
</xs:sequence>
<xs:attribute name="ISBN" type="xs:string" use="required"/>
</xs:complexType>
We filled the BookType object, and we now have to add it to the library sequence:
lib.addBook(book);
Finally, save the file. The first parameter is the file name, the second is the root element itself.
C++:
The C++ implementation is very similar to the Java one, we will therefore only discuss the
differences between the two.
void Example()
{
CLibraryDoc doc;
CLibraryType lib;
doc.SetRootElementName(_T("http://www.nanonull.com/LibrarySample"), _T(
"Library"));
doc.SetSchemaLocation(_T("Library.xsd")); // optional
CBookType book;
book.AddISBN( _T("0764549642") );
book.AddTitle( _T("The XML Spy Handbook") );
book.AddAuthor( _T("Altova") );
lib.AddBook( book );
doc.Save(_T("Library1.xml"), lib);
First off, you'll notice that all classes begin with a capital C - the rest of the class naming stays
the same. All member function names start with a capital letter.
Please take care with the _T macros. The macro ensures that the string constant is stored
correctly, whether you're compiling for Unicode or non-Unicode programs.
C#:
protected static void Example()
{
LibraryDoc doc = new LibraryDoc();
doc.SetSchemaLocation( "Library.xsd" ); // optional
// create root element with no namespace prefix
LibraryType lib = new LibraryType(doc, "
http://www.nanonull.com/LibrarySample", "", "Library" );
BookType book = lib.NewBook(); // factory functions are generated for all
members of a complex type
book.AddISBN( new SchemaString( "0764549642" ) );
book.AddTitle( new SchemaString( "The XML Spy Handbook" ) );
book.AddAuthor( new SchemaString( "Altova" ) );
lib.AddBook( book );
doc.Save( "Library1.xml", lib );
}
Java:
To give a general overview, here is the code to create a test file:
We now have a new Library object. All we have to do is fill it with Book objects. Look at the
schema again and notice that books are stored as a sequence within the Library.
The next step is to make an object of BookType and fill the new object.
<xs:complexType name="BookType">
<xs:sequence>
<xs:element name="Title" type="xs:string"/>
<xs:element name="Author" type="xs:string" maxOccurs="unbounded"/>
</xs:sequence>
<xs:attribute name="ISBN" type="xs:string" use="required"/>
</xs:complexType>
We filled the BookType object, and we now have to add it to the sequence of
internationalPriceTypes within Test_Empty:
lib.addBook(book);
Done, the tree is complete! All we have to do now, is create a new document and define the
namespace and name of the root element:
doc.setSchemaLocation( "Library.xsd" );
Finally, save the file, - the first parameter is the file name, the second is the root element itself.
C++:
The C++ implementation is very similar to the Java one, we will therefore only discuss the
differences between the two.
void Example()
{
CLibraryType lib;
CBookType book;
book.AddISBN( _T("0764549642") );
book.AddTitle( _T("The XML Spy Handbook") );
book.AddAuthor( _T("Altova") );
lib.AddBook( book );
CLibraryDoc doc;
doc.SetRootElementName( _T("http://www.nanonull.com/LibrarySample"), _T(
"Library") );
doc.SetSchemaLocation( _T("Library.xsd") ); // optional
doc.Save( _T("Library1.xml"), lib );
}
First off, you'll notice that all classes begin with a capital C - the rest of the class naming stays
the same. All member function names start with a capital letter.
Please take care with the _T macros. The macro ensures that the string constant, is stored
correctly, whether you're compiling for Unicode or non Unicode programs.
C#:
protected static void Example()
{
LibraryType lib = new LibraryType();
BookType book = new BookType();
book.AddISBN( new SchemaString( "0764549642" ) );
book.AddTitle( new SchemaString( "The XML Spy Handbook" ) );
book.AddAuthor( new SchemaString( "Altova" ) );
lib.AddBook( book );
We will now use the Library1.xml file generated with our sample program. Please make sure
that this file exists, or change the path to it in the load command.
Java:
Sample source code:
if (!lib.hasBook()) {
System.out.println("This library is empty");
return;
}
We now have a document and know that lib contains a sequence of BookType objects.
The next step is to dump the values of all of the Book elements:
if( !lib.hasBook() ) {
Why check for objects? The call just shows that a function exists that checks this for you.
We're finished, all the values are listed in your output window.
C++:
This section only explains the differences to the java code.
void Example2()
{
CLibraryDoc doc;
CLibraryType lib = doc.Load( _T("Library1.xml") );
if ( !lib.HasBook() )
{
cout << "This library is empty" << endl;
return;
}
All member functions start with a capital letter, and all class names start with a C.
C#:
This section only explains the differences to the java code.
if ( !lib.HasBook() )
{
Console.WriteLine( "This library is empty" );
return;
}
}
}
}
We will now use the Library1.xml file generated with our sample program. Please make sure
that this file exists, or change the path to it in the load command.
Java:
Sample source code:
if( !lib.hasBook() ) {
System.out.println( "This library is empty" );
return;
}
We now have a document and know that lib contains a sequence of BookType objects.
The next step is to dump the values of all of the Book elements:
if( !lib.hasBook() ) {
Why check for objects? The call just shows that a function exists, that checks this for you.
We're finished, all the values are listed in your output window.
C++:
This section only explains the differences to the java code.
void Example2()
{
CLibraryDoc doc;
CLibraryType lib = doc.Load( _T("Library1.xml") );
if( !lib.HasBook() )
{
cout << "This library is empty" << endl;
return;
}
All member functions start with a capital letter, and all Classnames start with a C.
C#:
This section only explains the differences to the java code.
{
LibraryDoc doc = new LibraryDoc();
LibraryType lib = new LibraryType( doc.Load( "Library1.xml" ) );
if( !lib.HasBook() )
{
Console.WriteLine( "This library is empty" );
return;
}
Add the environment variable ANT_OPTS, which sets specific Ant options such as the
memory to be allocated to the compiler, and add values as shown below.
You may need to customize the values depending on the amount of memory in your machine
and the size of the project you are working with. For more details please see your Java VM
documentation.
Simple types
Built-in XML Schema types: Mapped to native primitive types or classes in the Altova
types library
Derived by extension
Derived by restriction
Facets
Enumerations
Patterns
Complex types
Built-in anyType node
User-defined complex types
Derived by extension: Mapped to derived classes
Derived by restriction
Complex content
Simple content
Mixed content
The following advanced XML Schema features are not, or not fully supported in MapForce,
when generating optional wrapper classes:
* Wildcards: xs:any and xs:anyAttribute
Content models (sequence, choice, all): Top-level compositor available in SPL, but not
enforced by generated classes
default and fixed values for attributes: Available in SPL, but not set or enforced by
generated classes
attributes xsi:type, abstract types: SetXsiType methods are generated and need to be
called by the user
Union types: Not all combinations are supported
Substitution groups: Partial support (resolved like "choice")
attribute nillable="true" and xsi:nil
uniqueness constraints
key and keyref
C# Settings tab:
C#
Select the type of project file you want to generate:
Microsoft Visual Studio 2010, 2008, 2005, project file
Mono Makefile support was removed in MapForce version 2011. Mono users can use
Visual Studio solution files with Mono's xbuild.
Compatibility Mode:
The code generator has been improved multiple times in the recent releases of Altova products,
sometimes in ways that require changes to the code that uses the generated libraries. To
preserve compatibility with existing code using libraries generated with earlier releases of
XMLSpy, you can set the compatibility mode to the desired release. Default is version 2007r3,
which creates the latest version of the code libraries.
Please make it a point to use the new code generation features i.e., set the version to
the latest available.
The availability of the Compatibility Mode is only temporary, it will be removed in a
future version.
It is assumed that you have prior programming experience, and are familiar with operators,
functions, variables and classes, as well as the basics of object-oriented programming - which
is used heavily in SPL. You should also have detailed knowledge of XML Schema.
The templates used by XMLSpy are supplied in the ...\XMLSpy2011\spl folder. You can use
these files as an aid to help you in developing your own templates.
The template file is interpreted by the code generator and outputs .cpp, .java, .cs source code
files, project files, or any other type of file depending on the template. The source code can then
be compiled into an executable file that accesses XML data described by the schema file.
SPL files have access to a wide variety of information that is collated from the source schemas.
Please note that an SPL file is not tied to a specific schema, but allows access to all schemas!
Make sure you write your SPL files generically, avoid structures etc. which apply to specific
schemas!
This is a very basic SPL file. It creates a file named test.cpp, and places the include statement
within it. The close command completes the template.
Code generator instructions are enclosed in square brackets '[' and ']'.
Multiple statements can be included in a bracket pair. Additional statements have to be
separated by a new line or a colon ':'.
or
[$x = 42: $x = $x + 1]
Comments
Comments inside an instruction block always begin with a ' character, and terminate on the next
line, or at a block close character ].
20.7.2 Declarations
The following statements are evaluated while parsing the SPL template file. They are not
affected by flow control statements like conditions, loops or subroutines, and are always
evaluated exactly once.
These keywords, like all keywords in SPL, are not case sensitive.
Remember that all of these declarations must be inside a block delimited by square brackets.
The specified built-in XML Schema type will be mapped to the specified native type or class,
using the specified formatter. This setting applies only to code generation for version 2007r3
and higher. Typespec is a native type or class name, followed by a comma, followed by the
formatter class instance.
Example:
map schemanativetype "double" to "double,Altova::DoubleFormatter"
Example:
map type "float" to "CSchemaFloat"
Example:
default "InvalidCharReplacement" is "_"
* Names of anonymous types are built from AnonTypePrefix + element name + AnonTypeSuffix
reserve word
Adds the specified word to the list of reserved words. This ensures that it will never be
generated as a class or member name.
Example:
reserve "while"
include filename
Example:
include "Module.cpp"
includes the specified file as SPL source. This allows you to split your template into multiple files
for easier editing and handling.
20.7.3 Variables
Any non-trivial SPL file will require variables. Some variables are predefined by the code
generator, and new variables may be created simply by assigning values to them.
The $ character is used when declaring or using a variable, a variable name is always prefixed
by $.
Variable names are case sensitive.
Variables types:
integer - also used as boolean, where 0 is false and everything else is true
string
object - provided by XMLSpy
iterator - see foreach statement
[$x = "teststring"]
x is now treated as a string.
Strings
String constants are always enclosed in double quotes, like in the example above. \n and \t
inside double quotes are interpreted as newline and tab, \" is a literal double quote, and \\ is a
backslash. String constants can also span multiple lines.
Objects
Objects represent the information contained in the XML schema. Objects have properties,
which can be accessed using the . operator. It is not possible to create new objects in SPL (they
are predefined by the code generator, derived from the input schema), but it is possible to
assign objects to variables.
Example:
class [=$class.Name]
This example outputs the word "class", followed by a space and the value of the Name property
of the $class object.
Current object model (for code compatibility to version 2007r3 and later)
create filename
creates a new file. The file has to be closed with the close statement. All following output is
written to the specified file.
Example:
[create $outputpath & "/" & $JavaPackageDir & "/" & $application.Name &
".java"]
package [=$JavaPackageName];
close
closes the current output file.
=$variable
writes the value of the specified variable to the current output file.
Example:
[$x = 20+3]
The result of your calculation is [=$x] - so have a nice day!
- The file output will be:
The result of your calculation is 23 - so have a nice day!
write string
writes the string to the current output file.
Example:
[write "C" & $name]
Example:
filecopy "java/mapforce/mapforce.png" to $outputpath & "/" & $JavaPackageDir &
"/mapforce.png"
20.7.6 Operators
Operators in SPL work like in most other programming languages.
* Multiply
/ Divide
% Modulo
+ Add
- Subtract
= Equal
<> Not equal
= Assignment
20.7.7 Conditions
SPL allows you to use standard "if" statements. The syntax is as follows:
if condition
statements
else
statements
endif
Please note that there are no round brackets enclosing the condition!
As in any other programming language, conditions are constructed with logical and comparison
operators.
Example:
[if $namespace.ContainsPublicClasses and $namespace.Prefix <> ""]
whatever you want ['inserts whatever you want, in the resulting file]
[endif]
Switch
SPL also contains a multiple choice statement.
Syntax:
switch $variable
case X:
statements
case Y:
case Z:
statements
default:
statements
endswitch
20.7.8 foreach
Collections and iterators
A collection contains multiple objects - like a ordinary array. Iterators solve the problem of
storing and incrementing array indexes when accessing objects.
Syntax:
foreach iterator in collection
statements
next
Example:
[foreach $class in $classes
if not $class.IsInternal
] class [=$class.Name];
[ endif
next]
Foreach steps through all the items in $classes, and executes the code following the
instruction, up to the next statement, for each of them.
In each iteration, $class is assigned to the next class object. You simply work with the class
object instead of using, classes[i]->Name(), as you would in C++.
Current The current object (this is implicit if not specified and can be left out)
Example:
[foreach $enum in $facet.Enumeration
if not $enum.IsFirst
], [
endif
]"[=$enum.Value]"[
next]
20.7.9 Subroutines
Code generator supports subroutines in the form of procedures or functions.
Features:
By-value and by-reference passing of values
Local/global parameters (local within subroutines)
Local variables
Recursive invocation (subroutines may call themselves)
Subroutine declaration
Subroutines
Syntax example:
Sub SimpleSub()
... lines of code
EndSub
Please note:
Recursive or cascaded subroutine declaration is not permitted, i.e. a subroutine may
not contain another subroutine.
Parameters
Parameters can also be passed by procedures using the following syntax:
All parameters must be variables
Variables must be prefixed by the $ character
Local variables are defined in a subroutine
Global variables are declared explicitly, outside of subroutines
Multiple parameters are separated by the comma character "," within round
parentheses
Parameters can pass values
Syntax:
' define sub CompleteSub()
[Sub CompleteSub( $param, ByVal $paramByValue, ByRef $paramByRef )
] ...
ByVal specifies that the parameter is passed by value. Note that most objects can only
be passed by reference.
ByRef specifies that the parameter is passed by reference. This is the default if neither
ByVal nor ByRef is specified.
Example:
' define a function
[Sub MakeQualifiedName( ByVal $namespacePrefix, ByVal $localName )
if $namespacePrefix = ""
return $localName
else
return $namespacePrefix & ":" & $localName
endif
EndSub
]
Subroutine invocation
Use call to invoke a subroutine, followed by the procedure name and parameters, if any.
Call SimpleSub()
or,
Call CompleteSub( "FirstParameter", $ParamByValue, $ParamByRef )
Function invocation
To invoke a function (any subroutine that contains a return statement), simply use its name
inside an expression. Do not use the call statement to call functions.
Example:
$QName = MakeQualifiedName($namespace, "entry")
Subroutine example
Highlighted example showing subroutine declaration and invocation.
Library
This object represents the whole library generated from the XML Schema or DTD.
Namespace
One namespace object per XML Schema namespace is generated. Schema components that
are not in any namespace are contained in a special namespace object with an empty
NamespaceURI.
Note that for DTD, namespaces are also derived from attributes whose names begin with
"xmlns".
Type
This object represents a complex or simple type. It is used to generate a class in the target
language.
There is one additional type per library that represents the document, which has all possible root
elements as members.
Anonymous types have an empty LocalName.
* Complex types with text content (these are types with mixed content and complexType with
simpleContent) have an additional unnamed attribute member that represents the text content.
Member
This object represents an attribute or element in the XML Schema. It is used to create class
members of types.
NativeBinding
This object represents the binding of a simple type to a native type in the target programming
language, as specified by the "schemanativetype" map.
Facets
This object represents all facets of a simple type.
Inherited facets are merged with the explicitly declared facets. If a Length facet is in effect,
MinLength and MaxLength are set to the same value.
Facet
This object represents a single facet with its computed value effective for a specific type.
Namespace
Namespace abstraction. This object is part of the old object model for code compatibility up to
version 2007.
Class
For every user-defined type declared in the schema (xsd) a class is generated. This object is
part of the old object model for code compatibility up to version 2007.
Member
Abstraction of a member-variable inside a class. Members are created for all children of a
complex type. This object is part of the old object model for code compatibility up to version
2007.
IsBuiltinType boolean True if the type is a built-in schema type, e.g. string,
unsignedInt, dateTime... It is the negation of
HasTypeObject.
IsSimpleType boolean True if the type of this member is a simpleType
IsComplexFromSimpleTyp boolean True if the type of this member is a complex type and is
e derived from a simple type.
IsElement boolean True if this is an element
IsAttribute boolean True if this is an attribute
NodeType string "Element" or "Attribute"
MinOcc integer minOccurs, as in schema. 1 for required attributes
MaxOcc integer maxOccurs, as in schema. 0 for prohibited attributes
IsQualified boolean True if the form of the Element/Attribute is set to
"qualified".
IsMixed boolean True if this element can have mixed content
HasTextValue boolean True if this member can contain text
Default string The default value defined in the schema
Fixed string The fixed value defined in the schema
* TypeObject:
For every type declared in the schema (xsd) a class is generated. All elements inside a
complexType are generated as members of such classes. The types of these members can
either be built-in types or user-defined types:
Built-in XML Schema types have no TypeObject, because they are mapped to predefined
classes using the map type instruction.
For each member with a user-defined type, the TypeObject represents the class generated for
this type.
Example:
<xs:complexType name="TypeA">
<xs:sequence>
<xs:element name="B" type="TypeB"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="TypeB"/>
class TypeA
{
...
TypeB B;
}
class TypeB
{
...
}
Explanation:
When class "TypeA" is generated the member B is also generated. To find out the type of B,
use the "TypeObject" method of the element which returns the class "TypeB". So we can get the
name and use it there.
Facet
This class consists of the constraint itself, and several boolean variables. This object is part of
the old object model for code compatibility up to version 2007.
The boolean variables tell you the kind of constraint you're currently dealing with. The names of
the Boolean variables are identical to those used in the schema specification.
Enumeration
Abstraction of an enumeration entry inside a facet. This object is part of the old object model for
code compatibility up to version 2007.
Pattern
Abstraction of a pattern entry inside a facet. This object is part of the old object model for code
compatibility up to version 2007.
21 User Reference
The User Reference section contains a complete description of all XMLSpy menu commands
and explains their use in general. We have tried to be comprehensive. If, however, you have
questions which are not covered in the User Reference or other parts of this documentation,
please look up the FAQs and Discussion Forums on the Altova website. If you cannot find a
suitable answer at these locations, please do not hesitate to contact the Altova Support Center.
Standard Windows commands, such as (Open, Save, Cut, Copy and Paste) are in the File
and Edit menus. These menus additionally contain XML- and Internet-related commands.
In addition to the standard New, Open, Save, Print, Print Setup, and Exit commands, XMLSpy
offers a range of XML- and application-specific commands.
21.1.1 New
Ctrl+N
The New command is used to create a new document. Clicking New opens the Create New
Document dialog, in which you can select the type of document you wish to create. If the
document type you wish to create is not listed, select XML and change the file extension when
you save the file. Note that you can add new file types to the list in this dialog using the Tools |
Options | File types tab.
Do the following:
1. Open the XMLSpy\Template folder using Windows Explorer or your preferred
navigation tool, and select a rudimentary template file from among the files named
new.xxx (where .xxx is a file extension, such as .xml and .xslt).
2. Open the file in XMLSpy, and modify the file as required. This file will be the template
file.
3. When you are done, select File | Save as... to save the file back to the \Template
folder with a suitable name, say my-xml.xml. You now have a template called
my-xml, which will appear in the list of files in the Create New Document dialog.
4. To open the template, select File | New, and then the template (my-xml, in this case).
Please note: To delete a template, delete the template file from the template folder.
If you are creating a new file for which the schema is not known (for example, an XML file), then
you are prompted to associate a schema (DTD or XML Schema) with the document that is to be
created.
If you choose to associate a DTD or XML Schema with your document, clicking OK in the New
File dialog enables you to browse for the schema. Clicking Cancel in this dialog will create a
new file that is not associated with any schema.
If you select an XML Schema, there can be more than one global element in it, all of which are
potential document (or root) elements. You can select which of these is to be the root element
of the XML document in the Select a Root Element dialog, which pops up if you select Schema
in the New File dialog and if the XML Schema has more than one global element.
The new XML document is created with this element as its document element.
You can browse for the required StyleVision Power Stylesheet in the folder tabs displayed in the
New dialog. Alternatively, you can click the Browse button to navigate for and select the
StyleVision Power Stylesheet. The tabs that appear in the New dialog correspond to folders in
the sps/Template folder of your application folder.
21.1.2 Open
Ctrl+O
The Open command pops up the familiar Windows Open dialog, and allows you to open any
XML-related document or text document. In the Open dialog, you can select more than one file
to open. Use the Files of Type combo box to restrict the kind of files displayed in the dialog box.
(The list of available file types can be configured in the File Types tab of the Options dialog (
Tools | Options). When an XML file is opened, it is checked for well-formedness. If the file is
not well-formed, you will get a file-not-well-formed error. Fix the error and select the menu
command XML | Check Well-Formedness (F7) to recheck. If you have opted for automatic
validation upon opening and the file is invalid, you will get an error message. Fix the error and
select the menu command XML | Validate XML (F8) to revalidate.
1. Click the Switch to URL command. This switches to the URL mode of the Open dialog
(screenshot below).
2. Enter the URL you want to access in the Server URL field (screenshot above). If the
server is a Microsoft® SharePoint® Server, check the Microsoft® SharePoint® Server
check box. See the Microsoft® SharePoint® Server Notes below for further information
about working with files on this type of server.
3. If the server is password protected, enter your User-ID and password in the User and
Password fields.
4. Click Browse to view and navigate the directory structure of the server.
5. In the folder tree, browse for the file you want to load and click it.
The file URL appears in the File URL field (screenshot above). The Open button only
becomes active at this point.
6. Click the Open button to load the file. The file you open appears in the main window.
Note: The Browse function is only available on servers which support WebDAV and on
Microsoft SharePoint Servers. The supported protocols are FTP, HTTP, and HTTPS.
Note: To give you more control over the loading process, you can choose to load the file
through the local cache or a proxy server (which considerably speeds up the process if
the file has been loaded before). Alternatively, you may want to reload the file if you are
working, say, with an electronic publishing or database system; select the Reload
option in this case
In the directory structure that appears in the Available Files pane (screenshot below),
file icons have symbols that indicate the check-in/check-out status of files.
Right-clicking a file pops up a context menu containing commands available for that file
(screenshot above).
The various file icons are shown below:
After you check out a file, you can edit it in your Altova application and save it using File
| Save (Ctrl+S).
You can check-in the edited file via the context menu in the Open URL dialog (see
screenshot above), or via the context menu that pops up when you click the file tab in
the Main Window of your application (screenshot below).
When a file is checked out by another user, it is not available for check out.
When a file is checked out locally by you, you can undo the check-out with the Undo
Check-Out command in the context menu. This has the effect of returning the file
unchanged to the server.
If you check out a file in one Altova application, you cannot check it out in another
Altova application. The file is considered to be already checked out to you. The
available commands at this point in any Altova application supporting Microsoft®
SharePoint® Server will be: Check In and Undo Check Out.
21.1.3 Reload
The Reload command allows you to reload open documents. This is useful if an open
document has been modified outside XMLSpy. If a modification occurs, XMLSpy asks whether
you wish to reload the file. If you reload, then any changes you may have made to the file since
the last save will be lost. This option can be changed in the Options dialog (Tools | Options).
21.1.4 Encoding
The Encoding command lets you view the current encoding of the active document (XML or
non-XML) and to select a different encoding with which the active document will be saved the
next time.
In XML documents, if you select a different encoding than the one in use before, the encoding
specification in the XML declaration will be adjusted accordingly. For two-byte and four-byte
character encodings (UTF-16, UCS-2, and UCS-4) you can also specify the byte-order to be
used for the file. Another way to change the encoding of an XML document is to directly edit the
encoding attribute of the document's XML declaration.
Default encodings for existing and new XML and non-XML documents can be set in the
Encoding tab of the Options dialog.
Note: When saving a document, XMLSpy automatically checks the encoding specification
and opens a dialog box if it cannot recognize the encoding entered by the user. Also, if
your document contains characters that cannot be represented in the selected
encoding, you will get a warning message when you save your file.
The Close All command closes all open document windows. If any document has been
modified (indicated by an asterisk * after the file name in the title bar), you will be asked if you
wish to save the file first.
The Save As command pops up the familiar Windows Save As dialog box, in which you enter
the name and location of the file you wish to save the active file as. The same checks and
validations occur as for the Save command.
The Save All command saves all modifications that have been made to any open
documents. The command is useful if you edit multiple documents simultaneously. If a
document has not been saved before (for example, after being newly created), the Save As
dialog box is presented for that document.
2. Enter the URL you want to access in the Server URL field (screenshot above). If the
server is a Microsoft® SharePoint® Server, check the Microsoft® SharePoint® Server
check box. See the Microsoft® SharePoint® Server Notes below for further information
about working with files on this type of server.
3. If the server is password protected, enter your User-ID and password in the User and
Password fields.
4. Click Browse to view and navigate the directory structure of the server.
5. In the folder tree, browse for the file you want to load and click it.
The file URL appears in the File URL field (screenshot above). The Open button only
becomes active at this point.
6. Click the Open button to load the file. The file you open appears in the main window.
Note: The Browse function is only available on servers which support WebDAV and on
Microsoft SharePoint Servers. The supported protocols are FTP, HTTP, and HTTPS.
Note: To give you more control over the loading process, you can choose to load the file
through the local cache or a proxy server (which considerably speeds up the process if
the file has been loaded before). Alternatively, you may want to reload the file if you are
working, say, with an electronic publishing or database system; select the Reload
option in this case
In the directory structure that appears in the Available Files pane (screenshot below),
file icons have symbols that indicate the check-in/check-out status of files.
Right-clicking a file pops up a context menu containing commands available for that file
(screenshot above).
The various file icons are shown below:
After you check out a file, you can edit it in your Altova application and save it using File
| Save (Ctrl+S).
You can check-in the edited file via the context menu in the Open URL dialog (see
screenshot above), or via the context menu that pops up when you click the file tab in
the Main Window of your application (screenshot below).
When a file is checked out by another user, it is not available for check out.
When a file is checked out locally by you, you can undo the check-out with the Undo
Check-Out command in the context menu. This has the effect of returning the file
unchanged to the server.
If you check out a file in one Altova application, you cannot check it out in another
Altova application. The file is considered to be already checked out to you. The
available commands at this point in any Altova application supporting Microsoft®
SharePoint® Server will be: Check In and Undo Check Out.
The Send by Mail... command lets you send XML document/s or selections from an XML
document by e-mail. You can do any of the following:
Send an XML document as an attachment or as the content of an e-mail.
Send a selection in an XML document as an attachment or as the content of an e-mail.
Send a group of files (selected in the Project Window) as an attachment to an e-mail.
Send a URL (selected in the Project Window) as an attachment or as a link.
Please note: To use this function you must have a MAPI compliant e-mail system.
3. Make the required choices and click OK. The selected documents/contents/URLs are
attached to the e-mail or content is inserted into the e-mail.
21.1.8 Print
Ctrl+P
The Print command opens the Print dialog box, in which you can select printer options. The
currently active document, as seen in the current view, can then be printed.
Clicking the Print command in Grid View opens a Print options dialog (screenshot below),
which enables you to set printing options for the XML document. Clicking Print in this dialog
takes you to the Print dialog for printer options.
The available options for Grid View printing are described below:
In the Types pane, you select the items you wish to have appear in the output.
For the What option, you specify whether the current selection or the entire file is to be
printed.
The Expand option allows you to print the document as is, or with all descendant
elements expanded fully.
The Contents option enables you to choose between printing contents of all nodes or
printing node names only.
In the If Contents Are Wider Than Page pane, you select what to do if contents are
wider than the page. The Split Pages option prints the entire document at normal size,
splitting contents over pages both horizontally and vertically. The pages could then be
glued together to form a poster. The First Page option prints only the first, left-hand
page of the print area. The area that overflows horizontally is not printed. This option is
useful if most of the important information in your Grid View of the document is
contained on the left side. The Shrink Horizontally option reduces the size of the output
(proportionally) until it fits horizontally on the page; the document may run on for several
pages. The Shrink Both option shrinks the document in both directions until it fits
exactly on one sheet.
The Print button prints the document with the selected options.
The Preview button opens a print preview window that lets you view the final output
before committing it to paper.
The Print Setup button opens the Print Setup dialog box and allows you to adjust the
paper format, orientation, and other printer options for this print job only. Also see the
Print Setup command.
Note: You can change column widths in Grid View to optimize the print output.
The preview can be magnified or miniaturized using the the Zoom In and Zoom Out buttons.
When the page magnification is such that an entire page length fits in a preview window, then
the One Page / Two Page button toggles the preview to one or two pages at a time. The Next
Page and Previous Page buttons can be used to navigate among the pages. The toolbar also
contains buttons to print all pages and to close the preview window.
The Print Setup command, displays the printer-specific Print Setup dialog box, in which you
specify such printer settings as paper format and page orientation. These settings are applied to
all subsequent print jobs.
The screenshot above shows the Print Setup dialog in which an HP LaserJet 4 printer attached
to a parallel port (LPT1) is selected.
The Exit command is used to quit XMLSpy. If you have any open files with unsaved changes,
you are prompted to save these changes. XMLSpy also saves modifications to program settings
and information about the most recently used files.
In addition to the standard Undo, Redo, Cut, Copy, Paste, Delete, Select All, Find, Find next
and Replace commands, XMLSpy offers special commands to:
copy the selection to the clipboard as XML-Text,
copy as structured text
copy an XPath selector to the selected item to the clipboard.
insert and remove bookmarks, and to navigate to bookmarks.
The Redo (Ctrl+Y) command allows you to redo previously undone commands, thereby
giving you a complete history of work completed. You can step back and forward through this
history using the Undo and Redo commands.
The Copy (Ctrl+C) command copies the selected text or items to the clipboard. This can
be used to duplicate data within XMLSpy or to move data to another application.
Please note: There are two different commands for copying elements to the clipboard in textual
form: Copy as XML-Text and Copy as Structured Text. You can use the Editing tab on the Tools
| Options dialog to choose which of these two operations should be performed when using the
copy command.
The Paste (Ctrl+V) command inserts the contents of the clipboard at the current cursor
position.
The Delete (Del) command deletes the currently selected text or items without placing
them in the clipboard.
<row>
<para align="left">
<bold>Check the FAQ</bold>
</para>
<para>
<link mode="internal">
<link_section>support</link_section>
<link_subsection>faq30</link_subsection>
<link_text>XMLSPY 4.0 FAQ</link_text>
</link>
<link mode="internal">
<link_section>support</link_section>
<link_subsection>faq25</link_subsection>
<link_text>XMLSPY 3.5 FAQ</link_text>
</link>
</para>
</row>
The Copy as XML-Text command automatically formats text using the currently active settings
for saving a file. These settings can be modified in the Save File section of the File tab of the
Options dialog (Tools | Options).
If you copy this table and paste it into Excel, the data will appear in the following way:
Please note: The results of this command depend on the way the information is currently laid
out on screen. For example, if the XML fragment used as an example for the Copy as XML-Text
command were in the Table View of Grid View, the copied text would result in the following:
In normal Grid View, the data copied to the clipboard would look as below.
The required file can be selected in one of the following ways: (i) by browsing for the file, URL,
or global resource (use the Browse button); (ii) by selecting the window in which the file is open
(the Window button). When done, click OK. The path to the selected file will be inserted in the
active document at the cursor selection point.
The XML file to be included is entered in the href text box (alternatively, you can browse for the
file by clicking the Browse button to the right of the text box). The filename will be entered in the
XML document as the value of the href attribute. The encoding and parse attributes of the
XInclude element (xi:include), and the fallback child element of xi:include can also be
inserted via the dialog. Do this by first checking the appropriate check box and then selecting/
entering the required values.
Here is an example of an XML document that uses XInclude to include two XML documents:
<?xml version="1.0" encoding="UTF-16"?>
<AddressBook xsi:schemaLocation="http://www.altova.com/sv/myaddresses
AddressBook.xsd"
xmlns="http://www.altova.com/stylevision/tutorials/myaddresses"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xi="http://www.w3.org/2001/XInclude">
<xi:include href="BusinessAddressBook.xml"/>
<xi:include href="PersonalAddressBook.xml"/>
</AddressBook>
When this XML document is parsed, it will replace the two XInclude elements with the files
specified in the respective href attributes.
xml:base
When the XML validator of XMLSpy reads an XML document and encounters the include
element in the XInclude namespace (hereafter xi:include), it replaces this element (xi:
include) with the XML document named in the href attribute of the xi:include element. The
document element (root element) of the included XML document (or the element identified by
an XPointer) will be included with an attribute of xml:base in order to preserve the base URIs of
the included element. If the resulting XML document (containing the included XML document/s
or tree fragment/s) must be valid according to a schema, then the document element of the
included document (or the top-level element of the tree fragment) must be created with a
content model that allows an attribute of xml:base. If, according to the schema, the xml:base
attribute is not allowed on this element, then the resulting document will be invalid. How to
define an xml:base attribute in an element's content model using XMLSpy's Schema View is
described in the xml: Prefixed Attributes section of the Schema View section of the
documentation.
XPointers
XMLSpy supports XPointers in XInclude. The relevant W3C recommendations are the XPointer
Framework and XPointer element() Scheme recommendations. The use of an XPointer in an
XInclude element enables a specific part of the XML document to be included, instead of the
entire XML document. XPointers are used within an XInclude element as follows:
In the element() scheme of XPointer, an NCName or a child sequence directed by integers may
be used.
In the first xi:include element listed above, the xpointer attribute uses the element
scheme with an NCName of usa. According to the XPointer Framework, this NCName
identifies the element that has an ID of usa.
In the second xi:include listed above, the xpointer attribute with a value of element
(/1/1) identifies, in the first step, the first child element of the document root (which, if
the document is well-formed, will be its document (or root) element). In the second step,
the first child element of the element located in the previous step is located; in our
example, this would be the first child element of the document element.
The xpointer attribute of the third xi:include listed above uses a combination of
NCName and child sequence. This XPointer locates the first child element of the third
child element of the element having an ID of usa.
If you are not sure whether your first XPointer will work, you can back it up with a
second one as shown in the fourth xi:include listed above:
xpointer="element(usa)element(/1/1)". Here, if there is no element with an ID of
usa, the back-up XPointer specifies that the first child element of the document element
is to be selected. Additional backups are also allowed. Individual XPointers may not be
separated, or they may be separated by whitespace: for example,
xpointer="element(usa)element(addresses/1) element(/1/1)".
Note: The namespace binding context is not used in the element() scheme because the
element() scheme does not support qualified names.
The XPath expression is resolved differently in Grid View and Text View. In Grid View, if a
single element is highlighted, the XPath expression will select not that specific element but all
elements of that name at that hierarchical level of the document. In Text View that specific
element is selected. For example, if an element called LastName of the third Person element of
the second Company element is selected, the XPath expressions would be as follows:
Grid View: /Companies/Company/Person/LastName
Text View: /Companies/Company[2]/Person[3]/LastName
Note: In Grid View the Copy XPath command can also be accessed via the context menu.
The element() scheme of XPointer returns results in the form element(/1/3), which selects the
third child of the document element (or root element). You should note the following points:
Attributes cannot be represented using the element() scheme. If an attribute is selected,
the following happens: In Grid View, the Copy XPointer command is disabled; in Text
View, the XPointer of the element "parent" of that attribute is generated.
Multiple elements cannot be selected. If selected in Grid View, the Copy XPointer
command is disabled. In Text View, the XPointer of the parent element of the selection
is generated.
Note: In Grid View the Copy XPointer command can also be accessed via the context menu.
The Pretty-Print XML Text command reformats your XML document in Text View to give a
structured display of the document, indenting each deeper level in the hierarchy by an additional
amount of the specified indentation space. This enables a clearer view of the document
structure.
To switch on the pretty-printing option, check the Use Indentation check box in the View tab of
the Options dialog (Tools | Options). After pretty-printing has been switched on, clicking the
Pretty-Print XML Text command reformats the document with indentation that shows the
hierarchy. If the Use Indentation check box is unchecked, clicking the Pretty-Print XML Text
command causes all lines to be left-aligned.
The amount of indentation is specified in Tabs pane of the Text View Settings dialog.
Note: (1) The XML document must be well-formed for this command to work.
(2) Pretty-printing adds spaces or tabs to the document when the document is saved.
(3) If pretty-printing has been switched on (Tools | Options | View | Use Indentation)
and if you change from Text View to Grid View and back to Text View, then the
document will be pretty-printed automatically.
The Select All command selects the contents of the entire document.
Grid View
In Grid View, the following dialog box appears. The options available are described below.
Text View
In Text View, the following dialog box appears. The options available are described below.
Clicking the Advanced button opens the Types pane (screenshot below), in which you can
Please note:
The Find dialog is modeless, which means that it can remain open while you continue
to use Text View. Pressing Enter while the dialog box is open, closes the dialog box. If
text is marked prior to opening the dialog box, then the marked text is automatically
inserted into the Find What text box.
Once the Find dialog is closed, you can repeat the current search by pressing F3 for a
forward search, or Shift+F3 for a backward search.
The unfold button to the right of the Find What combo box, opens a secondary window
which you can use to enter regular expressions.
Regular expressions
You can use regular expressions to further refine your search criteria. A pop-up list is available
to help you build regular expressions. To access this list, click the > button to the right of the
input field for the search term.
Clicking on the required expression description inserts the corresponding expression syntax in
the input field. Given below is a list of regular expression syntax characters.
The Find Next command (F3) repeats the last Find command to search for the next
occurrence of the requested text.
21.2.12 Replace
Ctrl+H
The Replace command enables you to find and replace one text string with another text string.
It features the same options as the Find... command. Depending on the view you are using, the
Replace dialog displays different find options. You can replace each item individually, or you can
use the Replace All button to perform a global search-and-replace operation.
Grid View
The screenshot below shows the various find options.
Text view
In Text View, selecting the Replace... command opens the Find & Replace dialog shown below.
The options are the same as for the Find... dialog. The Replace In Selection only option carries
out the find and replace operation only within the text selection.
Clicking the Advanced button opens the Types options (see Find... for details).
Please note: When using the Replace all command, each replacement is recorded as a single
operation, so Replace all can be undone step-by-step.
Find criteria
There are two broad find criteria: (i) what to find, and (ii) where to look? For a description of how
to set the text that is to be searched (what to find), see the description of the Find command. If
the text entered in the Find What text box is a regular expression, then the Regular Expression
check box must be checked. An entry helper for regular expressions can be accessed by
clicking the button. The use of regular expressions for searching is explained in the section
about the Find command.
To specify what node types and parts of an XML document should be searched, check the
Advanced XML Search check box and then check the required node types.
You can specify what files should be searched by checking either the Only in Current File check
box or the Search on Disk check box. If you choose to search on disk, you can select a folder or
a project to search (after checking the Search On Disk check box). When a project folder is
selected, external folders added to the project can be skipped. The files to be searched can be
filtered by file extension and a star (xml* or xsl*, for example). The separator between two file
extensions can be a comma or a semi-colon (xml*;xsl*, for example). The star character can
also be used as a wildcard.
The instances of the Find string at all the search locations are listed in the Find in Files output
bar. Clicking on one of the listed items opens that file in Text View and highlights the item.
Replace
You should note that clicking the Replace button replaces all the instances of the Find string
with the Replace string. If Open Files On Replacing was checked in the Find in Files dialog,
then the file will be opened in Text View; otherwise the replacement is done silently. All the
replaced strings are listed in the Find in Files output bar. Clicking on one of the listed items
opens that file in Text View and highlights the item.
The Goto Next Bookmark command (F2) places the text cursor at the beginning of the
next bookmarked line. This command is only available in the Text View.
The Goto Previous Bookmark command (Shift+F2) places the text cursor at the
beginning of the previous bookmarked line. This command is only available in the Text View.
To comment out a block of text, select the text to be commented out and then select the
command Comment In/Out, either from the Edit menu or the context menu that you get on
right-clicking the selected text. The commented text will be grayed out (see screenshot below).
To uncomment a commented block of text, select the commented block excluding the
comment delimiters, and select the command Comment In/Out, either from the Edit menu or
the context menu that you get on right-clicking the selected text. The comment delimiters will be
removed and the text will no longer be grayed out.
Please note: Most project-related commands are also available in the context menu, which
appears when you right-click any item in the project window.
|-Folder1
| |
| |-Folder2
| |
| |-Folder3
| |
| |-Folder4
If your .spp file is located in Folder3, then references to files in Folder1 and Folder2 will
look something like this:
c:\Folder1\NameOfFile.ext
c:\Folder1\Folder2\NameOfFile.ext
References to files in Folder3 and Folder4 will look something like this:
.\NameOfFile.ext
.\Folder4\NameOfFile.ext
If you wish to ensure that all paths will be relative, save the .spp files in the root directory of
your working disk.
Drag-and-drop
In the Project window, a folder can be dragged to another folder or to another location within the
same folder. A file can be dragged to another folder, but cannot be moved within the same
folder (within which files are arranged alphabetically). Additionally, files and folders can be
dragged from Windows File Explorer to the Project window.
In other words, the directory where the project file is located, essentially represents the root
directory of the project within the source control repository. Files added from above it (the
project root directory) will be added to the XMLSpy project, but their location in the repository
may be an unexpected one—if they are allowed to be placed there at all.
For example, given the directory structure show above, if a project file is saved in Folder3 and
placed under source control:
Files added to Folder1 may not be placed under source control,
Files added to Folder2 are added to the root directory of the repository, instead of to the
project folder, but are still under source control,
Files located in Folder3 and Folder4 work as expected, and are placed under source
control.
The New Project command creates a new project in XMLSpy. If you are currently working with
another project, a prompt appears asking if you want to close all documents belonging to the
current project.
The Open Project... command opens an existing project in XMLSpy. If you are currently
working with another project, the previous project is closed first.
The Reload Project command reloads the current project from disk. If you are working in a
multi-user environment, it can sometimes become necessary to reload the project from disk,
because other users might have made changes to the project.
Please note: Project files (.spp files) are actually XML documents that you can edit like any
regular XML File.
The Save Project command saves the current project. You can also save a project by making
the project window active and clicking the icon.
Note: A source control project is not the same as a XMLSpy project. Source control projects
are directory dependent, whereas XMLSpyAuthentic Desktop projects are logical
constructions without direct directory dependence.
1. Select Project | Source Control | Open from Source Control. Enter your login details
in the Login dialog that appears.
2. The Create Local Project from SourceSafe dialog box appears (screenshot below).
Select the folder to contain the local project. This folder becomes the Working Folder or
Checkout Folder.
3. Select the source control project you want to download. If the folder you define does not
exist at the location, a dialog box opens prompting you to create it there. Click Yes to
confirm the new directory. The Open dialog now pops up (screenshot below).
4. Click the project file you want to create and click Open. The file opens in XMLSpy, and
the file is placed under source control. That it is under source control is indicated by the
lock symbol on the file icon in the Projects folder.
To provisionally disable source control for the project select No. To permanently disable source
control for the project select Yes.
Get
The Get command retrieves read-only copies of the selected files and places them in the
working folder. By default, the files are not checked-out for editing. To get a file, select it in the
Project window (multiple files can be selected) and then select the Get command. This pops up
the Get dialog (screenshot below). Check the files you want to get.
Select All
Selects all the files in the list box.
Advanced
Allows you to define the Replace writable and Set timestamp options in the respective combo
boxes.
The Make writable check box removes the read-only attribute of the retrieved files.
Get Folders
The Get Folders command retrieves read-only copies of files in the selected folders and places
them in the working folder. By default, the files are not checked-out for editing. To get a folder, s
elect it in the Project window and then select the Get Folders command. This pops up the Get
Folders dialog (screenshot below). Check the foldersyou want to get.
Select All
Selects all the files in the list box.
Advanced
Allows you to define the Replace writable and Set timestamp options in the respective combo
boxes.
The Make writable check box removes the read-only attribute of the retrieved files.
Check Out
The Check Out command checks out the latest version of the selected files and places writable
copies in the working directory. The files are flagged as checked out for all other users. To
check out files, do the following:
1. Select the file or folder you want to check out in the Model Tree.
2. Select Project | Source Control | Check Out.
3. In the Check Out dialog that pops up, select the files to check out, then click OK.
Advanced
Allows you to define the Replace writable and Set timestamp options in the respective combo
boxes.
The Make writable check box removes the read-only attribute of the retrieved files.
Check In
The Check In command checks in previously checked out files (that is, your locally updated
files) and places them in the source control database. To check in files, do the following:
1. Select the files in the Model Tree.
2. Select Project | Source Control | Check In.
3. In the Check In dialog that pops up, select the files to check in, then click OK.
The lock symbol denotes that the file/folder is under source control, but is currently not
checked out.
The Differences button is enabled when a line in the Files pane is selected. Clicking it
enables you to see differences between two file versions.
Check out of the following items can be undone: (i) single files (click on the required files; in the
Project window, Ctrl+Click); (ii) folders (click on the required folders; in the Project window,
Ctrl+Click).
Advanced
Allows you to define the Replace writable and Set timestamp options in the respective combo
boxes.
The Make writable check box removes the read-only attribute of the retrieved files.
The lock symbol now appears next to each of the files placed under source control. If
the files are checked out they will be shown with a red check symbol.
The following items can be removed from source control: (i) single files (click on the required
files; in the Project window, Ctrl+Click); (ii) folders (click on the required folders; in the Project
window, Ctrl+Click).
3. In the Files to share list box, select the file you want to share and click the Share
button. The file will be removed from the Files to share list.
4. Click the Close button to continue.
Show History
The Show History command displays the history of a file under source control and allows you
to view detailed history info of previous versions of a file, view differences and retrieve previous
versions of the file. To show the history of a file, do the following:
1. Click on the file in the Project window.
2. Select the menu option Project | Source control | Show History. A dialog box
prompting for more information may appear (this example uses MS Source-Safe).
This dialog box provides various way of comparing and getting specific versions of the
file in question. Double-clicking an entry in the list opens the History Details dialog box
for that file. The buttons in the dialog provide the following functionality:
Close: closes this dialog box.
View: opens a further dialog box in which you can select the type of viewer with
which you wish to see the file.
Details: opens a dialog box in which you can see the properties of the currently
active file.
Get: allows you to retrieve one of the previous versions of the file in the version list
and place it in the working directory.
Check Out: allows you to check out a previous version of the file.
Diff: opens the Difference options dialog box, which allows you to define the
difference options when viewing the differences between two file versions. Use
CTRL+Click to mark two file versions in this window, then click Diff to view the
differences between them.
Pin: pins or unpins a version of the file, allowing you to define the specific file version
to use when differencing two files.
Rollback: rolls back to the selected version of the file.
Report: Generates a history report which you can send to the printer, file, or
clipboard.
Help: opens the online help of the source control provider plugin.
Show Differences
The Show Differences command displays the differences between the file currently in the
source control repository and the checked in/out file of the same name in the working
directory. If you have "pinned" one of the files in the history dialog box, then the pinned file will
be used in the "Compare" text box. Any two files can be selected using the Browse buttons.
The differences between the two files are highlighted in both windows (this example
uses MS Source-Safe).
Show Properties
The Show Properties command displays the properties of the currently selected file (
screenshot below). The properties displayed depends on the source control provider you use.
Refresh Status
The Refresh Status command refreshes the status of all project files independent of their
current status.
The Project | Add Files to Project... command adds files to the current project. Use this
command to add files to any folder in your project. You can either select a single file or any
group of files (using Ctrl+ click) in the Open dialog box. If you are adding files to the project,
they will be distributed among the respective folders based on the File Type Extensions defined
in the Project Properties dialog box.
The Project | Add URL to Project... command adds a URL to the current project. URLs in a
project cause the target object of the URL to be included in the project. Whenever a batch
operation is performed on a URL or on a folder that contains a URL object, XMLSpy retrieves
the document from the URL, and performs the requested operation.
The Project | Add Active File to Project command adds the active file to the current project. If
you have just opened a file from your hard disk or through an URL, you can add the file to the
current project using this command.
The Project | Add Active and Related Files to Project command adds the currently active
XML document and all related files to the project. When working on an XML document that is
based on a DTD or Schema, this command adds not only the XML document but also all
related files (for example, the DTD and all external parsed entities to which the DTD refers) to
the current project.
Please note: Files referenced by processing instructions (such as XSLT files) are not
considered to be related files.
The Project | Add Project Folder to Project... command adds a new folder to the current
project. Use this command to add a new folder to the current project or a sub-folder to a project
folder. You can also access this command from the context-menu when you right-click on a
folder in the project window.
Note: A project folder can be dragged and dropped into another project folder or to any other
location in the project. Also, a folder can be dragged from Windows (File) Explorer and
dropped into any project folder.
2. Click in the File extensions field and enter the file extensions of the file types you want
to see. You can separate each file type with a semicolon to define multiple types (XML
The Project window now only shows the XML and XSD files of the tutorial folder.
2. Click the folder and click the Check well-formedness or Validate icon
(hotkeys F7 or F8). All the files visible under the folder are checked.
If a file is malformed or invalid, then this file is opened in the Main Window, allowing you
to edit it. In this case the CompanyLast file is opened because the PhoneExt value does
not match the facet defined in the underlying schema file. This schema only allows
two-digit numbers.
3. Correct the error and restart the process to recheck the rest of the folder.
Please note: You can select discontinuous files in the folder, by holding down CTRL and
clicking the files singly. Only these files are then checked when you click F7 or F8.
Note: A project folder can be dragged and dropped into another project folder or to any other
location in the project. Also, a folder can be dragged from Windows (File) Explorer and
dropped into any project folder.
2. Click in the Server URL field and enter the URL of the server URL. If the server is a
Microsoft® SharePoint® Server, check this option. See the Folders on a Microsoft®
SharePoint® Server section below for further information about working with files on
this type of server.
3. If the server is password-protected, enter your User ID and password in the User and
Password fields.
4. Click Browse to connect to the server and view the available folders.
4. Click the folder you want to add to the project view. The Open button only becomes
active once you do this. The URL of the folder now appears in the File URL field.
5. Click Open to add the folder to the project.
Note: Right-clicking a single file and pressing the Delete key does not delete a file from the
Project window. You have to delete it physically on the server and then refresh the
contents of the external folder.
The User ID and password can be saved in the properties of individual folders in the project,
thereby enabling you to skip the verification process each time the server is accessed.
In the Project window (screenshot below), file icons have symbols that indicate the check-in/
check-out status of files. The various file icons are shown below:
When a file is checked out by another user, it is not available for check out.
When a file is checked out locally by you, you can undo the check-out with the Undo
Check-Out command in the context menu. This has the effect of returning the file
unchanged to the server.®®
If you check out a file in one Altova application, you cannot check it out in another
Altova application. The file is considered to be already checked out to you. The
available commands at this point in any Altova application supporting Microsoft®
SharePoint® Server will be: Check In and Undo Check Out.
3. Check the Activate Project Scripts check box and select the required scripting project (
.asprj file). If you wish to run Auto-Macros when the XMLSpy project is loaded, check
the Run Auto-Macros check box.
4. Click OK to finish.
Note: To deactivate (that is, unassign) the scripting project of an XMLSpy project, uncheck
the Activate Project Scripts check box.
21.3.16 Properties
The Project | Project Properties command lets you define important settings for any of the
specific folders in your project.
Please note:
If your project file is under source control, a prompt appears asking if you want to check
out the project file (*.spp). Click OK if you want to edit settings and be able to save
them.
The files specified in the Use this xxx entry will take precedence over any local assignment
directly within the XML file. For example, the OrgChart.xsl file (in the Use this XSL entry),
will always be used when transforming any of the XML files in the XML Files folder. Also, such
specified files for individual folders take precedence over files specified for ancestor folders.
File extensions
The File extensions help to determine the automatic file-to-folder distribution that occurs when
you add new files to the project (as opposed as to one particular folder).
Validate
Define the DTD or Schema document that should be used to validate all files in the current
folder (Main Pages in this example).
If you are developing XSL Stylesheets yourself, you can also assign an example XML document
to be used to preview the XSL Stylesheet in response to an XSL Transformation command
issued from the stylesheet document, instead of the XML instance document.
If you have added one file or URL to more than one folder in your project, you can use the
Properties dialog to set the default folder whose settings should be used when you choose to
validate or transform the file in non-batch mode. To do this, use the Use settings in current
folder as default check box (see screenshot).
Authentic View
The "Use config." option allows you to select a StyleVision Power Stylesheet (SPS file) when
editing XML files using Authentic View, in the current folder. After you have associated the
schema, SPS, and XML files with each other, and entered them in a project, changing the
location of any of the files could cause errors among the associations.
To avoid such errors, it is best to finalize the locations of your schema, SPS, and XML files
before associating them with each other and assigning them to a project.
Also note, that XMLSpy can automatically open the last project that you used, whenever you
start XMLSpy. (Tools | Options | File tab, Project | Open last project on program start).
Among the most frequently used XML tasks are checks for the well-formedness of documents
and validity of XML documents. Commands for these tasks are in this menu.
21.4.1 Insert
The XML | Insert command, though enabled in all views, can be used in Grid View only. It has a
submenu (see screenshot) with which you can insert:
The XML declaration and node types (Attribute, Element, Text, CDATA, Comment,
Processing Instruction) in XML documents;
DOCTYPE declarations and external DTD declarations in XML documents;
DTD declarations (ELEMENT, ATTLIST, ENTITY, and NOTATION) in DTD documents
and internal DTD declarations of XML documents.
Insert Attribute
Ctrl+Shift+I
The XML | Insert | Attribute command is available in Grid View only, and inserts a new
attribute before the selected item. An inserted attribute may appear a few lines before the
current item in Grid View. This is because attributes immediately follow their parent element in
Grid View and precede all child elements of that parent element.
Insert Element
Ctrl+Shift+E
The XML | Insert | Element command is available in Grid View only, and inserts a new element
before the selected item. If the current selection is an attribute, the new element is before the
first child element of the attribute's parent element.
Insert Text
Ctrl+Shift+T
The XML | Insert | Text command is available in Grid View only, and inserts a new text row
before the selected item. If the current selection is an attribute, the text row is inserted after the
attribute and before the first child element of the attribute's parent element.
Insert CDATA
Ctrl+Shift+D
The XML | Insert | Cdata command is available in Grid View only, and inserts a new CDATA
block before the selected item. If the current selection is an attribute, the CDATA block is
inserted after the attribute and before the first child element of the attribute's parent element.
Insert Comment
Ctrl+Shift+M
The XML | Insert | Comment command is available in Grid View only, and inserts a new
comment before the selected item. If the current selection is an attribute, the new comment row
is inserted after the attribute and before the first child element of the attribute's parent element.
Insert XML
The XML | Insert | XML command is available in Grid View only, and inserts a row for the XML
declaration before the selected item. You must insert the child attributes of the XML declaration
and the values of this attribute. An XML declaration must look something like this:
<?xml version="1.0" encoding="UTF-8"?>
Please note: Since an XML document may only contain one XML declaration at the very top of
the file, this command should only be used with the topmost row selected and if an XML
declaration does not already exist.
The XML | Insert | Processing Instruction command is available in Grid View only, and inserts
a new processing instruction (PI) before the selected item. If the current selection is an
attribute, the PI is inserted after the attribute and before the first child element of the attribute's
parent element.
Insert XInclude
The XML | Insert | XInclude command is available in Grid View only, and enables you to insert
a new XInclude element before the selected item. If the current selection is an attribute, the
XInclude element is inserted after the attribute and before the first child element of the
attribute's parent element. Selecting this command pops up the XInclude dialog (screenshot
below).
The XML file to be included is entered in the href text box (alternatively, you can browse for the
file by clicking the Browse button to the right of the text box). The filename will be entered in the
XML document as the value of the href attribute. The encoding and parse attributes of the
XInclude element (xi:include), and the fallback child element of xi:include can also be
inserted via the dialog. Do this by first checking the appropriate check box and then selecting/
entering the required values.
Here is an example of an XML document that uses XInclude to include two XML documents:
<?xml version="1.0" encoding="UTF-16"?>
<AddressBook xsi:schemaLocation="http://www.altova.com/sv/myaddresses
AddressBook.xsd"
xmlns="http://www.altova.com/stylevision/tutorials/myaddresses"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xi="http://www.w3.org/2001/XInclude">
<xi:include href="BusinessAddressBook.xml"/>
<xi:include href="PersonalAddressBook.xml"/>
</AddressBook>
When this XML document is parsed, it will replace the two XInclude elements with the files
specified in the respective href attributes.
xml:base
When the XML validator of XMLSpy reads an XML document and encounters the include
element in the XInclude namespace (hereafter xi:include), it replaces this element (xi:
include) with the XML document named in the href attribute of the xi:include element. The
document element (root element) of the included XML document (or the element identified by
an XPointer) will be included with an attribute of xml:base in order to preserve the base URIs of
the included element. If the resulting XML document (containing the included XML document/s
or tree fragment/s) must be valid according to a schema, then the document element of the
included document (or the top-level element of the tree fragment) must be created with a
content model that allows an attribute of xml:base. If, according to the schema, the xml:base
attribute is not allowed on this element, then the resulting document will be invalid. How to
define an xml:base attribute in an element's content model using XMLSpy's Schema View is
described in the xml: Prefixed Attributes section of the Schema View section of the
documentation.
XPointers
XMLSpy supports XPointers in XInclude. The relevant W3C recommendations are the XPointer
Framework and XPointer element() Scheme recommendations. The use of an XPointer in an
XInclude element enables a specific part of the XML document to be included, instead of the
entire XML document. XPointers are used within an XInclude element as follows:
In the element() scheme of XPointer, an NCName or a child sequence directed by integers may
be used.
In the first xi:include element listed above, the xpointer attribute uses the element
scheme with an NCName of usa. According to the XPointer Framework, this NCName
identifies the element that has an ID of usa.
In the second xi:include listed above, the xpointer attribute with a value of element
(/1/1) identifies, in the first step, the first child element of the document root (which, if
the document is well-formed, will be its document (or root) element). In the second step,
the first child element of the element located in the previous step is located; in our
example, this would be the first child element of the document element.
The xpointer attribute of the third xi:include listed above uses a combination of
NCName and child sequence. This XPointer locates the first child element of the third
child element of the element having an ID of usa.
If you are not sure whether your first XPointer will work, you can back it up with a
second one as shown in the fourth xi:include listed above:
xpointer="element(usa)element(/1/1)". Here, if there is no element with an ID of
usa, the back-up XPointer specifies that the first child element of the document element
is to be selected. Additional backups are also allowed. Individual XPointers may not be
separated, or they may be separated by whitespace: for example,
xpointer="element(usa)element(addresses/1) element(/1/1)".
Note: The namespace binding context is not used in the element() scheme because the
element() scheme does not support qualified names.
Insert DOCTYPE
The XML | Insert | DOCTYPE command is available in the Grid View of an XML file when a
top-level node is selected. It appends a DOCTYPE declaration at the top of the XML document.
You must enter the name of the DOCTYPE, and this name must be the same as the name of
the document element.
After you have entered the name of the DOCTYPE, you can enter the declarations you wish to
use in the internal DTD subset.
Please note:
A DOCTYPE declaration may only appear between the XML declaration and the XML
document element.
You could use the Assign DTD command instead to create a DOCTYPE statement that
refers to an external DTD document.
Insert ExternalID
A system identifier is a URI that identifies the external resource. A public identifier is
location-independent and can be used to dereference the location of an external resource. For
example, in your XMLSpy installation, URIs for popular DTDs and XML Schemas are listed in
the catalog files named catalog.xml in the various schema folders in C:\Program
Files\Altova\Common2011\Schemas\. A public identifier in an XML document can be used to
dereference a DTD listed in these catalog files.
The XML | Insert | ExternalID command is available when a "child" item of the DOCTYPE
declaration in an XML file is selected in Grid View. This command inserts a Grid View row for an
external identifier (PUBLIC or SYSTEM). You must enter the type of identifier and its value.
The Text View corresponding to the screenshot of the Grid View shown above looks something
like this:
<!DOCTYPE OrgChart SYSTEM "orgchart.dtd" [
<!ELEMENT name (#PCDATA)>
]>
Please note: A row for External-ID can be added as a child when the DOCTYPE item is
selected, or it can be inserted or appended when one of the child items of the DOCTYPE item is
selected, for example, the ELEMENT declaration name in the example above.
Insert ELEMENT
The XML | Insert | ELEMENT command is available in Grid View only, for DTD documents or
when an item in the DOCTYPE declaration of an XML document is selected. It inserts an
ELEMENT declaration before the selected declaration.
Insert ATTLIST
The XML | Insert | ATTLIST command is available in Grid View only, for DTD documents or
when an item in the DOCTYPE declaration of an XML document is selected. It inserts an
ATTLIST declaration before the selected declaration.
Insert ENTITY
The XML | Insert | ENTITY command is available in Grid View only, for DTD documents or
when an item in the DOCTYPE declaration of an XML document is selected. It inserts an
ENTITY declaration before the selected declaration.
Insert NOTATION
The XML | Insert | NOTATION command is available in Grid View only, for DTD documents or
when an item in the DOCTYPE declaration of an XML document is selected. It inserts a
NOTATION declaration before the selected declaration.
21.4.2 Append
The XML | Append command, though enabled in all views, can be used in Grid View only. It
opens a submenu (see screenshot) with which you can append:
The XML declaration and node types (Attribute, Element, Text, CDATA, Comment,
Processing Instruction) in XML documents;
DOCTYPE declarations and external DTD declarations in XML documents
DTD declarations (ELEMENT, ATTLIST, ENTITY, and NOTATION) in DTD documents
and internal DTD declarations of XML documents.
Append Attribute
Ctrl+I
The XML | Append | Attribute command is available in Grid View only, and appends a new
attribute.
Append Element
Ctrl+E
The XML | Append | Element command is available in Grid View only, and appends an
element node after the last sibling element of the selected element. If an attribute node is
selected, then the element node is appended after the last child of the selected attribute's
parent element.
Append Text
Ctrl+T
The XML | Append | Text command is available in Grid View only, and appends a text block
after the last sibling element of the selected element. If an attribute node is selected, then the
text block is appended after the last child of the selected attribute's parent element.
Append CDATA
Ctrl+D
The XML | Append | Cdata command is available in Grid View only, and appends a CDATA
node after the last sibling of any selected node other than an attribute node. If an attribute node
is selected, then the CDATA section is appended after the last child of the selected attribute's
parent element.
Append Comment
Ctrl+M
The XML | Append | Comment command is available in Grid View only, and appends a
comment node after the last sibling of any selected node other than an attribute node. If an
attribute node is selected, then the comment node is appended after the last child of the
selected attribute's parent element.
Append XML
The XML | Append | XML command inserts a new XML declaration <?xml version="1.0"
encoding="UTF-8"?> as the first item in a document.
Please note: An XML document may contain only one XML declaration, which must appear at
the very top of the file.
The XML | Append | Processing Instruction command is available in Grid View only, and
appends a processing instruction node after the last sibling of any selected node other than an
attribute node. If an attribute node is selected, then the comment node is appended after the
last child of the selected attribute's parent element.
Append XInclude
The XML | Append | XInclude command is available in Grid View only, and enables you to
append an XInclude element after the last sibling of any selected node other than an attribute
node. If the current selection is an attribute, the XInclude element is appended after the the last
child of the selected attribute's parent element. Selecting this command pops up the XInclude
dialog (screenshot below).
The XML file to be included is entered in the href text box (alternatively, you can browse for the
file by clicking the Browse button to the right of the text box). The filename will be entered in the
XML document as the value of the href attribute. The encoding and parse attributes of the
XInclude element (xi:include), and the fallback child element of xi:include can also be
inserted via the dialog. Do this by first checking the appropriate check box and then selecting/
entering the required values.
Here is an example of an XML document that uses XInclude to include two XML documents:
<?xml version="1.0" encoding="UTF-16"?>
<AddressBook xsi:schemaLocation="http://www.altova.com/sv/myaddresses
AddressBook.xsd"
xmlns="http://www.altova.com/stylevision/tutorials/myaddresses"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xi="http://www.w3.org/2001/XInclude">
<xi:include href="BusinessAddressBook.xml"/>
<xi:include href="PersonalAddressBook.xml"/>
</AddressBook>
When this XML document is parsed, it will replace the two XInclude elements with the files
specified in the respective href attributes.
xml:base
When the XML validator of XMLSpy reads an XML document and encounters the include
element in the XInclude namespace (hereafter xi:include), it replaces this element (xi:
include) with the XML document named in the href attribute of the xi:include element. The
document element (root element) of the included XML document (or the element identified by
an XPointer) will be included with an attribute of xml:base in order to preserve the base URIs of
the included element. If the resulting XML document (containing the included XML document/s
or tree fragment/s) must be valid according to a schema, then the document element of the
included document (or the top-level element of the tree fragment) must be created with a
content model that allows an attribute of xml:base. If, according to the schema, the xml:base
attribute is not allowed on this element, then the resulting document will be invalid. How to
define an xml:base attribute in an element's content model using XMLSpy's Schema View is
described in the xml: Prefixed Attributes section of the Schema View section of the
documentation.
XPointers
XMLSpy supports XPointers in XInclude. The relevant W3C recommendations are the XPointer
Framework and XPointer element() Scheme recommendations. The use of an XPointer in an
XInclude element enables a specific part of the XML document to be included, instead of the
entire XML document. XPointers are used within an XInclude element as follows:
In the element() scheme of XPointer, an NCName or a child sequence directed by integers may
be used.
In the first xi:include element listed above, the xpointer attribute uses the element
scheme with an NCName of usa. According to the XPointer Framework, this NCName
identifies the element that has an ID of usa.
In the second xi:include listed above, the xpointer attribute with a value of element
(/1/1) identifies, in the first step, the first child element of the document root (which, if
the document is well-formed, will be its document (or root) element). In the second step,
the first child element of the element located in the previous step is located; in our
example, this would be the first child element of the document element.
The xpointer attribute of the third xi:include listed above uses a combination of
NCName and child sequence. This XPointer locates the first child element of the third
child element of the element having an ID of usa.
If you are not sure whether your first XPointer will work, you can back it up with a
second one as shown in the fourth xi:include listed above:
xpointer="element(usa)element(/1/1)". Here, if there is no element with an ID of
usa, the back-up XPointer specifies that the first child element of the document element
is to be selected. Additional backups are also allowed. Individual XPointers may not be
separated, or they may be separated by whitespace: for example,
xpointer="element(usa)element(addresses/1) element(/1/1)".
Note: The namespace binding context is not used in the element() scheme because the
element() scheme does not support qualified names.
Append DOCTYPE
The XML | Append | DOCTYPE command is available in the Grid View of an XML file when a
top-level node is selected. It appends a DOCTYPE declaration at the top of the XML document.
You must enter the name of the DOCTYPE, and this name must be the same as the name of
the document element.
After you have entered the name of the DOCTYPE, you can enter the declarations you wish to
use in the internal DTD subset.
Please note:
A DOCTYPE declaration may only appear between the XML declaration and the XML
document element.
You could use the Assign DTD command instead to create a DOCTYPE statement that
refers to an external DTD document.
Append ExternalID
A system identifier is a URI that identifies the external resource. A public identifier is
location-independent and can be used to dereference the location of an external resource. For
example, in your XMLSpy installation, URIs for popular DTDs and XML Schemas are listed in
the catalog files named catalog.xml in the various schema folders in C:\Program
Files\Altova\Common2011\Schemas\. A public identifier in an XML document can be used to
dereference a DTD listed in these catalog files.
The XML | Append | ExternalID command is available when a "child" item of the DOCTYPE
declaration in an XML file is selected in Grid View. This command inserts a Grid View row for an
external identifier (PUBLIC or SYSTEM). You must enter the type of identifier and its value.
The Text View corresponding to the screenshot of the Grid View shown above looks something
like this:
<!DOCTYPE OrgChart SYSTEM "orgchart.dtd" [
<!ELEMENT name (#PCDATA)>
]>
Please note: A row for External-ID can be added as a child when the DOCTYPE item is
selected, or it can be inserted or appended when one of the child items of the DOCTYPE item is
selected, for example, the ELEMENT declaration name in the example above.
Append ELEMENT
The XML | Append | ELEMENT command is available in Grid View only, for DTD documents or
when an item in the DOCTYPE declaration of an XML document is selected. It appends an
ELEMENT declaration to the list of declarations.
Append ATTLIST
The XML | Append | ATTLIST command is available in Grid View only, for DTD documents or
when an item in the DOCTYPE declaration of an XML document is selected. It appends an
ATTLIST declaration to the list of declarations.
Append ENTITY
The XML | Append | ENTITY command is available in Grid View only, for DTD documents or
when an item in the DOCTYPE declaration of an XML document is selected. It appends an
ENTITY declaration to the list of declarations.
Append NOTATION
The XML | Append | NOTATION command is available in Grid View only, for DTD documents
or when an item in the DOCTYPE declaration of an XML document is selected. It appends a
NOTATION declaration to the list of declarations.
Ctrl+Alt+I
The XML | Add Child | Attribute command is available in Grid View only and when an element
node is selected. It inserts a new attribute as a child of the selected element node.
Ctrl+Alt+E
The XML | Add Child | Element command is available in Grid View only. It inserts a new
element as a child of the selected node.
Ctrl+Alt+T
The XML | Add Child | Text command is available in Grid View only, and inserts new text
content as a child of the selected item.
Ctrl+Alt+D
The XML | Add Child | Cdata command is available in Grid View only, and inserts a new
CDATA section as a child of the selected item.
Ctrl+Alt+M
The XML | Add Child | Comment command is available in Grid View only, and inserts a new
Comment node as a child of the selected item.
The XML | Add Child | XML command is available in Grid View only and when the file is empty
. It inserts a new XML declaration <?xml version="1.0" encoding="UTF-8"?> as the
first item in a document.
Please note: An XML document may contain only one XML declaration, which must appear at
the very top of the file.
The XML | Add Child | Processing Instruction command is available in Grid View only and
inserts a new Processing Instruction (PI) as a child of the selected item.
The XML | Add Child | Processing Instruction command is available in Grid View only and
inserts a new Processing Instruction (PI) as a child of the selected item.
The XML | Add Child | XInclude command is available in Grid View only, and enables you to
insert an XInclude element as a child of the selected item. Selecting this command pops up the
XInclude dialog (screenshot below).
The XML file to be included is entered in the href text box (alternatively, you can browse for the
file by clicking the Browse button to the right of the text box). The filename will be entered in the
XML document as the value of the href attribute. The encoding and parse attributes of the
XInclude element (xi:include), and the fallback child element of xi:include can also be
inserted via the dialog. Do this by first checking the appropriate check box and then selecting/
entering the required values.
Here is an example of an XML document that uses XInclude to include two XML documents:
<?xml version="1.0" encoding="UTF-16"?>
<AddressBook xsi:schemaLocation="http://www.altova.com/sv/myaddresses
AddressBook.xsd"
xmlns="http://www.altova.com/stylevision/tutorials/myaddresses"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xi="http://www.w3.org/2001/XInclude">
<xi:include href="BusinessAddressBook.xml"/>
<xi:include href="PersonalAddressBook.xml"/>
</AddressBook>
When this XML document is parsed, it will replace the two XInclude elements with the files
specified in the respective href attributes.
xml:base
When the XML validator of XMLSpy reads an XML document and encounters the include
element in the XInclude namespace (hereafter xi:include), it replaces this element (xi:
include) with the XML document named in the href attribute of the xi:include element. The
document element (root element) of the included XML document (or the element identified by
an XPointer) will be included with an attribute of xml:base in order to preserve the base URIs of
the included element. If the resulting XML document (containing the included XML document/s
or tree fragment/s) must be valid according to a schema, then the document element of the
included document (or the top-level element of the tree fragment) must be created with a
content model that allows an attribute of xml:base. If, according to the schema, the xml:base
attribute is not allowed on this element, then the resulting document will be invalid. How to
define an xml:base attribute in an element's content model using XMLSpy's Schema View is
described in the xml: Prefixed Attributes section of the Schema View section of the
documentation.
XPointers
XMLSpy supports XPointers in XInclude. The relevant W3C recommendations are the XPointer
Framework and XPointer element() Scheme recommendations. The use of an XPointer in an
XInclude element enables a specific part of the XML document to be included, instead of the
entire XML document. XPointers are used within an XInclude element as follows:
In the element() scheme of XPointer, an NCName or a child sequence directed by integers may
be used.
In the first xi:include element listed above, the xpointer attribute uses the element
scheme with an NCName of usa. According to the XPointer Framework, this NCName
identifies the element that has an ID of usa.
In the second xi:include listed above, the xpointer attribute with a value of element
(/1/1) identifies, in the first step, the first child element of the document root (which, if
the document is well-formed, will be its document (or root) element). In the second step,
the first child element of the element located in the previous step is located; in our
example, this would be the first child element of the document element.
The xpointer attribute of the third xi:include listed above uses a combination of
NCName and child sequence. This XPointer locates the first child element of the third
child element of the element having an ID of usa.
If you are not sure whether your first XPointer will work, you can back it up with a
second one as shown in the fourth xi:include listed above:
xpointer="element(usa)element(/1/1)". Here, if there is no element with an ID of
usa, the back-up XPointer specifies that the first child element of the document element
is to be selected. Additional backups are also allowed. Individual XPointers may not be
separated, or they may be separated by whitespace: for example,
xpointer="element(usa)element(addresses/1) element(/1/1)".
Note: The namespace binding context is not used in the element() scheme because the
element() scheme does not support qualified names.
The XML | Add Child | DOCTYPE command is only available in the Grid View of an empty
document. It inserts a DOCTYPE declaration in an XML document. The DOCTYPE declaration
can be used to declare an internal DTD subset.
The XML | Add Child | ExternalID command is available only when the DOCTYPE declaration
of an XML file is selected in Grid View. This command inserts a Grid View row for an external
identifier (PUBLIC or SYSTEM). You must enter the type of identifier and its value.
The Text View corresponding to the screenshot of the Grid View shown above looks something
like this:
<!DOCTYPE OrgChart SYSTEM "orgchart.dtd" [
<!ELEMENT name (#PCDATA)>
]>
Please note: A row for External-ID can be added as a child when the DOCTYPE item is
selected, or it can be inserted or appended when one of the child items of the DOCTYPE item is
selected, for example, the ELEMENT declaration name in the example above.
The XML | Add Child | ELEMENT command is available in Grid View only, for DTD
documents, or when the DOCTYPE declaration of an XML document is selected. It appends an
ELEMENT declaration to the list of declarations.
The XML | Add Child | ATTLIST command is available in Grid View only, for DTD documents,
or when the DOCTYPE declaration of an XML document is selected. It appends an ATTLIST
declaration to the list of declarations.
The XML | Add Child | ENTITY command is available in Grid View only, for DTD documents, or
when the DOCTYPE declaration of an XML document is selected. It appends an ENTITY
declaration to the list of declarations.
The XML | Add Child | NOTATION command is available in Grid View only, for DTD
documents, or when the DOCTYPE declaration of an XML document is selected. It appends an
NOTATION declaration to the list of declarations.
21.4.4 Convert To
The XML | Convert to command converts a selected item in Grid View to a different item type.
This operation is available only in Grid View on individual items that do not contain any child
node. Placing the cursor over the Convert to command displays a submenu (see screenshot)
which contains the items to which the selected item can be converted.
Please note: If the operation you select would result in a loss of data (for example, converting
an attribute to a comment would result in a loss of the attribute name), a warning dialog box will
appear.
Convert To Attribute
The XML | Convert to | Attribute command converts the selected item to a attribute.
Convert To Element
The XML | Convert to | Element command converts the selected item to an element.
Convert To Text
The XML | Convert to | Text command converts the selected item into text content.
Convert To CDATA
The XML | Convert to | Cdata command converts the selected item into a CDATA segment.
Convert To Comment
The XML | Convert to | Comment command converts the selected item into a comment.
Convert To XML
The XML | Convert to | XML command converts the selected item to an XML declaration:
<?xml version="1.0" encoding="UTF-8"?>.
Please note: Each XML document may only contain one XML declaration and it must appear at
the very top of the file.
Convert To DOCTYPE
The XML | Convert to | DOCTYPE command converts the selected item to a DOCTYPE
declaration (in an XML file).
Please note: A DOCTYPE declaration may only appear at the top of an XML instance
document between the XML Declaration and the document element of the XML document.
Convert To ExternalID
The XML | Convert to | ExternalID command converts the selected item to an external DTD
reference in a DOCTYPE declaration (PUBLIC or SYSTEM identifier).
Convert To ELEMENT
The XML | Convert to | ELEMENT command converts the selected item to an element
declaration in a DOCTYPE declaration or in an external DTD.
Convert To ATTLIST
The XML | Convert to | ATTLIST command converts the selected item to an attribute list
declaration in a DOCTYPE declaration or in an external DTD.
Convert To ENTITY
The XML | Convert to | ENTITY command converts the selected item to an entity declaration in
a DOCTYPE declaration or in an external DTD.
Convert To NOTATION
The XML | Convert to | NOTATION command converts the selected item to a notation
declaration in a DOCTYPE declaration or in an external DTD.
21.4.5 Table
The XML | Table command, though enabled in all views, can be used only in Grid View. It
displays a submenu with all the commands relevant to the Database/Table View of Grid View.
Display as Table
F12
The XML | Table | Display as Table command allows you to switch between the standard Grid
View and Database/Table View (or Table View) of a document element. The Table View
enables you to view repeated elements as a table in which the rows represent the occurrences
while the columns represent child nodes (including comments, CDATA sections, and PIs).
To switch from the Table View of a document element to the normal Grid View of that element,
select the table or any of its rows or columns, and click the toolbar icon. That table element
switches to Grid View.
Insert Row
Shift+F12
The XML | Table | Insert Row command is enabled in Database/Table View when a row or cell
is selected. It inserts a new row before the selected row. The new row corresponds to an
occurrence of the table element. Mandatory child elements are created for the new element
Append Row
Ctrl+F12
The XML | Table | Append Row command is enabled in Database/Table View when a row or
cell is selected. It appends a new row after the last row of the table. The new row corresponds
to an occurrence of the table element. Mandatory child elements are created for the new
element
Ascending Sort
The XML | Table | Ascending Sort command is enabled in Database/Table View when a
column or cell is selected. It sorts the column in either alphabetic or numeric ascending order.
XMLSpy tries to automatically determine what kind of data is used in the column, and sorts on
alphabetic or numeric order, as required. In case of uncertainty, you will be prompted for the
sort method to use (see screenshot).
Descending Sort
The XML | Table | Descending Sort command is enabled in Database/Table View when a
column or cell is selected. It sorts the column in either alphabetic or numeric descending order.
XMLSpy tries to automatically determine what kind of data is used in the column, and sorts on
alphabetic or numeric order, as required. In case of uncertainty, you will be prompted for the
sort method to use (see screenshot).
Ctrl+L
The XML | Move Left command is available in Grid View only. It moves the selected node to
the left by one level, thereby changing a child element into a sibling of its parent. This command
is often referred to as the Promote command.
Ctrl+R
The XML | Move Right command is available in Grid View only. It moves the selected node to
the right by one level, thereby turning it into a child element of the preceding sibling element.
This command is often referred to as the Demote command.
For example, in the screenshot below, the text Nanonull in the para element is highlighted.
When you select the command XML | Enclose in Element, the text Nanonull is enclosed in a
newly created inline element and a list appears offering a choice of bold or italic for the
name of the element. These elements are defined in the schema as children of para.
The selection you make will be the name of the new element. Alternatively, you can enter some
other name for the element.
The XML | Evaluate XPath command opens the Output Windows if these are not open and
activates the XPath tab in the Output Windows. In the XPath tab, you can evaluate an XPath
expression on the active document and see the results in the Output Window.
F7
The XML | Check well-formedness (F7) command checks the active document for
well-formedness by the definitions of the XML 1.0 specification. Every XML document must be
well-formed. XMLSpy checks for well-formedness whenever a document is opened or saved, or
when the view is changed from Text to any other view. You can also check for well-formedness
at any time while editing by using this command.
If the well-formedness check succeeds when you explicitly invoke the check, a message is
displayed in the Validation window:
Please note: The output of the Validation window has 9 tabs. The validation output is always
displayed in the active tab. Therefore, you can check well-formedness in tab1 for one schema
file and keep the result by switching to tab 2 before validating the next schema document
(otherwise tab 1 is overwritten with the validation result ).
It is generally not permitted to save a malformed XML document, but XMLSpy gives you a Save
Anyway option. This is useful when you want to suspend your work temporarily (in a not
well-formed condition) and resume it later.
Please note: You can also use the Check well-formedness command on any file, folder, or
group of files in the active project window. Click on the respective folder, and then on the Check
Well-Formedness icon.
F8
The XML | Validate (F8) command enables you to validate XML documents against DTDs,
XML Schemas, and other schemas. Validation is automatically carried out when you switch
from Text View to any other view. You can specify that a document be automatically validated
when a file is opened or saved (Tools | Options | File). The Validate command also carries
out a well-formedness check before checking validity, so there is no need to use the Check
Well-Formedness command before using the Validate command.
Please note: You can click on the links in the error message to jump to the spot in the XML file
where the error was found.
Please note: The output of the Validation window has 9 tabs. The validation output is always
displayed in the active tab. Therefore, you can check well-formedness in tab1 for one schema
file and keep the result by switching to tab 2 before validating the next schema document
(otherwise tab 1 is overwritten with the validation result ).
The command is normally applied to the active document. But you can also apply the command
to a file, folder, or group of files in the active project. Select the required file or folder in the
Project Window (by clicking on it), and click XML | Validate or F8. Invalid files in a project will
be opened and made active in the Main Window, and the File Is Invalid error message will be
displayed.
Please note: When the validation is done in Text View, clicking a link in the Validation window
highlights the corresponding declaration or definition in Text View. When the validation is done
in Schema View, the corresponding declaration or definition is highlighted either in the design
window of Schema View or in the relevant entry helper window.
Catalogs
XMLSpy supports a subset of the OASIS XML catalogs mechanism. The catalog mechanism
enables XMLSpy to retrieve commonly used schemas (as well as stylesheets and other files)
from local user folders. This increases the overall processing speed, enables users to work
offline (that is, not connected to a network), and improves the portability of documents (because
URIs need to be changed in the catalog files only.) The catalog mechanism in XMLSpy works
as follows:
XMLSpy loads a file called RootCatalog.xml, which contains a list of catalog files that
will be looked up. You can enter as many catalog files to look up, each in a
nextCatalog element in RootCatalog.xml.
The catalog files included in RootCatalog.xml are looked up and the URIs are
resolved according to the mappings specified in the catalog files. You should take care
not to duplicate mappings, as this could lead to errors.
Two catalog files are supplied with XMLSpy. How these work is described in the
section Catalogs in XMLSpy.
The PUBLIC or SYSTEM identifier in the DOCTYPE statement of your XML file will be used
for the catalog lookup. For popular schemas, the PUBLIC identifier is usually pre-
defined, thus requiring only the URI in the catalog file to be changed when XML
documents are used on multiple machines.
When writing your CustomCatalog.xml file (or other custom catalog file), use only the following
subset of the OASIS catalog in order for XMLSpy to process the catalog correctly. Each of the
elements in the supported subset can take the xml:base attribute, which is used to specify the
base URI of that element.
<catalog...>
...
<public publicId="PublicID of Resource" uri="URL of local file"/>
<system systemId="SystemID of Resource" uri="URL of local file"/>
<rewriteURI uriStartString="StartString of URI to rewrite"
rewritePrefix="String to replace StartString"/>
<rewriteSystem systemIdStartString="StartString of SystemID"
rewritePrefix="Replacement string to locate resource locally"/>
<uri name="filename" uri="URL of file identified by filename"/>
...
</catalog>
Please note:
Although the DTDs for XML Schemas are referenced from CoreCatalog.xml, you
cannot validate your XML files against either of these schemas. They are included to
provide entry helper info for editing purposes should you wish to create files according
to these older recommendations. Also see next point.
If you create a custom file extension for a particular schema (for example, the .myhtml
extension for (HTML) files that are to be valid according to the HTML DTD), then you
can enable intelligent editing for files with these extensions by adding a line of text to
CustomCatalog.xml. For the example extension mentioned, you should add the
element <spy:fileExtHelper ext="myhtml" uri="schemas/xhtml/xhtml1-
transitional.dtd"/> as a child of the <catalog> element. This would enable
intelligent editing (auto-completion, entry helpers, etc) of .myhtml files in XMLSpy
according to the XHTML 1.0 Transitional DTD.
For more information on catalogs, see the XML Catalogs specification.
Validation tasks can therefore be automated with the use of Altova XML. For example, you can
create a batch file that calls AltovaXML to perform validation on a set of documents and sends
the output to a text file. See the AltovaXML documentation for details.
Example).
There is a difference between http://schemas.xmlsoap.org/wsdl/ and
http://www.altova.com/specs_wsdl.html#_document-s.
http://schemas.xmlsoap.org/wsdl/ is missing the extensibility elements (the specification
and the schema should be the same but are not; this difference appears to be an error
in the schema).
The fact that the Professional Edition uses http://schemas.xmlsoap.org/wsdl/ for
validation means that any extensibility elements will be considered invalid. The
Enterprise Edition used http://www.altova.com/specs_wsdl.html#_document-s, which
allows extensibility elements. Thus a WSDL file containing extensibility elements is valid
when using the Enterprise edition, and not valid when using the Professional Edition.
The fact that the file is invalid in the Professional Edition is because we are using the
official schema provided by the W3C working group. Any errors in this schema are
beyond our control.
Example
The following example is part of a WSDL file. Notice the element "getCityTime" that has been
declared in the file. This element is mistakenly referenced as "getCityTimes". The Enterprise
Edition checks if elements that are referenced have previously been declared in the file; the
Professional Edition does not. This file (assuming that the rest of the file is valid) would be found
to be valid in the Professional Edition, but not valid in the Enterprise Edition (assuming that
"getCityTimes" is not defined somewhere else in the file).
<s:element name="getCityTime">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="city"
type="s:string"/>
</s:sequence>
</s:complexType>
</s:element>
<s:element name="abc">
<s:complexType>
<s:sequence>
<s:element ref="getCityTimes"/>
</s:sequence>
</s:complexType>
</s:element>
The XML | Update Entry Helpers command updates the Entry Helper windows by reloading
the underlying DTD or Schema. If you have modified the XML Schema or DTD that an open
XML document is based upon, it is advisable to update the Entry Helpers so that the intelligent
editing information reflects the changes in the schema.
You can choose to set the namespace prefix on either elements, attributes, or both. The
namespace prefix is applied to the selected element or attribute, and, if an element is selected,
to descendant nodes of the selected element.
This section contains a complete description of all the commands in this menu.
The DTD/Schema | Assign DTD... command is enabled when an XML file is active. It assigns
a DTD to an XML document, thus allowing the document to be validated and enabling intelligent
editing for the document. The command opens the Assign File dialog to let you specify the DTD
file you wish to assign. You can also select a file via a global resource or a URL (click the
Browse button) or a file in one of the open windows in XMLSpy (click the Window button). Note
that you can make the path of the assigned DTD file relative by clicking the Make Path Relative
To... check box. When you are done, your XML document will contain a DOCTYPE declaration
that references the assigned DTD. The DOCTYPE declaration will look something like this:
<!DOCTYPE main SYSTEM "http://link.xmlspy.com/spyweb.dtd">
Please note: A DTD can be assigned to a new XML file at the time the file is created.
The DTD/Schema | Assign Schema... command is enabled when an XML document is active.
It assigns an XML Schema to an XML document, thus allowing the document to be validated
and enabling intelligent editing for the document. The command opens the Assign File dialog to
let you specify the XML Schema file you wish to assign. You can also select a file via a global
resource or a URL (click the Browse button) or a file in one of the open windows in XMLSpy
(click the Window button). Note that you can make the path of the assigned file relative by
clicking the Make Path Relative To... check box. When you are done, your XML document will
contain an XML Schema assignment with the required namespaces. The schema assignment
will look something like this:
xmlns="http://www.xmlspy.com/schemas/icon/orgchart"
xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
xsi:schemaLocation="http://www.xmlspy.com/schemas/icon/orgchart
http://schema.xmlspy.com/schemas/icon/orgchart.xsd"
The command opens the Assign File dialog to let you specify the DTD file you want to include in
your DTD.
21.5.4 Go to DTD
The DTD/Schema | Go to DTD command opens the DTD on which the active XML document
is based. If no DTD is assigned, then an error message is displayed.
21.5.5 Go to Schema
The DTD/Schema | Go to Schema command opens the XML Schema on which the active
XML document is based. If no XML Schema is assigned, then an error message is displayed.
21.5.6 Go to Definition
In both cases, the corresponding DTD or Schema file is opened, and the item definition
is highlighted.
The DTD/Schema | Generate DTD/Schema command generates a new DTD or W3C XML
Schema from an XML document (or from a set of XML documents contained in a folder in the
project window). This command is useful when you want to generate a DTD or XML Schema
from XML documents.
If you generate a DTD, the entity resolution and enumeration options are available.
The Generate DTD/Schema command normally operates on the active main window, but you
can also use the Generate DTD/Schema command on any file, folder, or group of files in the
active project window.
The DTD/Schema | Convert DTD/Schema... command converts a DTD into an XML Schema
and vice versa. If you select W3C Schema, you must also specify how to represent complex
elements, as elements or as complex types.
In any case, you should carefully examine the generated conversion to see if you can enhance
it. A few areas in which improvements may be required are given below.
Attribute Datatyping
DTDs allow for only 10 attribute datatypes, whereas XML Schemas, for instance, allow for 44
datatypes plus derived datatypes. You may wish to enhance a generated XML Schema, for
example, by using a more restrictive datatype. Note that when an XML Schema is converted to
DTD datatype information will be lost.
Namespaces
DTDs are not namespace-aware. As a result, if namespaces are to be specified in a DTD they
must be hard-coded into element and attribute names. This could pose challenging problems
when converting from one schema to another.
Entities
XML Schema does not have equivalents for the general entity declarations of DTDs. When
XMLSpy converts a DTD to an XML Schema, it ignores entity declarations.
DTDs and XML Schemas use different mechanisms for handling unparsed data. This is
explained in more detail below.
When you convert a DTD to an XML Schema using the Convert DTD/Schema command,
XMLSpy does the following:
Something like
<!ATTLIST image format ENTITY #REQUIRED
...>
is converted to
<xs:attribute name="format" type="xs:ENTITY" use="required"/>
And
<!NOTATION gif SYSTEM "image/gif">
is converted to
<xs:notation name="gif" system="image/gif"/>
Please note: According to the XML Schema specification, you do not need to—or cannot,
depending on your viewpoint—declare an external entity.
Please note: Namespaces have no semantic value in DTDs, and namespace prefixes carried
over from the XML Schema become merely a lexical part of the name of the element or
attribute defined in the DTD.
2. In the Content Diagrams tab, select the option Generate Diagrams for XSD Globals.
This will generate, in the UModel project, a content model diagram for each global
component.
3. Select the required options from those available in the dialog. These options are
explained below.
4. If you wish to view the created project in UModel immediately, select the option to open
the project in UModel. Otherwise leave this option unselected.
5. Click OK.
6. In the Save As dialog that appears, browse for the destination folder, then enter the
name of the UMP file, and click Save.
Note: The Convert to UML feature supports W3C XML Schemas only.
Elements to be generated
One of the following choices can be selected: (i) mandatory elements only; (ii) all elements
(mandatory and non-mandatory); (iii) mandatory and minimum number of non-mandatory
elements (for example, the first definition in a choice). If elements are defined as being
repeatable, the number of elements to be generated (for each of these repeatable elements)
can be specified.
Root element
If the schema contains more than one global element, these are listed, and the root element
required for the sample XML file can be selected from the list.
Please see the Code Generator section of this documentation for details about code generation.
Flush the memory cache if memory is tight on your system, or if you have used documents
based on different schemas recently.
The Schema Design | Schema Settings command lets you define global settings for the active
schema. These settings are attributes and their values of the XML Schema document element,
xs:schema.
The Text View of the schema settings shown in the screenshot above will look something like
this:
Please note: These settings apply to the active schema document only.
The Schema Design | Save Diagram... command saves the diagram of the Content Model
currently displayed in the Main Window in PNG format to any desired location.
Note: In order to generate documentation in MS Word format, you must have MS Word
Clicking the Generate Documentation command opens the Schema documentation dialog:
The required format is specified in the Output Format pane: either HTML, Microsoft
Word, or RTF. On clicking OK, you will be prompted for the name of the output file and
the location to which it should be saved.
The documentation can be generated either as a single file or be split into multiple files.
When multiple files are generated, each file corresponds to a component. What
components are included in the output is specified using the check boxes in the Include
pane.
For HTML output, the CSS style definitions can be either saved in a separate CSS file
or embedded in the HTML file (in the <head> element). If a separate CSS file is
created, it will be given the same name as the HTML file, but will have a .css
extension. Check or uncheck the Embed CSS in HTML check box to set the required
option.
The Embed Diagrams option is enabled for the MS Word and RTF output options.
When this option is checked, diagrams are embedded in the result file, either in PNG or
EMF format. Otherwise diagrams are created as PNG or EMF files, which are displayed
in the result file via object links.
When the output is HTML, all diagrams are created as document-external PNG files. If
the Create folder for diagrams check box is checked, then a folder will be created in the
same folder as the HTML file, and the PNG files will be saved inside it. This folder will
have a name of the format HTMLFilename_diagrams. If the Create folder for diagrams
check box is unchecked, the PNG files will be saved in the same folder as the HTML
file.
Links to local files (such as diagram image files and external CSS file) can be relative or
absolute. In the Generate links to local files pane, select the appropriate radio button
according to the option you prefer.
In the Include pane, you select which items you want to include in the documentation.
The Index option lists all related schemas at the top of the file, with their global
components organized by component type. The Check All and Uncheck All buttons
enable you to quickly select or deselect all the options in the pane.
The Details pane lists the details that may be included for each component. Select the
details you wish to include in the documentation. The Check All and Uncheck All
buttons enable you to quickly select or deselect all the options in the pane.
The Show Result File option is enabled for all three output options. When this option is
checked, the result files are displayed in Browser View (HTML output), MS Word (MS
Word output), and the default application for .rtf files (RTF output). You can also
select whether links in the output document are absolute or relative.
The screenshot above shows generated schema documentation with an index (all related
schemas with their global components organized by component type) at the top of the
document.
Note: When generating documentation for W3C schema documents, XMLSpy uses
application-internal versions of these documents. Consequently, other locations of
these documents are not considered, and redefinitions and other schema modifications
will not be reflected in the documentation.
2. In the Element or Attribute tab, click the Append or Insert icon to add a
property descriptor line. The line is added in the dialog and to element boxes in the
Content Model View.
3. From the combo box, select the property you want to display. See screenshot.
4. Repeat steps 1 and 2 for as many properties as required.
The Content Model View is updated, showing the defined property descriptor lines for all
elements for which they exist.
Please note:
For attributes, the configuration you define appears only when attributes are displayed
in the diagram (as opposed to them being displayed in a pane below the Content Model
View).
The configured view applies to all Content Model Views opened after the configuration
is defined.
Widths
These sliders enable you to set the minimum and maximum size of the element rectangles in
Content Model View. Change the sizes if line descriptor text is not fully visible or if you want to
standardize your display.
Distances
These sliders let you define the horizontal and vertical distances between various elements
onscreen.
Show in diagram
The Annotations check box toggles the display of annotation text on or off, as well as the
annotation text width with the slider. You can also toggle the display of the substitution groups
on or off. The Attributes and Identity Constraints appear in the Content Model diagram if their
check boxes are selected; otherwise they appear as tabs in a pane at the bottom of the Content
Model window.
Draw direction
These options define the orientation of the element tree on screen, horizontal or vertical.
21.6.5 Zoom
The Schema Design | Zoom command controls the zoom factor of the Content Model View.
This feature is useful if you have a large content model and wish to zoom out so that the entire
content model fits in the Main Window. You can zoom between 10% and 200% of actual size.
To zoom in and out, either drag the slider or click in the entry box and enter a percentage value.
Alternatively, you could use the Display All Globals icon at the top of the Content Model
View to switch to the Schema Overview.
Alternatively, you could use the following methods to switch to Content Model View:
Click the icon next to the component, the content model of which you want to
display.
Double-click a component name in the Component Navigator Entry Helper (at top right).
When you select the Schema Design | Enable Oracle Schema Extensions command, the
following occurs:
The XDB namespace is declared on the schema element:
xmlns:xdb="http://xmlns.oracle.com/xdb".
An Oracle tab is created in the Details Entry Helper, enabling you to add attributes—
including XDB-specific attributes—to schema elements such as xsd:complexType
and xsd:element.
Oracle extensions can be defined for complex types, elements, and attributes. Use the
Entry Helper as you normally would in XMLSpy.
Please note: This menu command can be toggled on and off, that is, extensions can be
enabled or disabled. When Oracle extensions are enabled, the command is displayed with a
check mark to its left. Disabling Oracle extensions (by clicking the enabled command) deletes
the XDB namespace declaration and all XDB extensions in the file. A warning message
appears since this action cannot be undone.
In order to access this dialog, Oracle schema extensions must be enabled (using the Enable
Oracle Schema Extensions command).
through SQL queries and legacy tools. Please see the Microsoft Website for more information.
When you select the Schema Design | Enable Microsoft SQL Server Schema Extensions
command, the following occurs:
The SQL Server namespace is declared on the schema element:
xmlns:sql="urn:schemas-microsoft-com:mapping-schema".
An SQL Server tab is created in the Details Entry Helper, enabling you to add attributes
to schema elements such as xsd:element.
Where SQL Server extensions can be defined for a schema component, the SQL
Server tab is available in the Details Entry Helper when the component is selected. Use
the Entry Helper as you normally would in XMLSpy.
Please note: This menu command can be toggled on and off, that is, extensions can be
enabled or disabled. When SQL Server extensions are enabled, the command is displayed with
a check mark to its left. Disabling SQL Server extensions (by clicking the enabled command)
deletes the SQL Server namespace declaration and all SQL extensions in the file. A warning
message appears since this action cannot be undone.
1. Click the insert or append icon , to add a new row to the dialog box.
2. Click the field and enter the corresponding relationship name.
3. Click OK to confirm.
This generates a SQL relationship element, placing it just after the namespace
declaration.
Please note: Click the delete icon , to delete a row from the dialog box.
1. Click the insert or append icon , to add a new row to the dialog box.
2. Click the field and enter the corresponding relationship name.
3. Click OK to confirm.
This generates a SQL relationship element for the currently selected schema element.
Please note: Click the delete icon , to delete a row from the dialog box.
The Schema Design | Connect to SchemaAgent Server command is enabled when an XML
Schema document is active and it enables you to connect to a SchemaAgent Server. You are
You can use either the local server (the SchemaAgent server that is packaged with Altova
SchemaAgent or a network server (the Altova SchemaAgent Server product, which is available
free of charge). If you select Work Locally, the local server of SchemaAgent will be started
when you click OK and a connection with it will be established. If you select Connect to
Network Server, the selected SchemaAgent Server must be running in order for a connection
to be made.
After you connect to SchemaAgent Server, a message appears in the bar at the top of the Main
Window with information about the connection. You now have full access to all schemas and
schema components in the search path/s (folder/s) defined for the SchemaAgent server to
which XMLSpy is connected.
Please note: In order for the connection to succeed, you must have Altova's SchemaAgent
Client product installed with a valid license on the same machine as that on which XMLSpy is
installed.
Mousing over the Show in SchemaAgent menu item pops out a submenu with options about
what schemas to show in SchemaAgent. These options are described in Schema Agent in the
Schema/WSDL View section of this user manual.
The SchemaAgent Validation command enables you to validate the currently active schema
as well as schemas related to the currently active schema. This feature is described in detail in
the SchemaAgent Validation section in the Schema View section of this user manual.
In the Schema Subset Generation dialog that now appears (screenshot below), enter the name/
s you want the file/s of the schema subset package to have. You must also specify the folder in
which the new schema subset files are to be saved. A schema subset package could have
multiple files if one or more of the components being created is an imported component in the
original schema. A separate schema file is created for each namespace in the schema subset.
The filenames displayed in the dialog are, by default, the names of the original files. But since
you are not allowed to overwrite the original files, use new filenames if you wish to save the files
in the same folder as the original files.
On clicking OK, the schema subset file with the namespace corresponding to that of the active
file is opened in Schema View. Any other files in the package are created but not opened in
Schema View.
To flatten the active schema, select the command Schema Design | Flatten Schema. This
pops up the Flatten Schema dialog (screenshot below), which contains the names of separate
files, one for each namespace that will be in the flattened schema. These default names are the
same as the original filenames. But since you are not allowed to overwrite the original files, the
filenames must be changed if you wish to save in the same folder as the active file. You can
browse for a folder in which the flattened schema and its associated files will be saved.
On clicking OK, the flattened schema file will be opened in Schema View.
XMLSpy also has a built-in XQuery engine, which can be used to execute XQuery documents
(with or without reference to an XML document).
Commands to deal with all the above transformations are accessible in the XSL/XQuery menu.
In addition, this menu also contains commands to work with the Altova XSLT/XQuery
Debugger.
If your XML document contains a reference to an XSLT stylesheet, then this stylesheet is used
for the transformation. (An XSLT stylesheet can be assigned to an XML document using the
Assign XSL command. If the XML document is part of a project, an XSLT stylesheet can be
specified on a per-folder basis in the Project Properties dialog. Right-click the project folder/s or
file/s you wish to transform and select XSL Transformation.) If an XSLT stylesheet has not
been assigned to an XML file, you are prompted for the XSLT stylesheet to use. You can also
select a file via a global resource or a URL (click the Browse button) or a file in one of the open
windows in XMLSpy (click the Window button).
XSLT transformation tasks can therefore be automated with the use of Altova XML. For
example, you can create a batch file that calls Altova XML to transform a set of documents. See
the Altova XML documentation for details.
Note: The directory structure might need to be created before running the transformation. If
you are generating files for an Open Office XML archive, you would need to zip the
archive files in order to create the top-level OOXML file (for example, .docx).
FO is an XML format that describes paged documents. An FO processor, such as the Apache
XML Project's FOP, takes an FO file as input and generates PDF as output. So, the production
of a PDF document from an XML document is a two-step process.
1. The XML document is transformed to an FO document using an XSLT (aka XSL-FO)
stylesheet.
2. The FO document is processed by an FO processor to generate PDF (or some
alternative output).
processed with the FO processor specified in the XSL tab of the Options dialog (Tools |
Options).
If the XSL:FO Transformation command is executed on an FO document, then the
document is processed with the FO processor specified in the XSL tab of the Options
dialog (Tools | Options).
You can view the output of the FO processor directly on screen using FOP viewer or you can
generate an output file in any one of the following formats: PDF, text, an XML area tree, MIF
PCL, or PostScript. You can also switch on messages from the FO processor to show (i) the
processor's standard output message in the Messages window; and (ii) the processor's error
messages in the Messages window. To switch on either these two options, check the
appropriate check box at the bottom of the dialog.
Please note:
The Apache FOP processor can be downloaded free of charge using the link at the
Altova Download Center. After downloading and installing FOP, you must set the path
to the FOP batch file in the XSL tab of the Options dialog (Tools | Options).
The XSL:FO Transformation command can not only be used on the active file in the
Main Window but also on any file or folder you select in the active project. To do this,
right-click and select XSL:Transformation. The XSLT stylesheet assigned to the
selected project folder is used.
Please note: Parameters or variables that you enter in the XSLT Input Parameters/XQuery
External Variables dialog are only passed on to the built-in Altova XSLT engine. Therefore, if
you are using MSXML or another external engine that you have configured, these parameters
are not passed to this engine.
Please note: Once a set of parameter-values is entered in the XSLT Input Parameters/XQuery
External Variables dialog, it is used for all subsequent transformations until it is explicitly deleted
or the application is restarted. Parameters entered in the XSLT Input Parameters/XQuery
External Variables dialog are specified at the application-level, and will be passed to the
respective XSLT document for every transformation that is carried out via the IDE from that
point onward. This means that:
parameters are not associated with any particular document
any parameter entered in the XSLT Input Parameters/XQuery External Variables dialog
is erased once XMLSpy has been closed.
The XSLT file contains a local parameter called footer in the template for the root element.
This parameter has a default value of footer1. The parameter value is instantiated
subsequently in the template with a $footer value in the definition of the footer block.
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fo="http://www.w3.org/1999/XSL/Format">
...
<xsl:param name="footer" select="document/footer1" />
...
<xsl:template match="/">
<fo:root>
<xsl:copy-of select="$fo:layout-master-set" />
<fo:page-sequence master-reference="default-page"
initial-page-number="1" format="1">
<fo:static-content flow-name="xsl-region-after"
display-align="after">
...
<fo:inline color="#800000" font-size="10pt" font-weight="bold">
<xsl:value-of select="$footer"/>
</fo:inline>
...
</fo:static-content>
</fo:page-sequence>
</fo:root>
</xsl:template>
</xsl:stylesheet>
In the XSLT Input Parameters dialog, a new value for the footer parameter can be entered,
such as the XPath: document/footer2 (see screenshot above) or a text string. During
transformation, this value is passed to the footer parameter in the template for the root
element and is the value used when the footer block is instantiated.
Note:
If you use the XSL:FO Transformation command (XSL/XQuery | XSL:FO
Transformation), parameters entered in the XSLT Input Parameters/XQuery External
Variables dialog are not passed to the stylesheet. In order for these parameters to be
used in PDF output, first transform from XML to FO using the XSLT Transformation
command (XSL/XQuery | XSL Transformation), and then transform the FO to PDF
using the XSL:FO Transformation command (XSL/XQuery | XSL:FO
Transformation).
If you use an XSLT processor other than the built-in Altova XSLT Engines, parameters
you enter using the XSLT Input Parameters command will not be passed to the external
processor.
Note: Once a set of external XQuery variables are entered in the XSLT Input
Parameters/XQuery External Variables dialog, they are used for all subsequent transformations
until they are explicitly deleted or the application is restarted. Variables entered in the XSLT
Input Parameters/XQuery External Variables dialog are specified at the application-level, and
will be passed to the respective XQuery document for every execution that is carried out via the
IDE from that point onward. This means that:
Variables are not associated with any particular document
Any variable entered in the XSLT Input Parameters/XQuery External Variables dialog is
erased once the application (XMLSpy) has been closed down.
This XQuery returns Peter Jones, if the value of the external variable (entered in the XSLT
Input Parameters/XQuery External Variables dialog) is Peter. Note the following:
The external keyword in the variable declaration in the XQuery document indicates
that this variable is an external variable.
Defining the static type of the variable is optional. If a datatype for the variable is not
specified in the variable declaration, then the variable value is assigned the type
xs:untypedAtomic.
If an external variable is declared in the XQuery document, but no external variable of
that name is passed to the XQuery document, then an error is reported.
If an external variable is declared and is entered in the XSLT Input Parameters/XQuery
External Variables dialog, then it is considered to be in scope for the XQuery document
being executed. If a new variable with that name is declared within the XQuery
document, the new variable temporarily overrides the in-scope external variable. For
example, the XQuery document below returns Paul Jones even though the in-scope
external variable $first has a value of Peter.
xquery version "1.0";
declare variable $first as xs:string external;
let $first := "Paul"
let $last := "Jones"
return concat($first, " ", $last )
Note: It is not an error if an external XQuery variable (or XSLT parameter) is defined in the
XSLT Input Parameters/XQuery External Variables dialog but is not used in the XQuery
document. Neither is it an error if an XSLT parameter (or external XQuery variable) is defined in
the XSLT Input Parameters/XQuery External Variables dialog but is not used in an XSLT
transformation.
XQuery execution tasks can therefore be automated with the use of Altova XML. For example,
you can create a batch file that calls Altova XML to execute a set of XQuery documents. See
the Altova XML documentation for details.
The XSL/XQuery | Assign XSL... command assigns an XSLT stylesheet to an XML document.
Clicking the command opens a dialog to let you specify the XSLT file you want to assign. You
can also select a file via a global resource or a URL (click the Browse button) or a file in one of
the open windows in XMLSpy (click the Window button).
Please note: You can make the path of the assigned file relative by clicking the Make Path
Relative To... check box.
You can make the path of the assigned file relative by clicking the Make Path Relative To...
check box. You can also select a file via a global resource or a URL (click the Browse button)
or a file in one of the open windows in XMLSpy (click the Window button).
Please note: An XML document may have two XSLT files assigned to it: one for standard
XSLT transformations, a second for an XSLT transformation to FO.
The XSL/XQuery | Assign Sample XML File command assigns an XML file to an XSLT
document. The command inserts a processing instruction naming an XML file to be processed
with this XSLT file when the XSL Transformation is executed on the XSLT file:
<?altova_samplexml C:\workarea\html2xml\article.xml?>
Please note: You can make the path of the assigned file relative by clicking the Make Path
Relative To... check box. You can also select a file via a global resource or a URL (click the
Browse button) or a file in one of the open windows in XMLSpy (click the Window button).
21.7.9 Go to XSL
The XSL/XQuery | Go to XSL command opens the associated XSLT document. If your XML
document contains a stylesheet processing instruction (i.e. an XSLT assignment) such as this:
<?xml-stylesheet type="text/xsl" href="Company.xsl"?>
then the Go to XSL command opens the XSLT document in XMLSpy.
Alt+F11
The XSL/XQuery | Stop Debugger command stops the debugger. This is not the same as
stopping the debugger session in which the debugger is running. This is convenient if you wish
to edit a document in the middle of a debugging session or to use alternative files within the
same debugging session. After stopping the debugger, you must restart the debugger to start
from the beginning of the XSLT/XQuery document.
The XSL/XQuery | Restart Debugger command clears the output window and restarts the
debugging session with the currently selected files.
The XSL/XQuery | End Debugger Session command ends the debugging session and returns
you to the normal XMLSpy view that was active before you started the debugging session.
Whether the output documents that were opened for the debugging session stay open depends
on a setting you make in the XSLT/XQuery Debugger Settings dialog.
F11
The XSL/XQuery | Step Into command proceeds in single steps through all nodes and XPath
expressions in the stylesheet. This command is also used to re-start the debugger after it has
been stopped.
Shift+F11
The XSL/XQuery | Step Out command steps out of the current node to the next sibling of the
parent node, or to the next node at the next higher level from that of the parent node.
Ctrl+F11
The XSL/XQuery | Step Over command steps over the current node to the next node at the
same level, or to the next node at the next higher level from that of the current node. This
command is also used to re-start the debugger after it has been stopped.
The XSL/XQuery | Show Current Execution Node command displays/selects the current
execution node in the XSLT/XQuery document and the corresponding context node in the XML
document. This is useful when you have clicked in other tabs which show or mark specific code
in the XSLT stylesheet or XML file, and you want to return to where you were before you did
this.
F9
Shift+F9
Ctrl+F9
The XSL/XQuery | Enable/Disable Breakpoint command (no toolbar icon exists) enables or
disables already defined breakpoints. The red breakpoint highlight turns to gray when the
breakpoint is disabled. The debugger does not stop at disabled breakpoints. To disable/enable
a breakpoint, place the cursor in that node name and click the Enable/Disable Breakpoint
command. This command is also available by right-clicking at the location where you want to
enable/disable the breakpoint.
Ctrl+Shift+F9
The XSL/XQuery | Enable/Disable Tracepoint command (no toolbar icon exists) enables or
disables already defined tracepoints. The blue tracepoint highlight turns to gray when the
tracepoint is disabled. No output is displayed for statements with disabled tracepoints. To
disable/enable a tracepoint, place the cursor in that node name and click the Enable/Disable
Tracepoint command. This command is also available by right-clicking at the location where
you want to enable/disable the tracepoint.
21.7.22 Breakpoints/Tracepoints
The check boxes indicate whether a breakpoint or tracepoint is enabled (checked) or disabled.
You can remove the highlighted breakpoint or tracepoint by clicking the corresponding Remove
button, and remove all breakpoints by clicking the corresponding Remove All button. The Edit
Code button takes you directly to that breakpoint/tracepoint in the file.
Use the down arrow to move the highlighted breakpoint to the Tracepoints pane and the
In the XPath column in the Tracepoints pane, you can set an XPath for each tracepoint.
The XSL/XQuery | XSLT/XQuery Settings command opens the XSLT/XQuery Settings dialog,
which enables you to set user options for the Debugger. See the XSLT/XQuery Debugger
section for details.
Additionally, StyleVision Power Stylesheets can be created to display an editable XML view of a
database. The StyleVision Power Stylesheet contains information for connecting to the
database, displaying the data from the database in Authentic View, and writing back to the
database.
The Authentic menu contains commands relevant to editing XML documents in Authentic View
. For a tutorial on Authentic View, see the Tutorials section.
Clicking the New Document... command opens the Create New Document dialog.
Browse for the required SPS file, and select it. This opens an XML document template in
Authentic View.
Please note: StyleVision Power Stylesheets are created using Altova StyleVision. The
StyleVision Power Stylesheet has a Template XML File assigned to it. The data in this XML file
provides the starting data of the new document template that is opened in Authentic View.
Clicking the Edit Database Data... command opens the Edit Database Data dialog.
Browse for the required SPS file, and select it. This connects to the DB and opens an editable
view of the DB in Authentic View. The design of the DB view displayed in Authentic View is
contained in the StyleVision Power Stylesheet.
Please note: If, with the Edit Database Data... command, you attempt to open a StyleVision
Power Stylesheet that is not based on a DB or to open a DB-based StyleVision Power
Stylesheet that was created in a version of StyleVision prior to the StyleVision 2005 release, you
will receive an error.
Please note: StyleVision Power Stylesheets are created using Altova StyleVision.
In the example above, the StyleVision Power Stylesheet is called HTML_Orgchart.sps, and it
is located in the same directory as the XML file.
Please note: Previous versions of Altova products used a processing instruction with a target or
name of xmlspysps, so a processing instruction would look something like <?xmlspysps
HTML-Orgchart.sps?>. These older processing instructions are still valid with Authentic View
in current versions of Altova products.
When an XML DB is used as the XML data source, the XML data that is displayed in Authentic
View is the XML document contained in one of the cells of the XML data column. The Select
New Row with XML Data for Editing command enables you to select an XML document from
another cell (or row) of that XML column. Selecting the Select New Row... command pops up
the Choose XML Field dialog (screenshot below), which displays the table containing the XML
column.
You can enter a filter for this table. The filter should be an SQL WHERE clause (just the condition,
without the WHERE keyword, for example: CID>1002). Click Update to refresh the dialog. In the
screenshot above, you can see the result of a filtered view. Next, select the cell containing the
required XML document and click OK. The XML document in the selected cell (row) is loaded
into Authentic View.
An entity is useful if you will be using a text string, XML fragment, or some other external
resource in multiple locations in your document. You define the entity, which is basically a short
name that stands in for the required data, in the Define Entities dialog. After defining an entity
you can use it at multiple locations in your document. This helps you save time and greatly
enhances maintenance.
There are two broad types of entities you can use in your document: a parsed entity, which is
XML data (either a text string or a fragment of an XML document), or an unparsed entity,
which is non-XML data such as a binary file (usually a graphic, sound, or multimedia object).
Each entity has a name and a value. In the case of parsed entities the entity is a placeholder for
the XML data. The value of the entity is either the XML data itself or a URI that points to a .xml
file that contains the XML data. In the case of unparsed entities, the value of the entity is a URI
that points to the non-XML data file.
To define an entity:
1. Click Authentic | Define XML Entities.... This opens the Define Entities dialog.
2. Enter the name of your entity in the Name field. This is the name that will appear in the
Entities Entry Helper.
3. Enter the type of entity from the drop-down list in the Type field. Three types are
possible. An Internal entity is one for which the text to be used is stored in the XML
document itself. Selecting PUBLIC or SYSTEM specifies that the resource is located
outside the XML file, and will be located with the use of a public identifier or a system
identifier, respectively. A system identifier is a URI that gives the location of the
resource. A public identifier is a location-independent identifier, which enables some
processors to identify the resource. If you specify both a public and system identifier,
the public identifier resolves to the system identifier, and the system identifier is used.
4. If you have selected PUBLIC as the Type, enter the public identifier of your resource in
the PUBLIC field. If you have selected Internal or SYSTEM as your Type, the PUBLIC
field is disabled.
5. In the Value/Path field, you can enter any one of the following:
If the entity type is Internal, enter the text string you want as the value of your entity.
Do not enter quotes to delimit the entry. Any quotes that you enter will be treated as
part of the text string.
If the entity type is SYSTEM, enter the URI of the resource or select a resource on
your local network by using the Browse button. If the resource contains parsed data,
it must be an XML file (i.e. it must have a .xml extension). Alternatively, the resource
can be a binary file, such as a GIF file.
If the entity type is PUBLIC, you must additionally enter a system identifier in this field.
6. The NDATA entry tells the processor that this entity is not to be parsed but to be sent to
the appropriate processor. The NDATA field should therefore be used with unparsed
entities only.
Dialog features
You can append, insert, and delete entities by clicking the appropriate buttons. You can also
sort entities on the alphabetical value of any column by clicking the column header; clicking
once sorts in ascending order, twice in descending order. You can also resize the dialog box
and the width of columns.
Once an entity is used in the XML document, it is locked and cannot be edited in the Define
Entities dialog. Locked entities are indicated by a lock symbol in the first column. Locking an
entity ensures that the XML document valid with respect to entities. (The document would be
invalid if an entity is referenced but not defined.)
Limitations
An entity contained within another entity is not resolved, either in the dialog, Authentic
View, or XSLT output, and the ampersand character of such an entity is displayed in its
escaped form, i.e. &.
External entities are not resolved in Authentic View, except in the case where an entity
is an image file and it is entered as the value of an attribute which has been defined in
the schema as being of type ENTITY or ENTITIES. Such entities are resolved when
the document is processed with an XSLT generated from the SPS.
The Hide Markup command hides markup symbols in the Authentic View.
The Show Small Markup command shows small markup symbols in the Authentic View.
The Show Large Markup command shows large markup symbols in the Authentic View.
The Show Mixed Markup command shows mixed markup symbols in Authentic View. The
person who designs the StyleVision Power Stylesheet can specify either large markup, small
markup, or no markup for individual elements/attributes in the document. The Authentic View
user sees this customized markup in mixed markup viewing mode.
The Append Row command appends a row to the current table in Authentic View.
The Insert Row command inserts a row into the current table in Authentic View.
The Duplicate Row command duplicates the current table row in Authentic View.
The Delete Row command deletes the current table row in Authentic View.
The Move Row Up command moves the current table row up by one row in Authentic View.
The Move Row Down command moves the current table row down by one row in Authentic
View.
21.9 DB Menu
The DB menu contains the following menu items:
Query Database, which enables you to query a variety of databases.
IBM DB2, which contains commands that provide support for DB2-specific functionality.
SQL Server, which contains commands for managing SQL Server databases.
Oracle databases, which contains command for working with Oracle databases.
Since all the operations described in this section require a connection to a database, this
section also includes a sub-section called Connecting to a Data Source.
Each option is described in the subsections of this section. The descriptions in this section
explain only the connection mechanism. The dialogs that appear subsequent to the connection
process are dependent on the specific command being executed, and these dialogs are
therefore described in the sections relating to that specific command. For example, if you are
looking for a description of the command Convert | Import Database Data, the description for
the connection process is in this section, but the selection of DB tables is described in the
section Convert | Import Database Data.
Native or ODBC?
When making the connection, you will be prompted to select between making a connection
natively or making it via ODBC (see screenshot below). An ODBC connection might have
limitations, so it is recommended to use the Natively option, which is the default option. If you
experience difficulties with teh native connection, use the ODBC option.
Supported databases
The following databases are supported. After connecting to the database, the available root
objects for each of the supported databases is as follows:
Note: XMLSpy fully supports the databases listed above. While Altova endeavors to support
other ODBC/ADO databases, successful connection and data processing have only
been tested with the listed databases.
Connection Wizard
In the Connect to Data Source dialog, when the Connection Wizard button is selected, the
Connection Wizard (screenshot below) pops up. The Connection Wizard helps you to connect
to the most commonly used types of databases. In this section, we go through the connection to
a Microsoft Access database and an IBM DB2 database.
MS Access
Carry out the following steps to connect to an MS Access database. Select Microsoft Access
(ADO) (screenshot below), and click Next.
In the Connect to MS Access dialog that pops up, browse for the MS Access database, and
click Next. The connection to the data source is established. For information about subsequent
dialogs, refer to the description of the command being executed.
IBM DB2
In the first screen of the Connection Wizard (see first screenshot in this section), select IBM
DB2 and click Next. The Connection dialog (screenshot below) pops up. The wizard will then
guide you in configuring the connection to the IBM DB2 database and making the connection.
These steps consist essentially of selecting the appropriate driver to connect to the DB, then
locating the DB, and entering user information that enables you to connect.
In the Configuration dialog above, select an existing data source, or create a new data source
with an appropriate driver (additional drivers can be added to the list of available drivers by
clicking the Edit Drivers button and selecting the required drivers). In the following screen you
will be prompted for user information (ID and password). Clicking OK will establish the
connection with the database. For information about subsequent dialogs, refer to the description
of the command being executed.
Existing Connections
In the Connect to Data Source dialog, when the Existing Connections button is selected, the
Existing Connections pane opens (screenshot below), showing all the connections that are
currently established.
Select the required database and click Connect. The connection to the database is established.
For information about subsequent dialogs, refer to the description of the command being
executed.
ADO Connections
The ADO Connections option enables you to connect to a DB via ADO. In this section, the
connection via ADO is described using an IBM DB2 database as the target DB. Where options
are different if another type of database is the target DB, these differences are noted.
1. In the Connect to Data Source dialog, select ADO Connections. The ADO Connections
box appears (screenshot below).
2. Click the Build button. The Data Link Properties dialog (screenshot below) opens.
3. Select Microsoft OLE DB Provider for ODBC Drivers from the drop-down list and click
Next. The Connection tab is activated. (For Microsoft SQL DBs, we recommend
Microsoft OLE DB Provider for SQL Server; for Oracle, MySQL, Sybase, and IBM DB2
DBs, Microsoft OLE DB Provider for ODBC Drivers.)
4. Build a connection string via the Build button (the dialog which pops up prompts you for
a data source and user information). In the case of some databases (such as Microsoft
SQL Server), you do not build a connection string but instead select the server and
database from combo box listings.
5. If login information is required, enter a user name and password, and check the Allow
Saving Password check box.
6. Click OK. The Data Link Properties dialog closes. The connection string appears in the
ADO Connections box (screenshot below).
7. Click the Connect button. The connection to the data source is established. For
information about subsequent dialogs, refer to the description of the command being
executed.
ODBC Connections
This section describes how to connect to a DB via ODBC. The steps listed below describe a
connection to an IBM DB2 database, but apply also to other types of databases that can be
connected via ODBC. To connect using an ODBC connection, do the following:
1. Select one of the options for specifying a Data Source Name (DSN). If you select
System DSN or User DSN, the available DSNs are displayed in the Data Source pane.
If you select File DSN, you are prompted to browse for the DSN file. Alternatively, you
can build a connection string to the DB by selecting the Build a Connection String
option.
2. If you wish to add a DSN to those in the Data Source pane, click the Create a New DSN
icon .
3. In the Create an ODBC DSN dialog that appears, select the required driver, then click
the User DSN or System DSN button.
4. In the dialog that appears (screenshot below), select the DB alias and give it a DSN.
5. Click OK to finish. The DB is added as a Data Source to the list in the Data Source
pane.
6. After you have selected the DataSource (via the System DSN or User DSN option), or
selected a DSN File (File DSN option), or built a connection string (Connection String
option), click Connect.
7. When you are prompted for your user ID and password, enter these and then click OK.
The connection to the database is established. For information about subsequent
dialogs, refer to the description of the command being executed.
Note: The listing in the data source pane (when the System DSN or User DSN option is
selected) can be edited using the Edit Selected DSN, Remove Selected DSN, and
Refresh Listed DSNs icons at the bottom of the ODBC Connections screen.
Clicking OK pops up a dialog that prompts for user information, including the User ID and
password. When you click OK in this dialog, the connection string is entered in the ODBC
Connections screen.
Global Resources
In the Connect to Data Source dialog, when the Global Resources button is selected, the
Global Resources pane opens (screenshot below), showing all the database-type global
resources that are defined in the currently active Global Resources XML File.
Select the required global resource and click Connect. The connection to the database is
established. For information about subsequent dialogs, refer to the description of the command
being executed.
The Database Query window has a toolbar at the top. At this point, take note of the two toolbar
icons below. The other toolbar icons are described in the section, Query Pane: Description and
Features.
Data Sources
In order to query a database, you have to first connect to the required database This section
describes how to:
Connect to a database, and
Select the required data source and root object from among multiple existing
connections.
Connecting to a database
When you click the Query Database command for the first time in a session (or when no
database connection exists), the Quick Connect dialog (screenshot below) pops up to enable
you to connect to a database. To make connections subsequently, click the Quick Connect
icon in the Database Query window.
How to connect to a database via the Quick Connect dialog is described in the section
Connecting to a Data Source.
The following databases are supported. After connecting to the database, the available root
objects for each of the supported databases is as follows:
Note: XMLSpy fully supports the databases listed above. While Altova endeavors to support
other ODBC/ADO databases, successful connection and data processing have only
been tested with the listed databases.
In the screenshot above, the database with the name StyleVision DB has been selected. Of
the available root objects for this database, the root object ALTOVA_USER has been selected.
The database and the root object are then displayed in the Browser pane.
To select a layout for the Browser, click the Layout icon in the toolbar of the Browser pane and
select the layout from the drop-down list (screenshot below). Note that the icon changes with
the selected layout.
Flat: Divides database objects by type in the first hierarchical level. For example,
instead of columns being contained in the corresponding table, all columns are
displayed in a separate Columns folder.
Table Dependencies: Categorizes tables according to their relationships with other
tables. There are categories for tables with foreign keys, tables referenced by foreign
keys and tables that have no relationships to other tables.
To sort tables into User and System tables, switch to Folders, No Schemas or Flat layout, then
right-click the Tables folder and select Sort into User and System Tables. The tables are
sorted alphabetically in the User Tables and System Tables folders.
2. Click the filter icon next to the folder you want to filter, and select the filtering option
from the popup menu, for example, Contains.
3. In the entry field that appears, enter the filter string (in the screenshot below, the filter
string on the Tables folder is NHE). The filter is applied as you type.
Hide DB Query Sets whether the DB Query window should be hidden when
on XML Open an XML document is opened for editing.
Auto-Commit When an edited XML document is saved in XMLSpy,
on XML Save changes are committed to the DB if this toggle is on.
Otherwise, changes have to be explicitly committed in the
Results Pane.
Options Open the Options dialog of SQL Editor.
Options
Clicking the Options icon in the Database Query toolbar pops up the Options dialog (
screenshot below). A page of settings can be selected in the left-hand pane, and the options on
that page can be selected. Click the Reset to Page Defaults button to reset the options on that
page to their original settings.
select only that category. The Set All Categories button selects all categories. You can
then deselect a category by clicking its button. The Clear All Categories button de-
selects all categories. The other buttons are the various category buttons.
To insert a region, select the statement/s to be made into a region, right-click, and select Insert
Region. The expandable/collapsible region is created. Add a name if you wish. In the
screenshot above, also notice the line-numbering. To remove a region, delete the two --region
and --endregion delimiters.
Use of bookmarks
Bookmarks can be inserted at specific lines, and you can then navigate through the bookmarks
in the document. To insert a bookmark, place the cursor in the line to be bookmarked, right-
click, and select Insert/Remove Bookmark. To go to the next or previous bookmark, right-
click, and select Go to Next Bookmark or Go to Previous Bookmark, respectively. To
remove a bookmark, place the cursor in the line for which the bookmark is to be removed, right-
click, and select Insert/Remove Bookmark. To remove all bookmarks, right-click, and select
Remove All Bookmarks.
Results tab
The data retrieved by the query is displayed in the form of a grid in the Results tab (screenshot
below). When the query results have been generated using the Execute Query command, the
XML documents in the Results tab are indicated with the XML icon (screenshot below). If
the Execute for Data Editing command was used, XML documents are shown with the
Editable XML icon .
The following operations can be carried out in the Results tab, via the context menu that pops
up when you right-click in the appropriate location in the Results tab:
Sorting on a column: Right-click anywhere in the column on which the records are to be
sorted, then select Sorting | Ascending/Descending/Restore Default.
Copying to the clipboard: This consists of two steps: (i) selecting the data range; and (ii)
copying the selection. Data can be selected in several ways: (i) by clicking a column
header or row number to select the column or row, respectively; (ii) selecting individual
cells (use the Shift and/or Ctrl keys to select multiple cells); (iii) right-clicking a cell, and
selecting Selection | Row/Column/All. After making the selection, right-click, and
select Copy Selected Cells. This copies the selection to the clipboard, from where it
can be pasted into another application.
Appending a new row: If the query was executed for editing, right-click anywhere in the
Results pane to access the Append row command.
Deleting a row: If the query was executed for editing, right-click anywhere in a row to
access the Delete row command.
Editing records: If the query was executed for editing, individual fields can be edited. To
commit changes, click the Commit button in the toolbar of the Results tab.
Editing XML records: If the query was executed for editing and an editable field is an
XML field (only IBM DB2 XML databases are currently supported), clicking the Editable
XML icon in the Result Grid opens the Edit XML menu (screenshot below). An XML
field can also be opened for data editing by right-clicking the XML filed in the Folders
pane and selecting the command Edit Data.
The Open for Editing command opens the XML document in an XMLSpy window, and
the Editable XML icon changes to , in which the three dots are red. When this
document is saved and if the Auto-Commit XML Changes icon in the Query
Database toolbar was selected when the document was opened, the changes to the
XML document are committed automatically to the database. Otherwise, saved
changes will have to be committed using the Commit button of the Results pane. (Note
that to toggle between the XML document window and the Database Query window,
you must click the DB | Query Database command.) The Load XML Document from
File command loads an external XML document to the selected field in the database.
The Save XML Document to File saves the XML document in the selected database
field to a file location you choose. The Assign XML Schema command pops up the
Choose XML Schema dialog, in which you can select an XML Schema to assign to the
XML document. This assignment is saved to the database. XML Schema assignment is
explained in more detail in the section, IBM DB2 | Assign XML Schema.
Set NULL, Set default, Undo changes for this cell: If the query was executed for editing,
right-clicking in a cell provides access to commands that enable you to set a NULL value
or, if defined, a column default value for that cell. Changes made to a cell can be
undone with the Undo changes for this cell command; the current edited value is
replaced by the value currently in the DB.
Go to Statement Highlights the statement in the SQL Editor that produced the
current result.
Find Finds text in the Results pane. XML document content is also
searched.
Add New Line Adds a new row to the Result Grid.
Delete Row Deletes the current row in the Result Grid.
Undo Changes Undoes all changes to the Result Grid.
to Result Grid
Commit Commits changes made in the Result Grid to the database.
Messages tab
The Messages tab provides information on the previously executed SQL statement and reports
errors or warning messages.
The toolbar of the Messages tab contains icons that enable you to customize the view, navigate
it, and copy messages to the clipboard. The Filter icon enables the display of particular types of
messages to be toggled on or off. The Next and Previous icons move the selection down and
up the list, respectively. Messages can also be copied with or without their child components to
the clipboard, enabling them to be pasted in documents. The Find function enables you to
specify a search term and then search up or down the listing for this term. Finally, the Clear
icon clears the contents of the Report pane.
Note: These toolbar icon commands are also available as context menu commands.
Both these mechanisms require that you connect to the required IBM DB2 database. How to
connect to the database is described in the section Connecting to a Data Source. In this section
the focus is on how to manage schemas in an IBM DB2 database and how to assign XML
Schemas to a DB XML file.
Note: The Result Grid of the Database Query window provides important functionality for
working with XML files in IBM DB2 databases. This functionality includes the ability to
open files for editing, loading XML files into a DB XML files, saving DB XML files
externally, and assigning XML Schemas to DB XML files.
The first thing to do if there is no connection to the required database is to connect to it. If a
connection already exists, it appears in the Database combo box. To start the connection
process, click the Quick Connect icon in the dialog. This pops up the Quick Connect dialog,
through which you can make the connection to the database. How to use the Quick Connect
dialog is explained in the section DB Menu | Connecting to a Data Source.
The combo box at right lists all the database schemas of the currently selected IBM DB2
database. When a database schema is selected in this combo box, all the XML Schemas
registered for the selected database schema are displayed in the main pane. In the screenshot
above, all the XML Schemas registered with the Altova_User database schema are listed,
together with their locations. Checking the Show Details check box causes additional
information columns to be displayed in the main pane.
To add a schema, click the Add button, browse for the required schema file, and select it. The
selected schema file is added to the list in the main pane. Clicking the Commit Changes button
registers the newly added schema with the database schema.
To drop a schema, select the schema in the main pane and click the Drop Schema button. A
Drop Flag is assigned to the schema, indicating that it is scheduled for dropping when changes
are next committed. The Drop Flag can be removed by selecting the flagged schema and
clicking the Remove Drop Flag button. When the Commit Changes button is clicked, all
schemas that have been flagged for dropping will be unregistered from the database schema.
Clicking the View Schema button opens the schema in XMLSpy. To close the XML Schema
Management dialog, click the Close button.
Reports
When the Commit Changes button is clicked, the database is modified according to the
changes you have made. A report of the Commit action is displayed in the Report pane (
screenshot below), enabling you to evaluate whether the success of the action and to debug
possible errors. Each subsequent report is displayed below the previous report.
The report pane has a toolbar containing icons that enable you to customize the display of the
report listing, navigate the listing, copy report messages, search for text, and clear the pane (
see screenshot below).
The Filter icon enables the display of particular types of messages to be toggled on or off. The
Next and Previous icons move the selection down and up the list, respectively. Messages can
also be copied with or without their child components to the clipboard, enabling them to be
pasted in documents. The Find function enables you to specify a search term and then search
up or down the listing for this term. Finally, the Clear icon clears the contents of the Report
pane.
Selecting the Open for Editing command opens the XML document in XMLSpy, where it can
be edited.
A schema can be selected from among those stored in the database (these are listed in the
dropdown list of the Schema from Database combo box), or from among external files that can
be browsed. Clicking OK assigns the schema to the XML file. Note that the assignment is not
written into the XML file. When the XML file is saved in XMLSpy—and if the Auto-Commit XML
changes icon in the Query Database toolbar was selected when the document was opened
—then the schema assignment is saved to the database. Note that the schema assignment is
written to the database—and not to the XML file.
Note: The Edit XML menu in the Result Grid of the Database Query window also has an
Assign XML Schema command (see screenshot below), which also assigns a schema
to the DB XML file.
The difference between the two Assign XML Schema commands is that the command
in the DB | IBM DB2 menu enables you to assign an XML Schema while you are editing
the XML file thereby allowing you to change schema assignments while editing the XML
document and to validate the XML document immediately.
The dialog box provides a Quick Connect icon which calls the Quick Connect wizard to
connect to a data source. If more than one connection currently exists, the required connection
can be selected from the combo box on the to left-hand side. The required root object can then
be selected from the right-hand side combo box. All the XML Schemas currently in the
repository for that root object are displayed in the dialog box. The name, location, and
namespace of each schema are listed, as well as the option for decomposition..
Note that the stored schemas can also be viewed in the Database Query window (screenshot
below), but they cannot be managed there. To manage schemas, use the XML Schema
Management for Databases dialog.
After changes have been committed, a report of the commit action can be viewed in the Report
tab (screenshot below).
The dialog box provides a Quick Connect icon which calls the Quick Connect wizard to
connect to a data source. If more than one connection currently exists, the required connection
can be selected from the combo box on the to left-hand side. The required root object can then
be selected from the right-hand side combo box. All the XML Schemas currently in the
repository for that root object are displayed in the dialog box. The name, location, and
namespace of each schema are listed, as well as the option for decomposition..
Note that the stored schemas can also be viewed in the Database Query window (screenshot
below), but they cannot be managed there. To manage schemas, use the XML Schema
Management for Databases dialog.
After changes have been committed, a report of the commit action can be viewed in the Report
tab (screenshot below).
This command allows you to browse the XML documents available on your server. The server
details are automatically filled in if you previously queried the database or listed schemas. If this
is not the case, then you have to enter them manually.
Use the tree view to find specific XML files. Double clicking a file in the tree view opens it. You
can also click a file and click Open to achieve the same thing. The New Folder button adds a
new folder, the Delete button deletes the currently selected XML file.
This command lets you import any structured text file into XMLSpy and convert it to XML
format immediately. This is useful when you want to import legacy data from older systems. The
steps for importing data in a text file as an XML document are described below.
1. Select the menu item Convert | Import Text File. The following dialog appears:
Path
Enter the path to the file to import in the Path text box, or select the file using the
Browse button to the right of the text box. After the file is selected, a Grid View preview
of the XML file is displayed in the Preview pane. Any change in the options selected in
this dialog will be reflected in the preview immediately.
Delimiter
To successfully import a text file, you need to specify the field delimiter that is used to
separate columns or fields within the file. XMLSpy will auto-detect common row
separators (CR, LF, or CR+LF).
String quotes
Text files exported from legacy systems sometimes enclose textual values in quotes to
better distinguish them from numeric values. If this is the case, you can specify what
kind of quotes are being used in your file, and remove them automatically when the
data is imported.
Encoding
The data is converted into Unicode (the basis of all XML documents), so you need to
specify which character-set the file is currently encoded in. For US or Western
European Windows systems this will most likely be Codepage 1252, also referred to as
the ANSI encoding.
Byte order
If you are importing 16-bit or 32-bit Unicode (UCS-2, UTF-16, or UCS-4) files, you can
also switch between little-endian and big-endian byte order.
Preview
In the Preview pane you can rename column headers by clicking in a name and editing
it. The column headers will be the element or attribute names in the XML document.
You can select whether a column should be an element or an attribute in the XML
document, or whether it should not be imported into the XML document. In the
screenshot above, Col1 is an element, Col2 is an attribute, and Col3 will not be
imported.
When you are satisfied with the options, click Import. The imported data is converted
into an XML document that is displayed in Grid View.
The Import Database Data command enables you to import data from any of a variety of
databases into an XML file. The import mechanism involves two steps:
1. A connection to the database is established.
2. The data to be imported is selected.
2. Select Convert Database Data into XML and click OK. The Connect to a Data Source
dialog appears. (The Map Database Data into XML Based on Existing DTD/Schema
option requires the use of Altova MapForce to carry out the mapping.)
3. In the Connect to Data Source dialog, you establish a connection to the database. How
to do this for different types of databases is explained in the section, Connecting to a
Data Source.
4. After the connection to the database is established, the Import Database Data dialog
displays tabs and windows that enable you to select the database data to import. These
options are described below. After finishing, click the Import button to import the
database data.
Selection tab
In the Selection tab (screenshot above), the Source pane (screenshot below) displays either a
representation of the tables of the database or an editable SQL statement for selecting the
required tables, each view being selected by clicking the respective radio button.
In the Table view, you can select the tables in the database that you want to import by checking
the table's check box (screenshot above). The contents of the table can then be displayed in the
Preview pane. The table selection can be further filtered in the Preview pane (see below).
The database structure can be displayed differently and can be filtered. The Layout icon
in the Source pane enables you to organize database objects into: (i) folders based on object
type; (ii) folders based on object type, but without schema folders; (iii) in a hierarchy, but without
folders; and (iv) categories of tables, based on their relationships with other tables.
Clicking the Filter Folder Contents icon applies a filter to the selected folder (in the
screenshot below, to the Tables folder). Clicking the filter icon on the table pops out a menu
with a list of filter possibilities. In the screenshot below, the filter has been set to display objects
that contain the text Sys in its name. The view is filtered accordingly.
Clicking the Object Locator icon pops up a text field, which behaves like a Search entry field.
You can enter a text string and the dropdown list will display all the objects whose names
contain that text string. Selecting one of these objects from the dropdown list will highlight that
object in the tree.
Options tab
In the Options tab (screenshot below), you can specify how number, date, and time values are
to be imported; whether data is imported as elements or attributes; and whether comments and
NULL fields are to be included in the import.
When NULL fields are enabled for import, you can enter a substitution XML value for them.
Preview pane
The Preview pane (screenshot below) displays the structure of the table currently selected in
the Selection tab. When a new table is selected in the Selection tab, click the Preview button in
the Preview pane to display the table. Click the Refresh button to refresh the preview.
Datatype conversions
Information about the conversion of database datatypes to XML Schema datatypes is listed in
the Appendices.
This command enables the direct import of any Word document and conversion into XML
format if you have been using paragraph styles in Microsoft Word. This option requires
Microsoft Word or Microsoft Office (Version 97 or 2000).
When you select this command, the Open dialog box appears. Select the Word document you
want to import.
XMLSpy automatically generates an XML document with included CSS stylesheet. Each Word
paragraph generates an XML element, whose name is defined as the name of the
corresponding paragraph style in Microsoft Word.
The Create XML Schema from DB Structure command enables you to create an XML
Schema from the structure of any of a variety of databases. The XML Schema-creation
mechanism involves two steps:
1. A connection to the database is established.
2. Options for the database data selection and the XML Schema are specified.
Selection tab
In the Selection tab (screenshot below), the data source is listed in the Source Database pane.
The Source pane displays either a representation of the tables of the database or an editable
SQL statement for selecting the required tables.
In the Table view, you can select the tables in the database that you want to import by checking
the table's check box (screenshot above). The contents of the table can then be displayed in the
Preview pane. The table selection can be further filtered in the Preview pane (see below). You
can configure the display in the Source pane as described in the section Import Database Data.
Options tab
In the Options tab (screenshot below), you can specify the format of the schema, its extension
type, whether columns should be imported as elements or attributes, and the database
constraints that should be generated in the schema.
Schema format: You can select between a flat (SQL/XML Standard) and a hierarchical
schema form
The flat schema model is based on an ISO-ANSI Working draft titled XML-Related
Schema extension type: Schema extension information is additional information read from a
database that is then embedded in the schema as either annotation data or attributes. There
are four extension type options when generating schemas: (i) no extensions information; (ii)
SQL/XML extensions; (iii) MS SQL Server extensions; and (iv) Oracle extensions. These are
described below:
None: No additional information is provided by the database.
SQL XML: SQL/XML extensions are only inserted when generating schemas in a Flat
Format. The extension information is stored in annotations, and is described in the
SQL/XML Working Draft.
MS SQL Server: Selecting Microsoft SQL Server, generates SQL Server extensions.
See Using Annotations in XSL Schemas in the the SQL Server Books Online for
detailed information (Download from
http://www.microsoft.com/sql/techinfo/productdoc/2000/books.asp). The following
subset of annotation data are generated in the schema: sql:relation, sql:field,
sql:datatype, sql:mapped.
Oracle: Oracle extensions are selected by default when working with an Oracle
database. Additional database information is stored as attributes. A full description of
these attributes can be found at
http://download-west.oracle.com/docs/cd/B10501_01/appdev.920/a96620/xdb05obj.htm
#1027227 (You need to have access to the Oracle Technology network to access this
page.) The following subset of attributes is currently generated: SQLName, SQLType,
SQLSchema.
Note: Although SQL Server and Oracle extensions can be generated for their respective
databases they are not restricted in this way. This proves useful when working with a
third database and wanting to generate a schema that later should be working with
either SQL Server or Oracle.
Preview pane
The Preview pane (screenshot below) displays the structure of the table currently selected in
the Selection tab. When a new table is selected in the Selection tab, click the Refresh button in
the Preview pane to refresh the preview.
Datatype conversions
Information about the conversion of database datatypes to XML Schema datatypes is listed in
the Appendices.
The DB Import Based on XML Schema command creates an XML document which is valid
according to a given XML Schema and contains data imported from a database. For this
feature, the following databases are supported:
Microsoft Access 2000 and 2003
Microsoft SQL Server
Oracle
MySQL
Sybase
IBM DB2
The data to be imported is determined by the table that is selected in the database. With the
required XML Schema (that on which you wish to base the import) as the active document in
Schema View, connect to the database. Then select the table/s you wish to import, and click
Import. The data is imported into an XML document, and the document has the structure of the
XML Schema that was active when the data was imported.
In the example below, data from an MS Access database is imported with an XML Schema
active in Schema View. These would be the steps to carry out for the import:
1. Open the schema file in Schema View (screenshot below).
2. Select the menu command DB Import based on XML Schema. This opens the
Connect to Data Source dialog.
3. Select the Microsoft Access (ADO) option and click Next.
4. Click Browse and select the database file. Then click Next.
5. In the DB Import Based on XML Schema dialog which pops up, go to the Tables tab,
select one or more tables you wish to import (for example, Altova), then click Import.
The table is imported into an XML document that is displayed in Grid View.
Datatype conversions
Information about the conversion of database datatypes to XML Schema datatypes is listed in
the Appendices.
XMLSpy allows you to create an empty database (or skeleton database) based on an existing
schema file. The method described below is generally the same for each type of database.
1. Open the schema file in Schema/WSDL View
2. Select the menu command Convert | Create DB Structure from XML Schema. This
pops up the Connect to a Data Source dialog, which enables you to connect to a
database (DB).
3. Use the steps described in the section Connecting to a Data Source to connect to the
required database. For example, to connect to a Microsoft Access database, select the
Microsoft Access radio button, and continue the process to select a database. You can
use an existing database or create a new database in which the schema structure will
be contained.
4. In the Create DB Structure from XML Schema dialog, tables are created from the
schema and displayed in a tree format at the location where they they will occur in the
DB. For example, in the screenshot below, the Address table is created and selected
for export. Tables that should not be exported should be deselected (by unchecking the
check box or selecting the appropriate item from the context menu for that table).
5. If you wish to drop (delete) tables in an existing DB that have the same name as tables
coming in from the schema, then check the Drop Existing Tables with the Same name
check box.
In the Relationships tab, you can create and modify table relationships. The tab lists all possible
primary-key/foreign-key relationships (screenshot below).
You can also remove a relationship by selecting it and then clicking the Minus button.
MS SQL Server OK * OK OK
Oracle OK * OK OK
MySQL - OK * OK
Sybase - OK * OK
IBM DB2 - OK * OK
XMLSpy will map both hierarchical and flat formatted schemas. XMLSpy recognizes both
formats automatically.
The flat format is mapped to SQL in two different ways.
SQL Server DB, Oracle DB, or Sybase DB:
A schema that was generated in flat format, for one of the above databases, will have
the schema catalog name extracted and used in the generated SQL script as the DB
name. This means that the resulting SQL script will be executed on a target DB whose
name must be identical to the schema catalog name.
Access (2000 or 2003), MySQL, or DB2 DB:
A schema that was generated in flat format, for one of the above databases, will ignore
the schema catalog name when the SQL script is generated. This means that the
resulting SQL script will be executed on a target database that was logged into.
Datatype conversions
Information about the conversion of XML Schema datatypes to database datatypes is listed in
the Appendices.
The command Convert | Export to Text Files exports XML data into text formats for exchange
with databases or legacy systems. On clicking this command, the Export XML to Text dialog
pops. It consists of two parts (shown separately in the screenshots below):
an upper part with two tabs: (i) Selection, and (ii) Export Options.
a lower part, which is a Preview window.
After you have selected the desired options in this dialog (described below), click the Export
button to export to text file/s.
Selection
In the Selection tab (screenshot below), you can select the destination of the file to be exported
and text generation options.
Destination: The exported file can be saved directly to a folder. The file extension can be
specified. The filenames will be those of the elements (in the XML file) that will be exported.
Alternatively, untitled files can be exported to XMLSpy. These files will be displayed in the GUI,
and can be saved later.
Include comments: Activate this option to include a comment in the exported XML file that
shows the SQL query used to select the data, as well as a list containing one item for each
column header in the database table.
Create first row with field names: When activated, the exported tables include the database
column names.
Remove delimiters: Removes delimiters that are contained in text values in the exported data.
Set the delimiter you want to remove by using the Delimiter combo box in this tab. For example,
if this option is activated and the selected delimiter is the apostrophe, when you export the XML
value Ba'ker, the string will be Baker in the exported text.
Delimiter: Select from the drop-down list the character that you wish to have removed during
export. Alternatively, enter the desired character string.
String quotes: This puts each string of data into the quotes specified in this combo box.
Encoding: Select from the drop-down list, the desired encoding for files that are generated
during export.
Byte order: If you are importing 16-bit or 32-bit Unicode (UCS-2, UTF-16, or UCS-4) files, you
can also switch between little-endian and big-endian byte order.
Export Options
Additional export options, which are described below, can be specified in the Export Options tab
(screenshot below):
Start point of export: You can choose to export the entire XML document or restrict your
export to the data hierarchy starting from the currently selected element. The number of
sub-levels below the start point that will be exported is specified in the Export Depth option.
Export depth: Specifies the number of sub-levels below the start point that will be exported.
Export fields: Depending on your XML data, you may want to export only elements, attributes,
or the textual content of your elements. Note that you can deselect the export of individual
elements in the Preview window.
Automatic fields: XMLSpy will produce one output file or table for each element type selected.
You can choose to automatically create primary/foreign key pairs to link your data in the
relational model, or define a primary key for each element.
Exclude namespace name: Together with the Replace Colon With Underscore radio button
this is an either/or choice. Specifies whether namespace prefixes of elements and attributes
should be excluded or whether the colon in the namespace prefix should be replaced with an
underscore.
Preview window
The Preview window (screenshot below) is displayed below the Selection and Export Options
tab.
In the Resulting Elements from XML File pane, shows the node name that will be exported and
the name in the generated file. You can select/deselect nodes that will be exported. When an
element is selected, a preview of its structure is shown in a second pane below. In this pane,
clicking to the left of a column name toggles the export of that column on and off. In the
screenshot above, the paidnewyear column has been toggled off, so it will not be exported.
The command Convert | Export to a Database exports XML data to a database. On clicking
this command, the Connection Wizard starts up and enables you to set up a connection to the
database you wish to update. After a connection has been established, the Export Data to
Database dialog pops. It consists of two parts (shown separately in the screenshots below):
an upper part with two tabs: (i) Selection, and (ii) Export Options.
a lower part, which is a Preview window.
After you have selected the desired options in this dialog (described below), click the Export
button to export to the database.
Selection
In the Selection tab, you can select the destination database and table generation options. The
destination field selects the connection to the database. You must select whether the data is
created as new tables, updates existing tables, or first tries to update an existing table and then
creates a new table if an an update is not possible. You can also set a stop action based on the
number of errors, and, optionally, SQL script logging.
Export Options
Export options, which are described below, can be specified in the Export Options tab (
screenshot below):
Start point of export: You can choose to export the entire XML document or restrict your
export to the data hierarchy starting from the currently selected element. The number of
sub-levels below the start point that will be exported is specified in the Export Depth option.
Export depth: Specifies the number of sub-levels below the start point that will be exported.
Export fields: Depending on your XML data, you may want to export only elements, attributes,
or the textual content of your elements. Note that you can deselect the export of individual
elements in the Preview window.
Automatic fields: XMLSpy will produce one output file or table for each element type selected.
You can choose to automatically create primary/foreign key pairs to link your data in the
relational model, or define a primary key for each element.
Exclude namespace name: Together with the Replace Colon With Underscore radio button
this is an either/or choice. Specifies whether namespace prefixes of elements and attributes
should be excluded or whether the colon in the namespace prefix should be replaced with an
underscore.
Null value and text field length: Text strings in the XML document that should be treated as
NULL values can be specified, and the length of text fields in the database can be specified.
Preview window
The Preview window (screenshot below) is displayed below the Selection and Export Options
tab.
In the Resulting Elements from XML File pane, shows the node name that will be exported and
the name in the generated file. You can select/deselect nodes that will be exported. When an
element is selected, a preview of its structure is shown in a second pane below. In this pane,
clicking to the left of a column name toggles the export of that column on and off. In the
screenshot above, the paidnewyear column has been toggled off, so it will not be exported.
When the element's table structure shows the data, the key constraint type can be set by
clicking to the left of a column name. When the element's table structure shows field definitions,
the definitions can be edited by selecting the definition and selecting an option from the
definition's combo box (see screenshot above).
XMLSpy provides intelligent editing features for JSON documents. These are described in the
JSON Editing Features section of the documentation.
Given below is an example of a source XML document, and, below it, the JSON document
generated by the Convert XML to/from JSON command.
XML document
<?xml version="1.0" encoding="UTF-8"?>
<Person first="Jim" last="James">
<Address>
<street>4 New Street</street>
<city>New York</city>
<state>NY</state>
<code>10123</code>
</Address>
<Tel type="home">
123 123-1234
</Tel>
<Tel type="office">
123 987-9876
</Tel>
</Person>
JSON document
{
"XML": {
"version": 1.0,
"encoding": "UTF-8"
},
"Person": {
"first": "Jim",
"last": "James",
"Address": {
"street": "4 New Street",
"city": "New York",
"state": "NY",
"code": 10123
},
"Tel": [ { "type": "home",
"Text": "\r 123 123-1234\r "}, { "type": "office",
"Text": "\r 123 987-9876\r "} ]
}
}
To convert a JSON document to XML, make the JSON document active and click the Convert
XML to/from JSON command.
This command switches the current view of the document to Text View, which enables you to
edit the document in its text form. It supports a number of advanced text editing features,
described in detail in Text View section of this document.
Please note: You can configure aspects of the Text View using options available in the various
tabs of the Options dialog (Tools | Options).
If the previous view was the Text View, the document is automatically checked for
well-formedness.
For further information on this view, please see the Grid View section of this documentation.
This command switches the current document to Schema Design View. The switch will be
successful only if the document is an XML Schema document. This view is described in detail in
the Schema View section of this documentation.
This command switches the current document into the Authentic View.
Authentic View enables you to edit XML documents based on StyleVision Power Stylesheet
templates created in StyleVision! The templates in StyleVision are saved as StyleVision
Power Stylesheets (*.sps files), and supply all the necessary information needed by Authentic
View.
To open a template select the File | New command and then click the Select a StyleVision
stylesheet... button. Please see the Authentic View documentation for further information.
Please note: If, when you try to switch to Authentic View, you receive a message saying that a
temporary (temp) file could not be created, contact your system administrator. The system
administrator must change the default Security ID for "non-power users" to allow them to create
folders and files.
This view uses an XML-enabled browser to render the XML document using information from
potential CSS or XSL style-sheets.
When switching to browser view, the document is first checked for validity, if you have selected
Validate upon saving in the File tab of the Options dialog. Use the menu command Tools |
Options to open this dialog.
For further information on this view, please see the detailed description of the various views in
the Main Window section.
21.11.8 Expand
Hotkey: "+" on the numeric keypad
In the Grid View, the element and all its children remain selected after expansion. This allows
you to expand a large element by pressing the + key repeatedly.
You can expand and collapse any element by clicking on the gray bar to the left of each
element.
21.11.9 Collapse
Hotkey: "-" on the numeric keypad
You can expand and collapse any element by clicking on the gray bar to the left of each
element.
21.11.10Expand Fully
Hotkey: "*" on the numeric keypad
This command expands all child items of the selected element, down to the last level of
nesting.
21.11.11Collapse Unselected
Hotkey: CTRL + "-" key on the numeric keypad
This command allows you to focus on one element and its children, and ignore all the other
surrounding elements.
Select the item that you want to work with and choose this command to collapse all other
(unselected) elements.
21.11.12Optimal Widths
This command adjusts the widths of all columns so that each has a width that exactly
accommodates in one line the longest text string in any of its cells. A maximum optimal width
can be specified in the View tab of the Options dialog (Tools | Menu). Note that optimal widths
are calculated on the basis of the visible cells of columns. This enables the optimization of the
view when individual elements are collapsed or expanded.
21.11.13Word Wrap
21.11.14Go to Line/Character
Hotkey: CTRL+ g
This command goes to a specific line number and/or character position in an XML document
in the Text view.
If you are working with an external XSLT processor (see the XSL tab on the Tools | Options
dialog for details) you may often get error messages by line number and character position.
XMLSpy lets you quickly navigate to that spot, using this command:
This command works in both the Text View and Grid View, but will only be able to show an
approximate position in the grid view by highlighting the element closest to the character
position specified.
21.11.15Go to File
This command opens a document that is being referred to, from within the file you are
currently editing.
Select the file name, path name, or URL you are interested in, and choose this command from
the View menu.
The Text View Settings command opens the Text View Settings dialog (screenshot below), in
which you can configure Text View. The shortcut ifor the command is available as an icon in the
Text toolbar.
Margins
In the Margins pane, the Line Number, Bookmark, and Source Folding margins can be toggled
on and off. These are separate margins and display, respectively, line numbers, bookmarks,
and source folding (icons to expand and collapse nodes). These settings determine whether the
margins are displayed in Text View or not. Bookmark commands are in the Edit menu. To
expand and collapse nodes, the Folding margin must be toggled on.
Tabs
The Tab pane enables you to set the tab size in terms of spaces. The radio buttons for inserting
either tabs or spaces determine whether documents are displayed with tab or space indentation
when pretty-printing with indentation is toggled on.
Visual Aid
The Visual Aid pane contains settings to toggle on indentation guides (dotted vertical lines that
show the indentation of the text), end-of-line markers, and whitespace markers.
Key map
The key map is a list of XMLSpy shortcuts and their associated commands.
21.12.1 Back
In Browser View, the Back command displays the previously viewed page. The Backspace key
also achieves the same effect. The Back command is useful if you click a link in your XML
document and want to return to your XML document.
In Schema View, the Back command takes you to the previously viewed component. The
shortcut key is Alt + Left Arrow. Using the Back command up to 500 previously viewed
positions can be re-viewed.
21.12.2 Forward
The Forward command is only available once you have used the Back command. It moves you
forward through (i) previously viewed pages in Browser View, and (ii) previous views of schema
components in Schema View.
21.12.3 Stop
The Stop command instructs the browser to stop loading your document. This is useful if large
external files or graphics are being downloaded over a slow Internet connection, and you wish
to stop the process.
21.12.4 Refresh
F5
The Refresh (F5) command updates the Browser View by reloading the document and related
documents, such as CSS and XSL stylesheets, and DTDs.
21.12.5 Fonts
The Fonts command allows you to select the default font size for rendering the text of your XML
document. It is similar to the Font Size command in most browsers.
The Separate Window command opens the Browser View in a separate window, so that
side-by-side viewing is possible. If you have separated the Browser View, press F5 in editing
view to automatically refresh the corresponding Browser View. To dock separate windows back
into the interface, click the maximize button (at top right) of the active window.
For a description of WSDL View, see the section WSDL View. To get started with WSDL, see
the WSDL Tutorial.
Each item of the WSDL 1.1 menu (screenshot above) rolls out its own submenu, from which
commands relating to that component can be selected. The commands in each of these
submenus are described in the subsections of this section.
Messages
Insert message
Adds a new message to the WSDL document. The Messages item in the Overview entry helper
opens, and the newly created message is highlighted there.
Delete message
Deletes the selected message from the input or output element.
Operations
Append Operation
Appends a new operation to the Operations window. The type of operation to be appended can
be selected from the submenu (screenshot below) of the Append Operation menu command.
Delete Operation
Deletes the selected operation from the Operations window.
PortType
Insert PortType
Adds a new PortType to the PortTypes window.
Delete PortType
Deletes the selected PortType from the PortTypes window.
Binding
Insert Binding
Adds a new binding to the Bindings window.
Delete Binding
Deletes the selected binding from the Bindings window.
Append Child
Enables the addition of a new extensibility element to an input or output message. If the menu
item is unavailable, it is not allowed in this position. See the W3C WSDL Specs for more
information on Extensibilty items.
soap:body
soap:header
soap:headerfault
soap:fault
mime:content
mime:multipartrelated
mime:part
mime:mimeXml
http:urlencoded
http:urlreplacement
Delete Extensibility
Deletes the selected extensibility item.
Service
Insert Service
Adds a new service in the Services window.
Delete Service
Deletes the selected service in the Services window.
Insert Port
Adds a new port to the selected service in the Services window.
Delete Port
Deletes the selected port from the currently selected service.
Each item of the WSDL 2.0 Components menu (screenshot above) rolls out its own submenu,
from which commands relating to that component can be selected. The commands in each of
these submenus are described in the subsections of this section.
Interface
The following commands are available in the Interface menu (screenshot below).
Delete interface
Deletes the selected interface.
Delete fault
Deletes the selected fault.
The default name of the operation is highlighted in the interface box, enabling you to enter a
new name directly.
Delete operation
Deletes the selected operation.
Binding
The following commands are available in the Interface menu (screenshot below).
Delete binding
Deletes the selected binding.
Delete fault
Deletes the selected fault.
Delete operation
Deletes the selected operation.
Service
The following commands are available in the Interface menu (screenshot below).
Delete service
Deletes the selected service.
Delete endpoint
Deletes the selected endpoint.
21.13.3 Types
New Schema
This option only becomes active if the WSDL file does not contain a schema element.
Please note that when using the File | New menu option, a schema element is included in the
skeleton WSDL file. The menu item cannot be selected in this case (see below).
<types>
<xs:schema/>
</types>
Note: In order to generate documentation in MS Word format, you must have MS Word
(version 2000 or later) installed.
Clicking the Generate Documentation command opens the WSDL Documentation dialog (
screenshot above). Depending on whether a WSDL 1.1 document or a WSDL 2.0 document is
active, the items in the Include and Details pane of the dialog will be different. The screenshot
above shows the WSDL Documentation dialog for a WSDL 1.1 document.
The required format is specified in the Output Format pane: either HTML, Microsoft
Word, or RTF. On clicking OK, you will be prompted for the name of the output file and
the location to which it should be saved.
The documentation can be generated either as a single file or be split into multiple files.
When multiple files are generated, each file corresponds to a component. What
components are included in the output is specified using the check boxes in the Include
pane.
For HTML output, the CSS style definitions can be either saved in a separate CSS file
or embedded in the HTML file (in the <head> element). If a separate CSS file is
created, it will be given the same name as the HTML file, but will have a .css
extension. Check or uncheck the Embed CSS in HTML check box to set the required
option.
The Embed Diagrams option is enabled for the MS Word and RTF output options.
When this option is checked, diagrams are embedded in the result file, either in PNG or
EMF format. Otherwise diagrams are created as PNG or EMF files, which are displayed
in the result file via object links.
When the output is HTML, all diagrams are created as document-external PNG files. If
the Create folder for diagrams check box is checked, then a folder will be created in the
same folder as the HTML file, and the PNG files will be saved inside it. This folder will
have a name of the format HTMLFilename_diagrams. If the Create folder for diagrams
check box is unchecked, the PNG files will be saved in the same folder as the HTML
file.
When the output is HTML, all diagrams are created as document-external PNG files.
In the Include pane, you select which items you want to include in the documentation.
The Overview option lists all components, organized by component type, at the top of
the file. The Check All and Uncheck All buttons enable you to quickly select or
deselect all the options in the pane.
The Details pane lists the details that may be included for each component. Select the
details you wish to include in the documentation. The Check All and Uncheck All
buttons enable you to quickly select or deselect all the options in the pane.
The Show Result File option is enabled for all three output options. When this option is
checked, the result files are displayed in Browser View (HTML output), MS Word (MS
Word output), and the default application for .rtf files (RTF output).
On clicking OK in the File Save dialog, a WSDL 2.0 document is generated and saved to the
specified location, and opened in WSDL View in a new tab. The file can then be edited as
required, just like any other WSDL 2.0 document.
The SOAP: How To section that follows the menu descriptions, shows you how to use the
SOAP debugger using the nanonull.com timeservice server supplied by Altova. Please use
this service to test the SOAP debugger. The AirportWeather web service, described on the
following pages, might not always be available to you.
We demonstrate the process below by creating a SOAP request for the US National Digital
Forecast Database (NDFD) SOAP Service (http://www.nws.noaa.gov/xml/).
This completes the definition of this SOAP request. In the next step, we shall send the request.
After the SOAP request is sent, a response is received from the SOAP server. This response is
an XML document, which is displayed in the Text View of XMLSpy. For example, show below is
a screenshot of the XML document that was returned in response to the SOAP request we
defined in the section Create New SOAP Request.
3. You can now manually enter the desired Connection Endpoint or SOAP Action settings.
If you wish to send the request as SOAP 1.2, check the check box at the bottom of the
dialog. If you are using the https protocol, you might wish to allow a host name
mismatch or an expired server certificate. To make these settings, click the HTTPS
Settings button. The HTTPS Settings dialog (screenshot below) appears.
4. In the HTTPS Settings dialog, you can allow that the host name given in the SOAP
request need not match the host name in the server certificate; do this by checking the
Allow host name mismatch check box. If you wish to allow the connection despite an
expired server certificate, then check the Allow expired server certificate check box.
Confirm the changes with OK.
Altova products use Internet Explorer (IE) to access and manage trusted certificates of secure
webservers. Installing the certificate of a webserver in IE allows IE to access the webserver
without issuing a warning or aborting the process. In order to install the certificate of a secure
webserver, do the following:
In Internet Explorer 8, open the secure website.
Select File | Properties, and click the Certificates button.
Click Install Certificate and start the Import Certificate Wizard. (This Wizard can also
be accessed via Tools | Internet Options| Content | Certificates | Import.)
The certificate should be placed in the Trusted Root Certification Authorities store, for
which you can browse manually.
Finish the Wizard steps, close the Certificates and Properties dialogs respectively by
clicking OK. You might need to restart Internet Explorer.
Note: Only change the SOAP action settings if a full list of the SOAP methods and their
corresponding SOAP actions are available to, and accessible by, you.
A dialog box is immediately opened after you select this command. You then have to
select a WSDL file location, generally a URL. You can also select a file via a global
resource (click the icon and select a global resource in the dialog that pops up) or
a file in one of the open windows in XMLSpy.
Select the source and target ports needed for the debugger proxy server and the web
service, in the following dialog box.
This opens the SOAP debuggers proxy server in its inactive state. Clicking one of the
SOAP toolbar icons, starts the SOAP debugger and waits for the client requests.
Please see the Soap - How to section for a more detailed description.
21.14.5 Go
This command activates the SOAP proxy server and processes the WSDL file until a breakpoint
is encountered. The respective SOAP document then appears in one of the SOAP document
windows.
This command allows you to single-step through the incoming and outgoing SOAP requests
and responses. The SOAP debugger stops for each request and response. The proxy server is
also started if it was inactive.
This command causes the debugger to stop on the next SOAP request, and display the data in
the SOAP Request document window. You can directly edit the data in this window before
This command causes the debugger to stop on the next SOAP Response, and display the data
in the SOAP Response document window. You can directly edit the data in this window before
sending it on to the client.
Hide
You can hide the entry helpers as well as the project or info windows, enabling you to see more
of the data in the SOAP documents.
Timeout (secs)
Most clients have a timeout setting in the data receiving function. The time the debugger
remains in a breakpoint is per default 5 seconds. A data packet (http1.1 100 Continue")
message is sent to the client once every timeout period you define.
Setting the timeout period to zero suppresses the data packet; you remain in the breakpoint for
as long as you want.
Enter the address in the form http://computer name, where "computer name" is the web
address or IP address of the computer on which the SOAP debugger is running. Do not enter a
port number in the address. The "localhost" entry always points to your local computer.
For more information about XBRL, see the sections XBRL and Editing Views | XBRL View.
21.15.1 Arcroles
The Arcroles command pops up the Arc Roles dialog (screenshot below) in which arcroles can
be created for a taxonomy. Arcroles are stored in the concept definitions file, within the appinfo
element. They specify the role of an arc.
In the Taxonomies tab of the Arc Roles dialog (screenshot below), only taxonomies that are
editable or that contain an arcrole or linkrole are listed in the combo box. You can add an
arcrole to a taxonomy by clicking the Add button. Then define the arcrole's URI, ID, definition,
and cycles. To specify in which kinds of relationships the arcrole should be available, check the
boxes of the required relationship kinds. Linkbases that reference an arcrole can be added to
the Referencing Linkbase Files column.
The Linkbases tab provides another view of the taxonomy's arcroles. In this view, you add and
view arcroles according to individual linkbases (for example calculation or presentation
linkbases). Select a linkbase in the combo box and then add or delete an arcrole as required.
When you click the Add button, the Add Arcrole Reference dialog (screenshot below) pops up.
Each of the entries in this dialog is a combo box that enables you to select from available
options. The Defined in Schema field enables you to select the taxonomy in which the arcrole is
defined. The ID and Role combo boxes provide the available arcroles. After you have selected
an arcrole and clicked OK, the reference is added to the linkbase. In the Taxonomies tab, the
arcrole you referenced will show the referencing linkbase in the Referencing Linkbase Files
column. If you wish to make this linkrole available for a particular kind of relationship, you will
still, however, have to check the appropriate relationship kind check box.
After an arcrole has been created in the taxonomy it can be used to specify the role of an arc in
a relationship kind for which the arc is available according to its definition. In the screenshot
above, for example, the arcrole has been made available for arcs in label relationships.
The arcrole of an arc is selected in the Details entry helper (screenshot below; arcrole
highlighted).
With the element at the to end of an arc selected, in the Details Entry Helper, select the
required item from the dropdown list of the arcrole entry.
21.15.2 Linkroles
The Linkroles command pops up the Link Roles dialog (screenshot below) in which linkroles
can be created for a taxonomy. Linkroles are stored in the concept definitions file, within the
appinfo element (see listing below). Linkroles are used not only in definitionLink elements
but also in the containing elements of other relationship kinds (for example, in
calculationLink and presentationLink elements).
<xs:appinfo>
<link:roleType id="SegmentRevenueAndOperatingIncome"
roleURI="
http://www.nanonull.com/taxonomy/role/SegmentRevenueAndOperatingIncome">
<link:definition>006091 - Disclosure - Segment Revenue and Operating
Income</link:definition>
<link:usedOn>link:calculationLink</link:usedOn>
<link:usedOn>link:definitionLink</link:usedOn>
<link:usedOn>link:presentationLink</link:usedOn>
</link:roleType>
</xs:appinfo>
In the listing above, notice that there are usedOn elements that specify in which kind of
relationships this linkrole may be used.
In the Taxonomies tab of the Link Roles dialog (screenshot below), you can add a linkrole to a
taxonomy file by clicking the Add button. Then define the linkrole's URI and ID (refer to listing
above). To specify for which kinds of relationships a linkrole should be available, check the
boxes of the required relationship kinds. In the Referencing Linkbase Files column, for each
linkrole, you can add or delete the linkbase files that reference the linkrole.
The Linkbases tab provides another view of the taxonomy's linkroles. In this view, you add and
view linkroles according to individual linkbases (for example calculation or presentation
linkbases). Select a linkbase in the combo box and then add or delete a linkrole as required. For
example, you could add a linkrole to the calculation linkbase. When you click the Add button,
the Add Reference to Linkbase File dialog (screenshot below) pops up.
Each of the entries in this dialog is a combo box that enables you to select from available
options. The Defined in Schema field enables you to select the taxonomy in which the linkrole is
defined. The ID and Role combo boxes provide the available linkroles. After you have selected
a linkrole and clicked OK, the reference is added to the linkbase. In the Taxonomies tab, the
linkrole you referenced will show the referencing linkbase in the Referencing Linkbase Files
column. If you wish to make this linkrole available for a particular kind of relationship, you will
still, however, have to check the appropriate relationship kind check box.
After a linkrole has been created in the taxonomy it is used when creating relationships.
To add or delete a namespace, use the Add or Delete buttons, respectively. A color is assigned
to a namespace via the color palette for that namespace. When you are done with editing in the
The target namespace of the taxonomy is also listed in the Namespaces dialog. The target
namespace, however, should not be modified in this dialog, but via the Set Target Namespace
command. For more information on target namespaces, see the XBRL section of the
documentation.
In the listing above, the target namespace is defined with the targetNamespace attribute and it
is then declared with a prefix of ns1.
21.15.5 Import/Reference
The Import/Reference command pops up a dialog (screenshot below) in which you can specify
the schema to import or the linkbase to reference.
Documentation is generated for components you select in the XBRL Taxonomy Documentation
dialog (which appears when you select the Generate Documentation command; see screenshot
below). Related components are hyperlinked in the onscreen output, enabling you to navigate
from component to component.
Note: In order to generate documentation in MS Word format, you must have MS Word
(version 2000 or later) installed.
Clicking the Generate Documentation command opens the XBRL Taxonomy Documentation
dialog:
The required format is specified in the Output Format pane: either HTML, Microsoft
Word, or RTF. On clicking OK, you will be prompted for the name of the output file and
the location to which the output file should be saved.
The documentation can be generated either as a single file or be split into multiple files
(the Split Output to Multiple Files option). When multiple files are generated, each file
corresponds to a component. What components are included in the output is specified
using the check boxes in the Include pane.
For HTML output, the CSS style definitions can be either saved in a separate CSS file
or embedded in the HTML file (in the <head> element). If a separate CSS file is
created, it will be given the same name as the HTML file, but will have a .css
extension. Check or uncheck the Embed CSS in HTML check box to set the required
option.
The Embed Diagrams option is enabled for the MS Word and RTF output options.
When this option is checked, diagrams are embedded in the result file, either in PNG or
EMF format. Otherwise diagrams are created as PNG or EMF files, which are displayed
in the result file via object links.
When the output is HTML, all diagrams are created as document-external PNG files. If
the Create folder for diagrams check box is checked, then a folder will be created in the
same folder as the HTML file, and the PNG files will be saved inside it. This folder will
have a name of the format HTMLFilename_diagrams. If the Create folder for diagrams
check box is unchecked, the PNG files will be saved in the same folder as the HTML
file.
When the output is HTML, all diagrams are created as document-external PNG files.
In the Include pane, you select which items you want to include in the documentation.
The Overview option lists all components, organized by component type, at the top of
the file. The Check All and Uncheck All buttons enable you to quickly select or
deselect all the options in the pane.
The Details pane lists the details that may be included for each component. Select the
details you wish to include in the documentation. The Check All and Uncheck All
buttons enable you to quickly select or deselect all the options in the pane.
The Show Result File option is enabled for all three output options. When this option is
checked, the result files are displayed in Browser View (HTML output), MS Word (MS
Word output), and the default application for .rtf files (RTF output).
In the Options pane, you can select (i) whether element name should be shown with
just a prefix (short qualified name) or in its expanded for (with the full namespace); and
(ii) whether imported elements should also be displayed.
21.16.1 Spelling
XMLSpy includes a built-in spelling checker.
The spelling checker can be used in the following views: Grid, Text and Authentic View. Please
note that you can check any type of XML file. The view you select influences the spelling
checker options that are made available. A schema file (*.xsd) can be checked in Text and Grid
View, but not in Schema View or XBRL View. Similarly, a WSDL file can be spell-checked in
Text View but not in WSDL VIew.
Spell checking in Text and Grid View presents you with the most options. You can additionally
check the spelling of:
Element content
Attribute content
CDATA content
Comment text
You can also define which specific element or attribute content to check or ignore. These
selections are defined in the "Spelling context" dialog box.
The Tools | Spelling... command (Shift+F7) opens the Spelling dialog box, and automatically
starts checking the currently active XML document (in this screenshot, the OrgChart.xml
document in Authentic View).
Not in Dictionary
This text box contains the word that cannot be found in any of the existing dictionaries (default
and custom dictionaries). You can edit the text here and click Change to change it in the XML
document. The word is also highlighted in the XML document. The command buttons become
active at this point and allow you to decide which action to take.
Suggestions
This list box displays a list of words that resemble the unknown word (supplied from all
dictionaries). Double-clicking a word in this list automatically inserts it in the document and
continues the spell checking process.
Ignore once
This command allows you to continue checking the document while ignoring the first occurrence
of the unknown word. The same word will be flagged again if it appears in the document.
Ignore all
This command ignores all instances of the unknown word in the whole document.
Add to dictionary
This command adds the unknown word to the currently active custom dictionary. The active
dictionary is the dictionary that is selected in the Custom Dictionaries dialog box. To open this
dialog, click Options, then Spelling options, then Custom Dictionaries.
Change
This command replaces the currently highlighted word in the XML document with the selected
word in the Suggestions list box.
Change all
This command replaces all occurrences of the currently highlighted word in the XML document,
with the selected word in the Suggestions list box.
Recheck
The Recheck button restarts the check from the beginning of the document.
Close
This command closes the Spelling dialog box.
Options...
This command opens a dialog box depending on the current view.
If opened from Authentic View, the Options dialog box is opened.
If opened from the Text or Enhanced Grid view, the Spelling context dialog box is
opened.
Dictionary Language
Use this combo box to select the dictionary language for the spelling checking. The default
installation allows you to select English. Other language dictionaries will be made available on
the Altova download web site.
Custom dictionaries
The Custom Dictionaries... button allows you to:
modify an existing dictionary (add or delete dictionary entries)
create a totally new dictionary
add an existing dictionary
remove an existing dictionary
When you start the spell checking process, all dictionaries listed in the Custom Dictionaries
list box are searched. If you want to limit the search to specific dictionaries, use the
Remove button to delete those you do not want searched.
2. Click in the Word: field and enter the new dictionary entry (this automatically activates
the Add button).
3. Click Add to add it to the dictionary.
4. Click OK.
Please note:
It is not mandatory for a dictionary to have a *.tlx extension. It can have any
extension, or no extension at all, and still be added to the dictionary list box.
To remove a dictionary:
In the Custom Dictionaries dialog, click the dictionary name in the list and click Remove
. This removes the dictionary from the list, but does not physically delete it from your
hard disk.
When viewing an XML document in the Text or Enhanced Grid view, this command opens the
"Spelling context" dialog box. Starting the spelling checking in the Text and Enhanced grid
view presents you with the most options, you can define the specific content which is to be
checked:
Element content
Attribute content
CDATA content
Comment text
The Spelling options... button opens the Spelling Options dialog box, which allows you to
define the global spelling checker options.
2. Click the Append element/attribute icon , and enter the tag name containing the text
you want checked (e.g., para). Press Enter to confirm.
3. Click OK to confirm these settings, and click it again in the Spelling dialog box to start
the spelling checker with these new settings.
The only element content to be checked will be the text between the para tags,
attribute content will also be checked.
Note: The .NET Framework version 2.0 or higher will have to be installed on your machine in
order for the Scripting Editor to run.
21.16.4 Macros
Mousing over the Macros command rolls out a submenu containing containing the macros
defined in the Scripting Project that is currently active in XMLSpy (screenshot below). The active
Scripting Project is specified in the Scripting tab of the Options dialog.
Clicking a macro in the submenu (see screenshot above) runs the macro.
21.16.5 Comparisons
XMLSpy provides a comparison (or differencing) feature, with which you can compare XML and
Text files, as well as folders, in order to check for differences.
There are the following menu items in the Tools menu that enable you to perform comparison
tasks on files and folders:
Compare open file with
Compare directories
Compare options
1. With the file active in the Main Window (only one open file can be active in the Main
Window at a given time), click Tools | Compare open file with....
2. Browse for the file you wish to compare the open file with, and select it. You can also
select a file via a global resource or a URL (click the Browse button) or a file in one of
the open windows in XMLSpy (click the Window button).
3. Click OK. The second file is opened, and the Settings dialog appears:
These settings are described under Compare Options. If you do not wish to have this
dialog appear each time you start a compare session, uncheck Show settings before
starting compare, which is at the bottom of the dialog.
4. Select the required settings, then click OK. The two files now appear in the Main
Window. Lines that are different are highlighted in green. One difference is selected at
a time and is indicated in both files in a darker green color. (Also see the 'Highlight
Colors' section below.)
To select the next difference, click the Next button. The First, Last, and Previous
buttons help you to navigate among the differences and to select a difference.
The "Merge difference" pane enables you to copy the selected difference from one file
to the other. In order to enable merging, the following Compare options must be set:
Detailed differencing must be checked and Ignore node depth must be unchecked. If
you wish to undo a merge, stop the Compare session, select the file in which the
change is to be undone, and select Edit | Undo or press Ctrl + Z.
5. When you are done with reviewing and/or merging differences, click Done.
Highlight colors
The differences and merged differences in the two files are indicated by the following highlight
colors:
Difference
Current difference
Merged difference
Please note:
While the Compare session is active, no editing or change of views is allowed. Any
attempt to edit or change the view of either file will pop up a message warning that the
Compare session will be ended.
Compare settings can be changed during a Compare session (by selecting Tools |
Compare options...), but will only take effect from the next Compare session onward;
the new settings will not affect the current session.
Compare Directories
The Compare directories command allows you to compare two directories, with or without their
sub-directories. Directories are compared to indicate missing files, and whether files of the
2. Browse for the directories to compare, and check the Include subdirectories check
box if you wish to include subdirectories in the Compare.
3. Select the file types you want to compare in the Files of type field. There are three
options in the dropdown menu: (i) XML filetypes; (ii) Filetypes defined in XMLSpy; and
(iii) all filetypes. Zip archives are treated as directories, and directories and files in the
Zip archive are displayed in the results window. To ensure that Zip archives are read as
directories, make sure that the required extension is included in the Files of Type entry.
4. Click OK. The Settings dialog (described in Compare Options) appears.
5. Select the required settings for comparing files.
6. Click OK. A dialog will appear indicating the progress of the Compare.
The result will appear in a window, and will look like this:
Directory symbols
All directory names are given in black.
Directory is collapsed and its contents are not displayed.
Directory is expanded, indicated by the turned down corner. The contents are
displayed.
Directory contains files, all of which either cannot be compared or are not different from
the corresponding file in the compared directory.
Directory contains one or more files that do not exist in the compared directory.
Directory contains one or more files that are different from the corresponding file in the
compared directory.
Directory contains one or more files that do not exist in the compared directory and one
or more files that are different from the corresponding file in the compared directory.
File symbols
The colors in which file names appear depend on their compare status. These colors are noted
below.
Viewing options
Select what files to show by checking or unchecking the options in the Show pane at
the bottom of the Result window.
Open or close all subdirectories by clicking the appropriate button in the Directories
pane.
Expand or collapse subdirectories by double-clicking the folder icon.
The Size and Last Modified can be toggled on and off by right-clicking on either file
titlebar and clicking Size and Last Modified.
Compare Options
Click Tools | Compare options to open the Settings dialog (see screenshot). In it you make the
settings for your Compare sessions. The settings that are current when a Compare session is
started are the settings that are applied to that Compare session.
View results
Selects the view in which results are shown. You can select from the following options:
Grid View (XML comparison)
Text View with Textual Comparison Only unchecked (XML comparison)
Text View with Textual Comparison Only checked (Text comparison)
If a view that provides XML comparison is selected, then the documents are treated as XML
documents, and XML Compare Options are enabled. If Text comparison is selected, only
Compare Options valid for Text comparison (Whitespaces and Case-sensitivity) are enabled; all
other Compare Options are disabled.
Please note: You can merge differences in both Grid View and Text View, and in both XML and
Text comparison modes. If you wish to undo a merge, stop the Compare session, select the file
in which the change is to be undone, and select Edit | Undo or press Ctrl + Z.
Detailed differencing
If unselected, differences in immediate sibling elements are represented as a single difference,
and the merge option is disabled. If selected, differences in immediate siblings are represented
as separate differences, and merging is enabled.
Please note: The Detailed differencing check box must be checked to enable merging.
Whitespaces
Whitespace characters are space, tab, carriage return, and line feed. The options here compare
files with whitespace unchanged; with whitespace normalized (i.e., all consecutive whitespace
characters are reduced to one whitespace character); and with all whitespace stripped. The
Whitespaces option is available for both XML and Text comparisons.
Case sensitivity
If the Ignore case check box is checked, then you have the option of ignoring or not ignoring
case in node names (for XML comparisons only). The Case-sensitivity option is available for
both XML and Text comparisons.
Namespace/Prefix
These are options for ignoring namespaces and prefixes when searching for differences.
Order
If Ignore order of child nodes is checked, then the position of child nodes relative to each
other does not matter. The comparison is made for the entire set of child nodes, and if the only
difference between a child node in one document and a child node in the compare document is
the relative position in the nodeset, then this difference is ignored.
Please note: Each child element node is identified by its name, its attributes, and its position. If
the names of more than one node in the sibling set are the same, then the position of these
nodes is used to identify the nodes even if the "Ignore order of child nodes" option is checked.
This option applies to each level separately.
If Ignore order of child nodes is unchecked, then differences in order are represented as
differences.
The option of ignoring the order of attributes is also available, and applies to the order of
attributes of a single element.
Entities
If "Resolve entities" is selected, then all entities in the document are resolved. Otherwise the
files are compared with the entities as is.
Text
If "Ignore text" is selected, then differences in corresponding text nodes are not reported.
Depth
If Ignore node depth is checked, then the additional depth of any element (i.e. more levels of
descendants) relative to the depth of the corresponding element in the compared file is ignored.
This option must be unchecked to enable merging.
command is clicked. Having the Settings dialog appear before each comparison allows you to
check and modify the settings for each comparison.
If this command is unchecked, then the Compare session will start directly when a comparison
is invoked.
How to define global resources is described in detail in the section, Defining Global Resources.
Note: The Altova Global Resources dialog can also be accessed via the Global Resources
toolbar (Tools | Customize | Toolbars | Global Resources).
The currently active configuration is indicated with a bullet. In the screenshot above the
currently active configuration is Default. To change the active configuration, select the
configuration you wish to make active.
Note: The active configuration can also be selected via the Global Resources toolbar (Tools |
Customize | Toolbars | Global Resources).
21.16.8 Customize
The Customize command lets you customize XMLSpy to suit your personal needs.
Commands
The Commands tab allows you customize your menus or toolbars.
A small button appears at the tip of mouse pointer when you drag a command. The "x"
below the pointer means that the command cannot be dropped at the current cursor
position.
The "x" disappears whenever you can drop the command (over a tool bar or menu).
Placing the cursor over a menu when dragging opens it, allowing you to insert the
command anywhere in the menu.
Commands can be placed in menus or tool bars. If you created you own toolbar you
can populate it with your own commands/icons.
Please note:
You can also edit the commands in the context menus (right-click anywhere to open
the context menu), using the same method. Click the Menu tab and then select the
specific context menu available in the Context Menus combo box.
Toolbars
The Toolbars tab allows you to activate or deactivate specific toolbars, as well as create your
own specialized ones.
XMLSpy toolbars contain symbols for the most frequently used menu commands. For each
symbol you get a brief "tool tip" explanation when the mouse cursor is directly over the item and
the status bar shows a more detailed description of the command.
You can drag the toolbars from their standard position to any location on the screen, where they
appear as a floating window. Alternatively you can also dock them to the left or right edge of the
main window.
Toolbar settings defined in Grid View, Schema View, WSDL View and Text View are
valid in those views. The Browser View toolbars are independent of all the other views.
To delete a toolbar
1. Select the toolbar you want to delete in the Toolbars list box.
2. Click the Delete button.
3. A prompt appears, asking if you really want to delete the toolbar. Click Yes to confirm
the deletion.
Keyboard
The Keyboard tab allows you to define (or change) keyboard shortcuts for any XMLSpy
command.
Hotkeys by key
F1 Help Menu
F3 Find Next
F5 Refresh
F7 Check well-formedness
F8 Validate
F9 Insert/Remove breakpoint
Shift+F9 Insert/Remove tracepoint
CTRL+F9 Enable/Disable breakpoint
Shift+CTRL+F9 Enable/Disable tracepoint
F10 XSL Transformation
CTRL+F10 XSL:FO Transformation
F11 Step into
CTRL+F11 Step Over
Shift + F11 Step Out
Alt+F11 Start Debugger/Go
Num + Expand
Num - Collapse
Num * Expand fully
CTRL+Num- Collapse unselected
CTRL + G Goto line/char
Arrow keys
(up / down) Move selection bar
Esc. Abandon edits/close dialog box
Return/Space bar confirms a selection
CTRL + F Find
F3 Find Next
CTRL + H Replace
Hotkeys by function
In the application, you can see a list of commands, together with their shortcuts and
descriptions, in the Keyboard Map dialog (Help | Keyboard Map).
Menu
The Menu tab allows you to customize the main menu bars as well as the (popup - right click)
context menus.
You can customize both the Default and XMLSpy menu bars.
The Default menu (screenshot below) is the one visible when no XML documents of any type
are open in XMLSpy.
The XMLSpy menu is the menu bar visible when at least one XML document has been opened.
To customize a menu:
1. Select the menu bar you want to customize from the Show Menus for: combo box
2. Click the Commands tab, and drag the commands to the menu bar of your choice.
or,
1. Select Tools | Customize to open the Customize dialog box.
2. Drag the command away from the menu, and drop it as soon as the check mark icon
appears below the mouse pointer.
or,
1. Select Tools | Customize to open the Customize dialog box.
2. Drag the command away from the context menu, and drop it as soon as the check
mark icon appears below the mouse pointer.
Menu shadows
Click the Menu shadows check box, if you want all your menus to have shadows.
Macros
The Macros tab allows you to place macros (created using the XML scripting environment) in a
toolbar or menu.
Note: If a macro has been set as an Associated Command, you can set a keyboard shortcut
for it. In the Keyboard tab of the Customize dialog, select Macros in the Category
combo box, then select the required macro, and set the shortcut. You should set a
macro as an associated command in order for Macros to be available for keyboard
shortcuts.
Plug-Ins
The Plug-Ins tab allows you to place plug-ins in a toolbar or menu.
2. Select the folder and then click the plug-in file to mark it (XMLSpyPlugIn.dll in this
case).
To remove a plug-in:
Click the plug-in name in the "List of active plug-ins" list and click the "Remove Plug-in"
button
.
Options
The Options tab allows you to set general environment settings.
Toolbar
When active, the Show ScreenTips on toolbars check box displays a popup when the mouse
pointer is placed over an icon in any of the icon bars. The popup contains a short description of
the icon function, as well as the associated keyboard shortcut, if one has been assigned.
The Show shortcut keys in ScreenTips check box, allows you to decide if you want to have
the shortcut displayed in the tooltip.
When active, the Large icons check box switches between the standard size icons, and larger
versions of the icons.
Reset to default
Currently no function.
Delete
This option deletes the icon or menu you right click. Deleting a menu deletes all menu options
contained in it!
Button Appearance...
This option allows you to edit the button image as well as the button text. Currently only the
macro icons can be edited (default XMLSpy icon).
The Image only, Text only and Image and text radio buttons, let you define what you want to
edit. Click the Select User-defined Image radio button and click one of the icons.
Click the Edit... button, to open the Edit button image dialog box. The Button text can be edited
if you select either Text only or Image and text options.
Image
This option changes the graphical display of an icon to the text representing it.
Text
This option changes the textual description of a function to the graphical image (icon)
representing that function.
Start group
This option inserts a vertical divider to the left of the icon you right clicked.
This command is useful if you have been resizing, moving, or hiding toolbars or windows, and
would now like to have all the toolbars and windows as they originally were.
21.16.10Options
The Tools | Options command enables you to define global application settings. These
settings are specified in a tabbed dialog box and saved in the registry. They apply to all current
and future document windows. The Apply button in the Options dialog displays the changes in
the currently open documents and fixes the current settings. The changes are seen immediately
in the background windows.
File
The File tab defines the way XMLSpy opens and saves documents. Related settings are in the
Encoding tab.
Validation
If you are using DTDs or schemas to define the structure of your XML documents, you can
automatically check the document for validity whenever it is opened or saved. During Open and
Save operations, you have the option of validating files only if the file-size is less than a size you
specify in MB. If the document is not valid, an error message will be displayed. If it is valid, no
message will be displayed and the operation will proceed without any notification. XMLSpy can
also cache these files in memory to save any unnecessary reloading (e.g. when the schema
being referred to is accessed through a URL). If your schema location declaration uses an URL,
disable the "cache DTD/Schema files in memory" option to have changes made to the schema
appear immediately, and not use the cached version of the schema.
Project
When you start XMLSpy, you can open the last-used project automatically.
Save File
When saving an XML document, XMLSpy includes a short comment <!-- Edited with
XMLSpy http://www.altova.com --> near the top of the file. This option can only be
deactivated by licensed users, and takes effect when editing or saving files in the Enhanced
Grid or Schema Design View.
When saving a content model diagram (using the menu option Schema design | Generate
Documentation), XMLSpy includes the XMLSpy logo. This option can only be deactivated by
licensed users.
If a StyleVision Power Stylesheet is associated with an XML file, the 'Authentic: save link to
design file' option will cause the link to the StyleVision Power Stylesheet to be saved with the
XML file.
Line breaks
When you open a file, the character coding for line breaks in it are preserved if Preserve old is
selected. Alternatively, you can choose to code line breaks in any of three codings: CR&LF (for
PC), CR (for MacOS), or LF (for Unix).
After making the settings, click OK to finish and close the Options dialog.
File Types
The File types tab allows you to customize the behavior of XMLSpy on a per-file-type basis.
Choose a file type from the File Types list box to customize the functions for that particular file
type:
Conformance
XMLSpy provides specific editing and other features for various file types. The features for a file
type are set by specifying the conformance in this option. XMLSpy lets you set file type to
conform with XML, XQuery, ZIP, JSON, and other (text) grammars. Furthermore, XML
conformance is differentiated between XML, DTD, and XML Entity file types. A large number of
file types are defined with a default conformance that is appropriate for the file type. We
recommend that you do not modify these settings unless you are adding a new file type or
deliberately wish to set a file type to another kind of conformance.
Default view
This group lets you define the default view to be used for each file type.
Grid View
This check box lets you define whether the Grid View should automatically build tables.
Text View
This text box lets you set syntax-coloring for particular file types.
After making the settings, click OK to finish and close the Options dialog.
Editing
The Editing tab enables you to specify editing behaviour in XMLSpy.
Intelligent editing
While editing documents, XMLSpy provides intelligent editing based on these settings. You can
also customize various aspects of the behavior of these Entry Helpers here. Such customization
varies according to the file type. For example, the option to load entry helpers on opening the
file and sorting attributes will not be applicable to DTD or XQuery documents.
Text View
In Text View, Auto-completion and entry helpers can be disabled if a file is bigger than the size
specified in the Disable Auto-completion... combo box. This is useful if you wish to speed up the
editing of large files and can do without the auto-completion feature and entry helpers. If the file
size is bigger than that specified for this option, then the Text View context menu contains a
toggle command for switching on and off Auto-completion and entry helper use. So you can
always switch these editing aids on and off at any time during editing (in the event of files having
a size greater than the size specified for this option). If the value specified for this option is
smaller than the size of the opened file, locations indicated in error messages will not correctly
correspond to the location in Text View.
The structured text mode attempts to format the clipboard contents as a table, for use in a
spreadsheet or database application. This option does not affect the internal clipboard format
that XMLSpy uses for copying and pasting.
Table view
You can also control, how XMLSpy decides when to display repeating elements in the Table
View.
After making the settings, click OK to finish and close the Options dialog.
View
The View tab enables you to customize the XML documents presentation in XMLSpy.
Grid View
Collapsed elements in the Grid View can be displayed in preview form. This displays the
attributes and their values in gray in the same line as the element. You can automatically apply
the Optimal Widths command while editing, and limit the maximum cell width and height.
Pretty-print
When you select Edit | Pretty-Print XML Text, the XML document will be pretty-printed with or
without indentation according to whether the Use Indentation option in this dialog is checked or
not. When the document is pretty-printed with indentation, it will be indented according to the
settings in the Tabs pane of the Text View Settings dialog. If the document is pretty-printed,
every line in the document will be displayed with zero indentation. If pretty-printing has been
switched on with the Use Indentation setting and if you change from Text View to Grid View and
back to Text View, then the document will be pretty-printed automatically.
Program logo
You can turn off the splash screen upon program startup to speed up the application.
Window title
The window title for each document window can contain either the file name only or the full path
name.
Authentic View
XML files based on a StyleVision Power Stylesheet are automatically opened in the Authentic
View when this option is active.
Browser View
You can choose to see the browser view in a separate window, enabling side-by-side placement
of the edit and browser views.
After making the settings, click OK to finish and close the Options dialog.
Grid Fonts
The Grid fonts tab allows you to customize the appearance of text in Grid View.
Font face
You can select the font face and size to be used for displaying the various items in Grid View.
The same fonts are also used for printing, so only TrueType fonts should be selected.
Size
Select the required size. If you want to use the same font size for all items, check the Use the
Styles
The style and color can be set using the options in this pane. The current settings are
immediately reflected in the list in the left-hand pane, so you can preview the way your
document will look.
After making the settings, click OK to finish and close the Options dialog.
Schema Fonts
The Schema fonts tab enables you to customize the appearance of text in Schema View.
Font face
You can select the font face and size to be used for displaying the various items in the Schema
Design view. The same fonts are used when printing and creating schema documentation, so
only TrueType fonts should be selected. Components prefixed with "Doc." are used in the
schema documentation.
Size
Select the required size. If you want to use the same font size for all items, click on the Use The
Same For All" check box.
Styles
The style and color can be set using the options in this pane. The current settings are
immediately reflected in the list in the left pane, so you can preview the way your document will
look.
After making the settings, click OK to finish and close the Options dialog.
WSDL Fonts
The WSDL fonts tab you to customize the appearance of text in WSDL View.
Font face
You can select the font face and size to be used for displaying the various items in the WSDL
Design view. The same fonts are used when printing and creating documentation, so only
TrueType fonts should be selected.
Size
Select the required size. If you want to use the same font size for all items, click on the Use The
Same For All" check box.
Styles
The style and color can be set using the options in this pane. The current settings are
immediately reflected in the list in the left pane, so you can preview the way your document will
look.
After making the settings, click OK to finish and close the Options dialog.
XBRL Fonts
The XBRL fonts tab you to customize the appearance of text in XBRL View.
Font face
You can select the font face and size to be used for displaying the various items in XBRL View.
The same fonts are used when printing and creating documentation, so only TrueType fonts
should be selected.
Size
Select the required size. If you want to use the same font size for all items, click on the Use The
Same For All check box.
Styles
The style and color can be set using the options in this pane. The current settings are
immediately reflected in the list in the left pane, so you can preview the way your document will
look.
After making the settings, click OK to finish and close the Options dialog.
Text Fonts
The Text fonts tab enables you to customize the appearance of text in Text View. You can
customize the appearance of of text items according to the type of text item. For example, you
can color element names and attribute names differently.
Note: The same font, style, and size is used for all text item types. Only the text color and
background color can be changed for individual text types. This enables the syntax
coloring feature.
After making the settings, click OK to finish and close the Options dialog.
Colors
The Colors tab enables you to customize the background colors used in the Table View of Grid
View. In the screenshot below, the colors have been changed from the default colors by clicking
the palette icon next to each item and then selecting the preferred color.
Table View
The Header unselected and Header selected options refer to the column and row headers. The
screenshot below shows headers unselected; its color is as set in the dialog above.
The Header Selected color is activated when all headers are selected (screenshot below)—not
when individual headers are selected. The screenshot below shows this using the colors
defined in the dialog shown above. All headers can be selected by clicking the cell that
intersects both headers or by selecting the element created as the table—or any of its
ancestors.
Non-existent Elements
When an element or attribute does not exist in the XML document, then it can be given different
background colors when selected and unselected. This is shown in the screenshot below, in
which the first row is selected.
Please note: In addition to the colors you define here, XMLSpy uses the regular selection and
menu color preferences set in the Display Settings in the Control Panel of your Windows
installation.
After making the settings, click OK to finish and close the Options dialog.
Encoding
The Encoding tab specifies options for file encodings.
The encoding of existing XML files will be retained and can only be changed with the File |
Encoding command.
After making the settings, click OK to finish and close the Options dialog.
XSL
The XSL tab (screenshot below) enables you to define options for XSLT transformations and
XSL-FO transformations carried out from within the application.
XSLT transformations
XMLSpy contains the Altova XSLT 1.0 Engine and Altova XSLT 2.0 Engine, which you can use
for XSLT transformations. The appropriate XSLT engine (1.0 or 2.0) is used (according to the
value of the version attribute of the xsl:stylesheet or xsl:transform element). This
applies both for XSLT transformations as well as for XSLT debugging using XMLSpy's
XSLT/XQuery Debugger.
For transforming XML documents using XSLT, you could use one of the following:
The built-in Altova XSLT Engine (comprising the Altova XSLT 1.0 Engine and the Altova
XSLT 2.0 Engine).
The MSXML 3.0, 4.0, or 6.0 parser (which is pre-installed). If you know which version of
the MSXML parser is running on your machine, you could select it; otherwise, you
should let the application select the version automatically. (The Choose version
automatically option is active by default.) In this case, the application tries to select the
most recent available version.
An external XSLT processor of your choice. You must specify the command line string
for the external XSLT processor. The following variables are available for building the
command line string:
%1 = XML document to process
%2 = Output file to generate
%3 = XSLT stylesheet to use (if the XML document does not contain a reference to a
stylesheet)
For example, the command to run a simple transformation with the Saxon (XSLT 1.0)
processor is:
saxon.exe -o output.xml input.xml stylesheet.xslt
parameter-name=parameter-value
To run this command from the application, select the External XSL Transformation
Program radio button, and enter the following line in the text box:
c:\saxon\saxon.exe -o %2 %1 %3 parameter-name=parameter-value
Check the respective check boxes to show the output and error messags of the
external program in the Messages Window in XMLSpy.
Note: The parameters set in XMLSpy's XSLT Input Parameters dialog are passed to the
internal Altova XSLT Engines only. They are not passed to any other XSLT Engine that
is set up as the default XSLT processor.
The Reuse output window option causes subsequent transformations to display the result
document in the same output window. If the XML file belongs to a project and Reuse output
window option is disabled, the setting only takes effect if the Save in folder output file path (
screenshot below) in the relevant project properties is also disabled.
XSL-FO transformations
FO documents are processed using an FO processor, and the path to the executable of the FO
processor must be specified in the text box for the XSL-FO transformation engine. The
transformation is carried out using the XSL/XQuery | XSL-FO Transformation menu
command. If the source file (the active document when the command is executed in the IDE) is
an XSL-FO document, the FO processor is invoked for the transformation. If the source
document is an XML document, an XSLT transformation is required to first convert the XML
document to an XSL-FO document. This XSLT transformation can be carried out either by the
XSLT engine you have specified as the default engine for the application (see above), or by the
XSLT engine that might be built into the FO processor you have specified as the default FO
processor for the application. To select between these two options, click the appropriate radio
button.
After making the settings, click OK to finish and close the Options dialog.
Scripting
The Scripting tab (screenshot below) allows you to enable the Scripting Environment on
application startup. Check the Activate Scripting check box to do this. You can then specify the
Global Scripting Project file (see screenshot below).
To set a global scripting project for XMLSpy, check the Activate Scripting check box and then
browse for the Altova Scripting Project (.asprj) file you want. You can also specify: (i) whether
Auto-Macros in the scripting project should be automatically executed when XMLSpy starts, and
(ii) whether application event handler scripts in the project should be automatically executed or
not; check or uncheck the respective check boxes accordingly.
Click OK when done. Macros in the Global Scripting Project will then be displayed in the
submenu of the Macros command.
Source Control
The Source Control tab (screenshot below) enables you to specify the default logon IDs for
various source control providers and to set up user preferences.
User preferences
A range of user preferences is available, including the following:
Status updates can be performed in the background after a user-defined interval of
time, or they can be switched off entirely. Very large source control databases could
consume considerable CPU and network resources. The system can be speeded up,
however, by disabling background status updates or increasing the interval between
them..
When opening and closing projects, files can be checked out and checked in,
respectively.
The display of the Check Out and Check In dialogs can be suppressed.
The Reset button is enabled if you have checked/activated the Don't show this again
option in one of the dialog boxes. On clicking the Reset button, the Don't show this
again prompt is re-enabled.
After making the settings, click OK to finish and close the Options dialog.
You can cascade the open document windows, tile them, or arrange document icons once you
have minimized them. You can also switch the various Entry Helper windows on or off, or switch
to an open document window directly from the menu.
21.17.1 Cascade
This command rearranges all open document windows so that they are all cascaded (i.e.
staggered) on top of each other.
This is a dockable window. Dragging on its title bar detaches it from its current position and
makes it a floating window. Click right on the title bar, to allow docking or hide the window.
This is a dockable window. Dragging on its title bar detaches it from its current position and
makes it a floating window. Click right on the title bar, to allow docking or hide the window.
All three Entry helpers are dockable windows. Dragging on a title bar detaches it from its current
position and makes it a floating window. Click right on the title bar to allow docking or hide the
window.
The Output Windows window is dockable. Dragging on its title bar detaches it from its current
position and makes it a floating window. Click right on the title bar to allow docking or to hide the
window.
For a complete description of Output Windows see Output Windows in the section, Text View.
This command lets you switch all dockable windows on, or off:
the Project Window
the Info Window
the three Entry-Helper Windows
This is useful if you want to hide all non-document windows quickly, to get the maximum
viewing area for the document you are working on.
You can also use the Ctrl-TAB or CTRL F6 keyboard shortcuts to cycle through the open
windows.
The Help menu also contains the Registration dialog, which lets you enter your license
key-code once you have purchased the product.
Once the help window is open, use the three tabs to toggle between the table of contents, index
, and search panes. The Favorites tab lets you bookmark certain pages within the help system.
21.18.2 Index
The Help | Index command accesses the keyword index of the Online Help. You can also use
the Index tab in the left pane of the online help system.
The index lists all relevant keywords and lets you navigate to a topic by double-clicking the
respective keyword. If more than one topic matches the selected keyword, you are presented a
list of available topics to choose from.
21.18.3 Search
The Help | Search command performs a full-text search on the entire online help system.
1. Enter your search term in the query field and press Enter.
The online help system displays a list of available topics that contain the search term
you've entered.
2. Double-click on any item in the list to display the corresponding topic.
To view commands in a particular menu, select the menu name in the Category combo box.
You can print the command by clicking the printer icon.
Free evaluation key. When you first start the software after downloading and installing
it, the Software Activation dialog will pop up. In it is a button to request a free evaluation
key-code. Enter your name, company, and e-mail address in the dialog that appears,
and click Request Now! The evaluation key is sent to the e-mail address you entered
and should reach you in a few minutes. Now enter the key in the key-code field of the
Software Activation dialog box and click OK to start working with your Altova product.
The software will be unlocked for a period of 30 days.
Permanent license key. The Software Activation dialog contains a button to purchase
a permanent license key. Clicking this button takes you to Altova's online shop, where
you can purchase a permanent license key for your product. There are two types of
permanent license: single-user and multi-user. Both will be sent to you by e-mail. A
single-user license contains your license-data and includes your name, company,
e-mail, and key-code.A multi-user license contains your license-data and includes your
company name and key-code. Note that your license agreement does not allow you to
install more than the licensed number of copies of your Altova software on the
computers in your organization (per-seat license). Please make sure that you enter the
data required in the registration dialog exactly as given in your license e-mail.
Note: When you enter your license information in the Software Activation dialog, ensure that
you enter the data exactly as given in your license e-mail. For multi-user licenses, each
user should enter his or her own name in the Name field.
The Software Activation dialog can be accessed at any time by clicking the Help | Software
Activation command.
Order Form
When you are ready to order a licensed version of the software product, you can use either the
Order license key button in the Software Activation dialog (see previous section) or the Help |
Order Form command to proceed to the secure Altova Online Shop.
Registration
The first time you start your Altova software after having activated it, a dialog appears asking
whether you would like to register your product. There are three buttons in this dialog:
OK: Takes you to the Registration Form
Remind Me Later: Pops up a dialog in which you can select when you wish to be next
reminded.
Cancel: Closes the dialog and suppresses it in future. If you wish to register at a later
time, you can use the Help | Registration command.
FAQ
To help you in getting the best support possible, we are providing a list of Frequently Asked
Questions (FAQ) on the Internet, that is constantly updated as our support staff encounters new
issues that are raised by our customers.
Please make sure to check the FAQ before contacting our technical support team. This will
allow you to get help more quickly.
We regret that we are not able to offer technical support by phone at this time, but our support
staff will typically answer your e-mail requests within one business day.
If you would like to make a feature suggestion for a future version of XMLSpy or if you wish to
send us any other general feedback, please use the questionnaire form.
Training
The Training command takes you to the Online Training page on the Altova website. Here you
can enroll for online courses to help you develop expertise in using Altova products.
21.18.8 About
This command shows the XMLSpy splash screen and copyright information dialog box, which
includes the XMLSpy logo. If you are using the 64-bit version of XMLSpy, this is indicated with
the suffix (x64) after the application name. There is no suffix for the 32-bit version.
Please note:
This dialog box shows the version number - to find the number of the actual build you are using,
please look at the status bar, which always includes the full version and build number.
Programmers' Reference
844
Programmers' Reference
The programmable objects of XMLSpy are made available to Automation Clients via the
XMLSpy API, which is a COM API. The object model of the API and a complete description of
all available objects are provided in this documentation (see the section XMLSpyAPI). The API
can also be used with a Java implementation. A description of how this can be done is given in
the chapter Using the XMLSpy API with Java.
Additionally, you can manipulate XMLSpy with external scripts. For example, you could write a
script to open XMLSpy at a given time, then open an XML file in XMLSpy, validate the file, and
print it out. These external scripts would again make use of the XMLSpy API to carry out these
tasks. For a description of the XMLSpy API, see the section XMLSpyAPI.
1 Release Notes
For each release of the XMLSpy API, important changes since the previous release are listed
below.
Improved events
All events are available as connection point events to allow for easy and flexible integration
of external clients using VBA, C++, VBScript, JScript or Perl. New events supporting the
document life cycle have been added. All events pass event context information as
parameters. Many events support cancellation of the signaled operation. See the section
Overview of Events for more details.
2 Scripting
The Scripting Editor of XMLSpy uses the Form Editor components of the Microsoft .NET
Framework, and thus provides access to the Microsoft .NET Framework. This means that
JScripts and VBScripts not only work with the XMLSpy API—which is a COM API and the API
of XMLSpy—but can also access and use classes of the Microsoft .NET framework.
You can therefore create and use your own macros and forms within XMLSpy, and thus add to
and modify the functionality of your installation of XMLSpy.
Note: Microsoft's .NET Framework 2.0 or higher is a system prerequisite for Scripting Editor,
and it must be installed before XMLSpy is installed.
2.1 Overview
The Scripting Editor provides an interface in which you can: (i) graphically design Forms while
assigning scripts for components in the Form; (ii) create Event Handlers, and (iii) create
Macros.
These Forms, Event Handlers, and Macros are organized into scripting projects, which are then
assigned to XMLSpy application projects and can be used in the application.
Variables and functions can be defined in a Global Declarations script, which is always
executed before Macro or Event Handler scripts.
This section gives an overview of the Scripting Editor and Scripting Projects. It is organized into
the following sections:
Scripting Projects in XMLSpy, which describes how the scripting projects you create
with the Scripting Editor will be used in XMLSpy.
The Scripting Editor GUI, which provides a detailed look at the different parts of the
Scripting Editor GUI and how they are to be used.
Components of a Scripting Project, which explains the different components that go to
make up a scripting project.
The details about the creation of the various components (Global Declarations, Forms, Event
Handlers, and Macros) are described in their respective sections.
You can create any number of Altova Scripting Projects. After a scripting project has been
created, it can be used in the following ways:
It can be set as the global scripting project for XMLSpy. Scripts in the global scripting
project can then be called from within the application, and macros of the Global
Scripting Project can be used for all XMLSpy projects.
It can be assigned to an XMLSpy project (as an application project). When an XMLSpy
project is open in XMLSpy, scripts in the associated scripting project can be called.
Your XMLSpy package contains a sample scripting project called SampleScripts.asprj. This
file is located in the folder: C:\Documents and Settings\<username>\My
Documents\Altova\XMLSpy2011\Examples\ and contains global declarations for a few
standard tasks.
To set a global scripting project for XMLSpy, check the Activate Scripting check box and then
browse for the Altova Scripting Project (.asprj) file you want. You can also specify: (i) whether
Auto-Macros in the scripting project should be automatically executed when XMLSpy starts, and
(ii) whether application event handler scripts in the project should be automatically executed or
not; check or uncheck the respective check boxes accordingly.
Please note:
Nested script execution is possible, i.e. Macros can call other macros, and events are received
during macro, or event, execution.
3. Check the Activate Project Scripts check box and select the required scripting project (
.asprj file). If you wish to run Auto-Macros when the XMLSpy project is loaded, check
the Run Auto-Macros check box.
4. Click OK to finish.
Note: To deactivate (that is, unassign) the scripting project of an XMLSpy project, uncheck
the Activate Project Scripts check box.
The Scripting Project Tree provides access to each component of the scripting project. For
example, in order to display and edit a particular Form, expand the Forms folder in the tree (see
screenshot above), right-click the Form you wish to display or edit, and click Open from the
context menu that pops up.
A quicker way to open a Form, Event, macro, or the Global Declarations script, is to double-
click the respective icon, or text. To delete a Form or Macro from the scripting project, right-click
the component and select the Delete command from the context menu.
The Scripting Project Tree pane contains a toolbar with icons (screenshot below).
The icons, from left to right, are for: (i) creating a new macro, (ii) creating a new form, (iii)
running a macro, and (iv) debugging a macro. These commands are also available in the
context menu that appears when you right-click any component in the Scripting Project Tree.
To switch between the properties and events of the selected component, click, respectively, the
Properties icon (third from left in the Properties and Events toolbar, see screenshot above) and
the Events icon (fourth from left).
The first and second icons from left in the toolbar are, respectively, the Categorized and
Alphabetical icons. These display the properties or events either organized by category or
organized in ascending alphabetical order.
When a property or event is selected, a short description of it is displayed at the bottom of the
Properties and Events pane.
Main Window
The Main Window displays one component at a time and has one or two tabs depending on
what is being displayed. If a Global Declarations script, an Event, or a Macro is being displayed,
then a single tab, the Source tab, displays the source code of the selected component.
mouse over popups; placing the mouse over a known method or property, displays its
signature (and documentation if available)
If a Form is being displayed, then the Main Window has two tabs: a Design tab showing and
enabling the layout of the Form, and a Source tab containing the source code for the Form.
Content in both the Design tab and Source tab can be edited.
Note: Since JScript and VB Script are untyped languages, entry helpers and auto-completion
is supported only in cases of "fully qualified constructs" and "predefined" names.
To insert an object from the Form Object Palette click the object you want in the palette, then
click at the location in the Form where you wish to insert the object. The object will be placed at
this location. In many cases you will need to supply some properties of the object via the
Properties and Events pane. You can drag the object to other locations as well as resize it.
Further, a number of editing commands, such as centering and stacking objects, can be
accessed via the context menu of the selected Form object.
Some Form objects, such as Timer, are not added to the Form but are created as Tray
Components in a tray at the bottom of the Main Window. You can select the object in the tray
and set properties and event handlers for the object via the Properties and Events pane. For an
example of how Tray Components are handled, see Form usage and commands.
These components are displayed in and accessed via the Scripting Project Tree of the Scripting
Editor (screenshot below).
Global Declarations
The Global Declarations component is a script that contains variables and functions that can be
used by Forms, Event Handlers, and Macros. The functions make use of the XMLSpy API to
access XMLSpy functionality. Creating a variable or function in the Global Declarations module
enables it to be accessed from all the Forms, Event Handlers and Macros in the scripting
project.
To add a variable or function, open the Global Declarations component (by right-clicking it in the
Scripting Project Tree and selecting Open) and edit the Global Declarations script in the Main
Window. In this script, add the required variable or function.
Forms
In the Scripting Editor, you can build a Form graphically using a palette of Form objects such as
text input fields and buttons. For example, you can create a Form to accept the input of an
element name and to then remove all occurrences of that element from the active XML
document.
For such a Form, a function script can be associated with a text box so as to take an input
variable, and an Event Handler can be associated with a button to start execution of the delete
functionality, which is available in the XMLSpy API. A Form is invoked by a call to it either within
a function (in the Global Declarations script) or directly in a Macro. For details of how to create
and edit Forms, see the Forms section.
Event handling
Event Handler scripts can be associated with a variety of available events. You can control
events that occur both within Forms (Form events) and within the general application interface (
application events). The script associated with an event is executed immediately upon the
triggering of that event.
Most events have parameters which provide detailed information about the event. The return
value from the script typically instructs the application about how to continue its processing (for
example, the application may not allow editing).
An Event Handler runs when the relevant event occurs in the Form or in XMLSpy. For details
about how to create event handlers, see Event Handlers.
Macros
Macros are used to implement complex or repetitive tasks. Macros do not use either
parameters or return values.
In a Macro, it is possible to access all variables and functions declared in the Global
Declarations and to display Forms for user input.
For a simple example of creating a Macro, see Writing a Macro. Also see Running Macros for a
description of the ways in which a Macro can be called. A Macro is run from within the XMLSpy
interface by clicking Tools | Macros | [MacroName].
Select either JScript or VBScript in the combo box and click OK. The new Scripting
Project is created.
3. Click the Save icon in the Scripting Editor toolbar to save the Scripting Project as a .
asprj file.
4. A Scripting Project can be considered to be made up of several components that work
together. These components will typically be a combination of: Global Declarations,
Forms, Events, and Macros. They can be created in any order, but you should clearly
understand how they work together. The way each type of component is called and
executed is described below. How to create each type of component is described in the
respective sections about the component type.
5. After you have finished creating all the required components, save the Scripting Project
(by clicking the Save icon in the Scripting Editor toolbar).
6. Close the Scripting Editor.
Please note:
Right clicking the Project folder and selecting "Scripting Language..." lets you change
the scripting language at any time.
How Forms, Event Handlers, and Macros are called and executed
Forms, Event Handlers, and Macros are all created in the Scripting Editor. However, the way
they are called and executed is different for each and has a bearing on how you create your
scripting projects.
A Form is invoked by a call to it either within a function in the Global Declarations script
or directly in a Macro.
An Event Handler runs when the relevant event occurs in XMLSpy. If an Event Handler
for a single event is defined in both the Global Scripting Project and the XMLSpy
-project-specific Scripting Project, then the event handler for the project-specific
Scripting Project is executed first and that for the Global Scripting Project immediately
afterwards.
A Macro is executed from within the XMLSpy interface by clicking Tools | Macros |
[MacroName]. In a Macro, it is possible to access all variables and functions declared
in the Global Declarations and to display Forms for user input.
To open the Global Declarations script of a Scripting Project, right-click the Global Declarations
item in the Scripting Project Tree (screenshot above), and select Open. The Global
Declarations script opens in the Main Window.
Given below is an example function. Remember that creating a variable or function in the Global
Declarations script makes this variable or function accessible to all Forms, Event Handlers, and
Macros.
Example function
A function called RemoveAllNamespaces would have code like this:
function RemoveAllNamespaces(objXMLData)
{
if(objXMLData == null)
return;
if(objXMLData.HasChildren) {
var objChild;
// spyXMLDataElement := 4
objChild = objXMLData.GetFirstChild(4);
while(objChild) {
RemoveAllNamespaces(objChild);
try {
var nPos,txtName;
txtName = objChild.Name;
objChild = objXMLData.GetNextChild();
}
catch(Err) {
objChild = null;
}
}
}
}
Note:
It is possible to define local variables and helper functions within macros and event
handlers. Example:
//return value: true allows editing
//return value: false disallows editing
var txtLocal;
function Helper()
{
txtMessage = txtLocal;
Application.ShowForm("MsgBox");
}
function On_BeforeStartEditing(objXMLData)
{
txtLocal = "On_BeforeStartEditing()";
Helper();
}
Recursive functions are supported.
2.4 Forms
Creating and editing Forms in the Scripting Editor consists of the following steps:
1. Creating a New Form. The new Form is created and named, and has properties defined
for it.
2. Designing the Form. A Form is designed by adding Form Objects to it and assigning
values for the different Form Objects.
3. Scripting Form Events. Scripts are assigned to Form-related events.
A new Form is added to the project. It appears in the Main Window and an entry for it is created
in the Scripting Project Tree pane, under the Forms heading. Press the F2 function key to
rename the form, or right click the form name and select Rename from the context menu. In the
screenshot below, we have named the new Form Registration.
Form properties
The properties of the Form, such as its size, background color, and font properties, can be set
in the Properties pane. The screenshot below shows the size and background-color property
values in bold, in the Layout and Appearance categories, respectively.
To insert an object from the Form Object Palette click the object you want in the palette, then
click at the location in the Form where you wish to insert the object. The object will be placed at
this location. In many cases you will need to supply some properties of the object via the
Properties and Events pane. You can drag the object to other locations as well as resize it.
Further, a number of editing commands, such as centering and stacking objects, can be
accessed via the context menu of the selected Form object.
Some Form objects, such as Timer, are not added to the Form but are created as Tray
Components in a tray at the bottom of the Main Window. You can select the object in the tray
and set properties and event handlers for the object via the Properties and Events pane. For an
example of how Tray Components are handled, see Form usage and commands.
Check Box: Adds a check box, which enables Yes/No type selections.
Combo Box: Adds a combo box, which allows the user to select an option from a
drop-down menu.
List Box: Adds a list box, which displays a list of items for selection.
To create an object in the Form, first select the required object in the Form Object Palette and
then click the location in the Form where you want to insert it. After the object has been
inserted, you can resize it as well as drag it to another location in the Form.
When an object is selected in the design, you can specify its properties in the Properties and
Events pane. In the toolbar of the Properties and Events pane, click the Properties icon to
display a list of the object's properties.
For example, in the screenshot below, the Label object with the text Start Date has been
selected in the design. In the Properties and Events pane, the name of the object (which is the
name that is to be used to identify the object in code, Label1 in the screenshot below) is given
in the Design category of properties; in this case, the name of the object is Label1.
The text of the label (which is what appears in the Form) must be entered as the value of the
Text property in the Appearance category of properties.
To assign other object properties, enter values for them in the Properties and Events pane.
For each event, you can enter the name of an existing event handler or function. Alternatively:
you can double click on an event to create: (i) an empty function script in the Source tab
of the Main Window, and (ii) an association of the newly created function with the
selected event.
double click a button in the design tab, to directly generate the handler stub in the code
window.
The screenshot below was taken after the Click event was double-clicked. Notice that an empty
event handler function called FormExample_Label1_Click has been created in the Main
Window and that, in the Properties and Events pane, this function has been associated with the
Click event.
2.5 Events
The Events folder of the scripting project (see screenshot below) contains folders for the
following type of events:
Application Events
Document Events
Authentic View Events
Grid View Events
Text View Events
Note that these events are XMLSpy-specific, as opposed to Form-based events. Each of the
folders listed above contains a set of events for which Event Handler scripts can be written.
To access the event handler script of any of these events, right-click the event and select Open
from the context menu. The script will be displayed in the Main Window (see screenshot below)
and can be edited there. After you have finished editing the script, save changes by clicking the
Save command in the toolbar of the Scripting Editor.
Helper();
}
While a macro is executed, Event Handlers from XMLSpy are not processed.
In order for events to be processed, the Process Events options must be toggled on in
the Scriptings options of XMLSpy. See Scripting Projects in XMLSpy for details.
Also see Programming Points.
Application Events
OnInitialize
The OnInitialize event is raised after the main window becomes visible but before any
project is loaded. This event is not raised if the application can't be loaded at all.
OnRunning
If the application is completely loaded and after the OnInitialize event occurs, the OnRunning
event is raised.
OnShutdown
The event is raised after any open project and all documents have been closed on shutdown of
the application. The main window is no longer visible.
Example
The following script is an Event Handler for the On_BeforeOpenProject event. It allows you to
add a script that will be executed each time before XMLSpy opens a project. The example script
below sequentially opens all XML files located in the XML folder of the project and validates
them. If the validation fails, the script shows the validation error and stops. If a file passes the
validity test, it will be closed and the next file will be opened.
Enter the following script for the On_BeforeOpenProject() event, and then save the scripting
project.
function On_BeforeOpenProject()
{
var bOK;
var nIndex,nCount;
var objItems,objXMLFolder = null;
objItems = Application.CurrentProject.RootItems;
nCount = objItems.Count;
if(txtExtensions.indexOf("xml") >= 0) {
objXMLFolder = objItems.Item(nIndex);
break;
}
}
nCount = objXMLFolder.ChildItems.Count;
objChild = objXMLFolder.ChildItems.Item(nIndex);
try {
objDoc = objChild.Open();
bOK = objDoc.IsValid(strError,nErrorPos,objBadData);
if(!bOK) {
// if the validation fails, we should display the
// message from XMLSpy
// of course we have to create the form "MsgBox" and
// define the global txtMessage variable
//
// txtMessage = Position:" + nErrorPos[0] + "\n" + // strError[0];
// txtMessage += "\n\nXML:\n" + objBadData[0].Name + ", " +
// objBadData[0].TextValue;
//
// Application.ShowForm("MsgBox");
break;
}
objDoc.Close(true);
objDoc = null;
}
catch(Err) {
// displaying the error description here is a good idea
// txtMessage = Err.Description;
// Application.ShowForm("MsgBox");
break;
}
}
}
}
2.6 Macros
Macros automate repetitive or complex tasks. In the Scripting Environment, you can create a
script that calls application functions as well as custom functions that you have defined. This
flexibility provides you with a powerful method of automating tasks within XMLSpy. This section
about macros is organized as follows:
Creating and Editing a Macro describes how to create a new macro and edit an existing
one.
Running a Macro explains how a macro can be run from the Scripting Editor and from
the broader XMLSpy environment as well.
Debugging and Setting as Auto-Macro records the debugging and set as Auto-Macro
features of the Scripting Editor.
The newly created (and empty) macro document is displayed in the Main Window, and the
name of the macro is displayed in the title bar of the Scripting Editor.
Opening a macro
To open a macro, right-click the macro in the Macros folder of the Scripting Project tree (see
screenshot above), and select the Open command. The macro is displayed in the Main Window
and its name is displayed in the title bar of the Scripting Editor (screenshot below).
Note that while a macro is executed, Event Handlers from XMLSpy are not processed. Also,
only one macro can be run at a time. After a macro (or event) is executed, the script is closed
and global variables lose their values.
From the submenu of available macros, select the macro to run. The macro will be executed.
Toolbar icon
You can create an icon in the toolbar or a menu item that runs a selected macro. To do this,
click Tools | Customize | Macros. This causes the Customize dialog to be displayed (
screenshot below).
To remove the toolbar icon, open the Macros tab of the Customize dialog and drag the icon out
of the toolbar and into the Associated Commands pane. Select the command in the Associated
Commands pane and click Remove to remove the command from the pane.
If there are no project scripts, or if XMLSpy cannot find the macro, then it looks for
the macro in the global scripts.
The second parameter (Delete Elements Dialog) is the display text for the
menu item.
2. Reset the Tools menu by calling ClearMacroMenu(). This removes all previously
added menu items
The best way to call these two functions is with the Autorun macro of the global scripting
project or the On_OpenProject event.
This pops up the Just-In-Time Debugging dialog (screenshot below), which lists the debuggers
available on the machine. Select the debugger you wish to use and click Yes.
All namespaces and types of the following .NET components can be accessed in the
Microsoft .NET Framework:
System
System.Data
System.Design
System.Drawing
System.Windows.Forms
System.XML
Out-parameters from methods of the XMLSpy API require special variables in JScript.
Given below are some examples.
// use JScript method to access out-parameters
var strError = new Array(1);
var nErrorPos = new Array(1);
var objBadData = new Array(1);
bOK = objDoc.IsValid(strError,nErrorPos,objBadData);END
.NET Methods that require integer arguments should not be called directly with JScript
Number Objects which are Floating Point Values.
For example, instead of:
var objCustomColor = CLR.Static( "System.Drawing.Color" ).
FromArgb( 128, 128, 128 );
use:
var objCustomColor = CLR.Static( "System.Drawing.Color" ). FromArgb(
Math.floor( 128 ), Math.floor( 128 ), Math.floor( 128 ) );
Enumeration literals, as defined in the Altova type libraries, can now be used instead of
numerical values.
objExportXMIFileDlg.XMIType = eXMI21ForUML23;
Built-in commands
The following built-in commands are available.
ShowForm(strFormName : String)
Instantiates a New Form object from the given form name and immediately shows it as Dialog.
Return Value: A Number that represents the generated DialogResult.
lastform
This global field can be used to conveniently access the last form object that was created.
Return Value: Returns a reference to the last form object that was successfully instantiated via
CreateForm() or ShowForm().
doevents()
Processes all Windows messages currently in the message queue.
Return Value: None
watchdog(bEnable : boolean)
Long running CPU-intensive scripts cause the watchdog to ask the user if the script should be
terminated. The watchdog() method is used to disable or enable this behavior.
Return Value: None
Usage tip:
Calling watchdog(true) can also be used to reset the watchdog. This can be useful before
executing long running (CPU intensive) tasks to ensure they have the maximum allowed script
processing quota.
confirm(strMessage : String)
Opens a dialog that shows the given confirm message (typically a yes/no question).
Return Value: A Boolean that represents the users answer.
CLR.Import(strNamespaceCLR : String)
This is the scripting equivalent to the C# using / VB.Net imports keyword. This allows to leave
out the given namespaces in successive calls of CLR.Create() and CLR.Static().
Return Value: None
CLR.ShowImports()
CLR.Static(strTypeNameCLR : String)
Gives access to .NET types that have no instances and contain only static members.
Return Value: A reference to the static .NET object
With Form objects, the Form Component Tree can be accessed naturally via field
access:
TrayComponents:
MyTimer
or
objForm.TextEditor.Text = "Hello World";
To access Tray Components use the following method on the Form object:
var objTrayComponent = <A form object>.GetTrayComponent(strComponentName
: String);
In our example to get a reference to the Timer Component to enable it use the following:
var objTimer = objForm.GetTrayComponent("MyTimer");
objTimer.Enabled = true;
For ActiveX Controls the underlying COM object can be accessed via the OCX property:
var ocx = lastform.AxMediaPlayer1.OCX; // get underlying COM object
ocx.enableContextMenu = true;
ocx.URL = "mms://apasf.apa.at/fm4_live_worldwide";
If a previous Scripting Projects (.prj file) is opened with the new Scripting Editor
(version 2010 and later), the visual layout of Forms will be migrated as faithfully as
possible and scripts will be copied as they are in the .prj file. You will then need to
modify the scripts to be in accordance with the new technology used by the Scripting
Editor, and which is described in this documentation.
TheView object: The old Scripting Environment provided an artificial property named
TheView that was only accessible from inside event handlers. It was used to access the
Form that trigged the event (either directly or from one of its child controls). The new
Scripting IDE does not provide this artificial property but instead provides the same
functionality, and much more, with orthogonal built-in scripting helper functions
combined with the power of the .NET framework.
Since all event handlers in the new Scripting Environment get a sender object as a first
parameter, the source that triggered the event is always available. By calling the .NET
function FindForm() on the sender object one can access the Form object easily.
Alternatively (if only one Form is involved) the built-in property lastform can be used.
Note that the use of lastform is not constrained to event handlers (as was the case
with TheView). It can be used everywhere in script code.
Given below is a list of methods and properties of the TheView object, each accompanied by an
alternative mechanism offered by the new Scripting Environment.
Methods
The following methods were provided by the TheView object and must be migrated as
explained:
Cancel()
In the new scripting environment the same can be achieved with: lastform.Close(); // Use
.NET Form.Close()
if(objFormColorSelector.Visible)
{
...
}
OpenDoc(File as String)
The same can be achieved with: Application.OpenDocument( File as String )
PumpData()
This corresponds to the built-in function doevents() which processes all Windows messages
currently in the message queue.
Properties
The following properties were provided by the TheView object and must be migrated as
explained:
ToolTipText as String
To use tooltips in the new scripting environment, the .NET infrastructure can be used. This
allows fine-grained control of tooltip behaviour (adjusting delays, when to show, etc). For
example, to provide tooltips for a Form with two controls, the following code could to be added
to the Form's Load event handler:
Color as Long
Since all Form/controls in the new Scripting Environment are .NET controls from the System.
Windows.Forms namespace, the possibilities to modify colors, background image, fonts, and all
other visual aspects are numerous. For example, every Visual Component has the properties
BackColor and ForeColor to modify the visual appearance. The following handler could be
used to change the color of a button at runtime:
Please refer to the .NET documentation to find out more about this topic:
http://msdn.microsoft.com/en-us/library/system.windows.forms.aspx
3 Plugins
XMLSpy allows you to create your own IDE plug-ins and integrate them into XMLSpy.
XMLSpy expects your plug-in to implement the IXMLSpyPlugIn interface. See ATL sample files
for an example using C++. The relevant files are in the following folder of your XMLSpy
installation:
C:\Documents and Settings\<username>\My Documents\Altova\XMLSpy2011
\Examples\CSharpIDEPlugin
For a sample using VisualBasic, look in the following folder of your XMLSpy installation:
C:\Documents and Settings\<username>\My Documents\Altova\XMLSpy2011
\Examples\XMLSpyPlugInActiveX
HKEY_CURRENT_USER\Software\Altova\XML Spy\PlugIns
All values of this key are treated as references to registered plug-ins and must conform to the
following format:
Each time the application starts the values of the "PlugIns" key is scanned, and the registered
plug-ins are loaded.
If you experience problems with manual registration you can check if the CLSID of your plug-in
is correctly registered in the "PlugIns" key. If this is not the case, the name of your plug-in DLL
was probably not sufficiently unique. Use a different name or perform direct registration.
The XML file containing the UI modifications for the IDE PlugIn, must have the following
structure:
<ConfigurationData>
<ImageFile>path To image file</ImageFile>
<Modifications>
<Modification>
...
</Modification>
...
</Modifications>
</ConfigurationData>
You can define icons or toolbar buttons for the new menu items which are added to the UI of
XMLSpy by the plug-in. The path to the file containing the images is set using the ImageFile
element. Each image must be 16 x 16 pixels using max. 256 colors. The image references
must be arranged from left to right in a single (<ImageFile>...) line. The rightmost image index
value, is zero.
The Modifications element can have any number of Modification child elements. Each
Modification element defines a specific change to the standard UI of XMLSpy. Starting with
version 4.3, it is also possible to remove UI elements from XMLSpy.
<Modification>
<Action>Type of action</Action>
<UIElement Type="type of UI element">
</UIElement>
</Modification>
You can combine values of the Action element e.g. "Hide Remove"
The UIElement element describes any new, or existing UI element for XMLSpy. Possible
elements are currently: new toolbars, buttons, menus or menu items. The type attribute, defines
which UI element is described by the XML element.
<ID></ID>
<Name></Name>
If UIElement describes an existing element of the UI, the value of the ID element is predefined
by XMLSpy. Normally these ID values are not known to the public. If the XML fragment
describes a new part of the UI, then the ID is arbitrary and the value should be less than 1000.
The Name element sets the textual value. Existing UI elements can be identified just by name,
for e.g. menus and menu items with associated sub menus. For new UI elements, the Name
element sets the caption e.g. the title of a toolbar, or text for a menu item.
<UIElement Type="ToolBar">
<ID>1</ID>
<Name>TestPlugIn</Name>
</UIElement>
<UIElement Type="Menu">
<ID>129</ID>
<Name>Edit</Name>
</UIElement>
An additional element is used if you want to create a new menu. The Place element defines the
position of the new menu in the menu bar:
<UIElement Type="Menu">
<ID>129</ID>
<Name>PlugIn Menu</Name>
<Place>12</Place>
</UIElement>
A value of -1 for the Place element sets the new button or menu item at the end of the menu or
toolbar.
Commands
If you add a new command, through a toolbar button or a menu item, the UIElement fragment
can contain any of these sub elements:
<MacroName></MacroName>
<Info></Info>
<ImageID></ImageID>
If MacroName is specified, XMLSpy searches for a macro with the same name in the scripting
environment and executes it each time this command is processed. The Info element contains
a short description string which is displayed in the status bar, when the mouse pointer is over
the associated command (button or menu item). ImageID defines the index of the icon the
external image file. Please note that all icons are stored in one image file.
<UIElement Type="ToolBarItem">
<!--don't reuse local IDs even the commands do the same-->
<ID>5</ID>
Additional elements to declare a toolbar button are Place, ToolBarID and ToolBarName.
ToolBarID and ToolBarName are used to identify the toolbar which contains the new or existing
button. The textual value of ToolBarName is case sensitive. The (UIElement) type attribute
must equal "ToolBarItem".
To define a menu item, the elements MenuID, Place and Parent are available in addition to the
standard elements used to declare a command. MenuID can be either 128 or 129. Please see
"Toolbars and Menus" for more information on these values.
The Parent element is used to identify the menu where the new menu entry should be inserted.
As sub menu items have no unique Windows ID, we need some other way to identify the parent
of the menu item.
<UIElement Type="MenuItem">
<!--the following element is a Local command ID-->
<ID>3</ID>
<Name>Open file from repository...</Name>
<Place>-1</Place>
<MenuID>129</MenuID>
<Parent>:PlugIn Menu</Parent>
<ImageID>0</ImageID>
</UIElement>
XMLSpy makes it possible to add toolbar separators and menus if the value of the ID element is
set to 0.
To access the API the implementation imports the Type Library of XMLSpy. The code reads
various properties and calls methods using the smart pointers provided by the #import
statement.
In addition, the sample code uses the MFC class CString and the ATL conversion macros such
as W2T.
Having created the project files you can add an ATL object to implement the
IXMLSpyPlugIn interface:
1. Select "New ATL Object..." from the "Insert" menu.
2. Select "Simple Object" from the wizard and click "Next".
3. Type in a name for the object.
4. On the "Attributes" tab, select "Custom" for the type of interface, and disable
Aggregation.
These steps produce the skeleton code for the implementation of the IDE plug-in interface.
Please see the following pages on how to modify the code and achieve some basic
functionality.
Having created the ATL object, you then need to implement the IDE plug-in interface of
XMLSpy.
import "oaidl.idl";
import "ocidl.idl";
// ----- please insert the following block into your IDL file -----
typedef enum {
spyEnable = 1,
spyDisable = 2,
spyCheck = 4,
spyUncheck = 8
} SPYUpdateAction;
// ----- E.g. Interface entry automatically generated by the ATL wizard -----
// [
// object,
// uuid(AB7CD86A-8145-429A-A1F3-270692EO8AFC),
// helpstring("IXMLSpyPlugIn Interface")
// pointer_default(unique)
// ]
// interface IXMLSpyPlugIn : IUnknown
// {
// };
// ----- replace the Interface Entry (shown above) generated for you by the
ATL wizard, with the following block -----
[
odl,
uuid(88F2A622-4B7E-42CD-8D04-3C0E5389DD85),
helpstring("IXMLSpyPlugIn Interface")
]
interface IXMLSpyPlugIn : IUnknown
{
HRESULT _stdcall OnCommand([in] long nID, [in] IDispatch* pXMLSpy);
// ----- The code below is automatically generated by the ATL wizard and will
look slightly different in your case -----
[
uuid(24FE0D1B-3FC0-494E-B36E-1D4CE412B014),
version(1.0),
helpstring("XMLSpyIDEPlugInDLL 1.0 Type Library")
]
library XMLSPYIDEPLUGINDLLLib
{
importlib("stdole32.tlb");
importlib("stdole2.tlb");
[
uuid(3800E791-7F6B-4ACD-9E32-2AC184444501),
helpstring("XMLSpyIDEPlugIn Class")
]
coclass XMLSpyIDEPlugIn
{
[default] interface IXMLSpyPlugIn; // ----- define IXMLSpyPlugIn as the
default interface -----
};
};
#ifndef __XMLSPYIDEPLUGIN_H_
#define __XMLSPYIDEPLUGIN_H_
/////////////////////////////////////////////////////////////////////////////
// CXMLSpyIDEPlugIn
class ATL_NO_VTABLE CXMLSpyIDEPlugIn :
public CComObjectRootEx<CComSingleThreadModel>,
public CComCoClass<CXMLSpyIDEPlugIn, &CLSID_XMLSpyIDEPlugIn>,
public IXMLSpyPlugIn
{
public:
CXMLSpyIDEPlugIn()
{
}
DECLARE_REGISTRY_RESOURCEID(IDR_XMLSPYIDEPLUGIN)
DECLARE_NOT_AGGREGATABLE(CXMLSpyIDEPlugIn)
DECLARE_PROTECT_FINAL_CONSTRUCT()
BEGIN_COM_MAP(CXMLSpyIDEPlugIn)
COM_INTERFACE_ENTRY(IXMLSpyPlugIn)
END_COM_MAP()
// IXMLSpyIDEPlugIn
public:
virtual HRESULT _stdcall OnCommand(long nID, IDispatch* pXMLSpy);
#endif //__XMLSPYIDEPLUGIN_H_
3.4.3 Implementation
The code below shows a simple implementation of an XMLSpy IDE plug-in. It adds a menu item
and a separator (available with XMLSpy) to the Tools menu. Inside the OnUpdateCommand()
method, the new command is only enabled when the active document is displayed using the
Grid View. The command searches for the XML element which has the current focus, and
opens any URL starting with "http://", from the textual value of the element.
/////////////////////////////////////////////////////////////////////////////
// CXMLSpyIDEPlugIn
#import "XMLSpy.tlb"
using namespace XMLSpyLib;
if(nID == 1) {
IApplicationPtr ipSpyApp;
if(pXMLSpy) {
if(SUCCEEDED(pXMLSpy->QueryInterface(__uuidof(IApplication),(void
**)&ipSpyApp))) {
IDocumentPtr ipDocPtr = ipSpyApp->ActiveDocument;
if(ipGridPtr) {
IXMLDataPtr ipXMLData = ipGridPtr->CurrentFocus;
return S_OK;
}
if(nID == 1) {
IApplicationPtr ipSpyApp;
if(pXMLSpy) {
if(SUCCEEDED(pXMLSpy->QueryInterface(__uuidof(IApplication),(void
**)&ipSpyApp))) {
IDocumentPtr ipDocPtr = ipSpyApp->ActiveDocument;
return S_OK;
}
return bstrMods.CopyTo(pModificationsXML);
}
3.5 IXMLSpyPlugIn
See also
Methods
OnCommand
OnUpdateCommand
OnEvent
GetUIModifications
GetDescription
Description
If a DLL is added to XMLSpy as an IDE plug-in, it is necessary that it registers a COM
component that answers to an IXMLSpyPlugIn interface with the reserved
uuid(88F2A622-4B7E-42CD-8D04-3C0E5389DD85), for it to be recognized as a plug-in.
3.5.1 OnCommand
See also
Description
The OnCommand() method of the interface implementation, is called each time a command
added by the the IDE plug-in (menu item or toolbar button) is processed. nID stores the
command ID defined by the ID element of the respective UIElement.
pXMLSpy holds a reference to the dispatch interface of the Application object of XMLSpy.
Example
Public Sub IXMLSpyPlugIn_OnCommand(ByVal nID As Long, ByVal pXMLSpy As Object)
If (Not (pXMLSpy Is Nothing)) Then
Dim objDlg
Dim objDoc As XMLSpyLib.Document
Dim objSpy As XMLSpyLib.Application
Set objSpy = pXMLSpy
objDoc.Save
Set objDoc = Nothing
End If
End If
End If
3.5.2 OnUpdateCommand
See also
Description
The OnUpdateCommand() method is called each time the visible state of a button or menu
item needs to be set. nID stores the command ID defined by the ID element of the respective
UIElement.
spyEnable = 1
spyDisable = 2
spyCheck = 4
spyUncheck = 8
Example
Public Function IXMLSpyPlugIn_OnUpdateCommand(ByVal nID As Long, ByVal
pXMLSpy As Object) As SPYUpdateAction
IXMLSpyPlugIn_OnUpdateCommand = spyDisable
3.5.3 OnEvent
See also
Description
OnEvent() is called each time an event is raised from XMLSpy.
On_BeforeStartEditing =1
On_EditingFinished =2
On_FocusChanged =3
On_Beforedrag =4
On_BeforeDrop =5
On_OpenProject =6
On_OpenDocument =7
On_CloseDocument =8
On_SaveDocument =9
On_DocEditDragOver = 10
On_DocEditDrop = 11
On_DocEditKeyDown = 12
On_DocEditKeyUp = 13
On_DocEditKeyPressed = 14
On_DocEditMouseMove = 15
On_DocEditButtonUp = 16
On_DocEditButtonDown = 17
On_DocEditContextMenu = 18
On_DocEditPaste = 19
On_DocEditCut = 20
On_DocEditCopy = 21
On_DocEditClear = 22
On_DocEditSelectionChanged = 23
On_DocEditDragOver = 10
On_BeforeOpenProject = 25
On_BeforeOpenDocument = 26
On_BeforeSaveDocument = 27
On_BeforeCloseDocument = 28
On_ViewActivation = 29
On_DocEditKeyboardEvent = 30
On_DocEditMouseEvent = 31
Events available since XMLSpy 2006 SP1 (type library version 1.5):
On_BeforeValidate = 32
On_BeforeShowSuggestions = 33
On_ProjectOpened = 34
On_Char = 35
On_Initialize = 36
On_Running = 37
On_Shutdown = 38
The names of the events are the same as they appear in the Scripting Environment of XMLSpy.
For IDE plug-ins the names used are immaterial. The events are identified using the ID value.
arrayParameters is an array which is filled with the parameters of the currently raised event.
Order, type and meaning of the single parameters are available through the scripting
environment of XMLSpy. The events module of a scripting project, contains predefined
functions for all events prior to version 4.4. The parameters passed to the predefined functions
are identical to the array elements of the arrayParameters parameter.
Events raised from the Authentic View of XMLSpy do not pass any parameters directly. An
"event" object is used instead. The event object can be accessed through the Document object
of the active document.
pXMLSpy holds a reference to the dispatch interface of the Application object of XMLSpy.
If the return value of OnEvent() is set, then neither the IDE plug-in, nor an event handler
inside of the scripting environment will get this event afterwards. Please note that all IDE
plug-ins get/process the event before the Scripting Environment does.
3.5.4 GetUIModifications
See also
Description
The GetUIModifications() method is called during initialization of the plug-in, to get the
configuration XML data that defines the changes to the UI of XMLSpy. The method is called
when the plug-in is loaded for the first time, and at every start of XMLSpy.
See also Configuration XML for a detailed description how to change the UI.
Example
Public Function IXMLSpyPlugIn_GetUIModifications() As String
' GetUIModifications() gets the XML file with the specified modifications
of
' the UI from the config.xml file in the plug-in folder
Dim strPath As String
strPath = App.Path
' this replaces the token '**path**' from the XML file with
' the actual installation path of the plug-in to get the image
file
Dim strMods As String
strMods = stream.ReadAll
strMods = Replace(strMods, "**path**", strPath)
IXMLSpyPlugIn_GetUIModifications = strMods
Else
IXMLSpyPlugIn_GetUIModifications = ""
End If
End If
End Function
3.5.5 GetDescription
See also
Description
GetDescription() is used to define the description string for the plug-in entries visible in the
Customize dialog box.
Example
Public Function IXMLSpyPlugIn_GetDescription() As String
IXMLSpyPlugIn_GetDescription = "Sample Plug-in for XMLSpy;This Plug-in
demonstrates the implementation of a simple VisualBasic DLL as a Plug-in for
XMLSpy."
End Function
XMLSpy and the XMLSpy API follow the common specifications for automation servers set out
by Microsoft. It is possible to access the methods and properties of the XMLSpy API from
common development environments, such as those using C, C++, VisualBasic, and Delphi, and
with scripting languages like JavaScript and VBScript.
This documentation
The documentation about the XMLSpy API is broadly divided into two parts.
The first part consists of an Overview, which describes the object model for the API,
important concepts, and Usage Examples to help you get started.
The second part is a reference section that contains descriptions of all the interface
objects of the XMLSpy API.
There have been improvements and updates made from release to release. The differences
between releases are documented in Release Notes.
4.1 Overview
This overview of the XMLSpy API provides you with the object model for the API, and with a
description of the most important API processes. The following topics are covered:
The object model
Simple document access
Error handling
Events
Import and export of data
Using XMLData to modify document structure
The DOM and XMLData
Changes to the API from from version to version of the type library are listed in the release
notes section.
The picture below shows you the links between the main objects of the XMLSpy API:
2. Reference to current project and methods for creating and opening of projects.
3. Methods to support the export to and import from databases, text files and Word
documents.
4. URL management.
Once you have created an Application object you can start using the functionality of XMLSpy.
Most of the times you either open a project and access the documents from there or you directly
open a document via the Documents interface.
Example:
Sometimes it is necessary to show a file dialog to the user to select a file. This usually happens
in the scripting environment and you only need to pass True as the second parameter to
OpenFile().
To create a new file use Documents.NewFile(). Any existing file with the same path will be
overwritten during the next Document.Save() call.
Documents collection
All open documents are accessible via the Documents collection. All collection objects in the
XMLSpy API conform to the Microsoft specifications. So it is possible to use the For-Each loop
in VisualBasic to iterate through the open documents.
Example:
Dim objDocs As Documents
Dim objDoc As Document
Another way to access a document is the Documents.Item method. The method takes an
index as a parameter and gets the corresponding document object from the collection. Please
note that 1 is the first index value. Documents.Count retrieves the total number of documents.
Example:
Dim objDocs As Documents
Validation
One common task on documents is to validate them against an assigned schema or DTD. If the
XML file has no schema or DTD already assigned, use Document.AssignSchema or
Document.AssignDTD to add the necessary references to the document.
Examples:
objSpy.ActiveDocument.AssignSchema "C:\mySchema.xsd", False
Or
If you want the user to select a schema or DTD, pass True as the second parameter to these
functions to display a file-dialog. These methods only put the reference into the document and
do not check the existence of the specified file. If the file path is not valid, the validation will fail.
After you have assigned a valid schema or DTD reference to your file, you are able to validate it
with Document.IsValid. IsValid needs some out-parameters that must be declared as
VARIANTs to be accessible from script languages like VBScript and JavaScript.
Example:
VisualBasic, scripting languages and other high-level development environments, don't give the
programmer access to the returning HRESULT of a COM call. They use the second error raising
mechanism also supported by the XMLSpy API, the IErrorInfo interface. If an error occurs
the API creates a new object that implements the IErrorInfo interface. The development
environment takes this interface, and fills its own error handling mechanism with the provided
information.
The next paragraphs describes how to deal with errors raised from the XMLSpy API in different
development environments.
VisualBasic
A common way to handle errors in VisualBasic is to define an error handler. This error handler
can be set with the On Error statement. Usually the handler displays a error message and
does some cleanup to avoid spare references and any kind of resource leaks. VisualBasic fills
its own Err object with the information from the IErrorInfo interface.
Example:
Sub Validate()
'place variable declarations here
'exit
Exit Sub
ErrorHandler:
Set objBadXMLData = Nothing
JavaScript
The Microsoft implementation of JavaScript (JScript) provides a try-catch mechanism to deal
with errors raised from COM calls. It is very similar to the VisualBasic approach, because you
also declare an error object containing the necessary information.
Example:
Function Validate()
{
// please insert variable declarations here
try{
bValid = objSpy.ActiveDocument.IsValid(sMsg,nPos,objBad);
}
catch(Error) {
objBad = Null;
sError = Error.description;
nErrorCode = Error.number;
Return False;
}
Return bValid;
}
C/C++
C/C++ gives you easy access to the HRESULT of the COM call and to the IErrorInterface.
H R E S U LThr;
If(SUCCEEDED(::GetErrorInfo(0,&ipErrorInfo))) {
BSTRbstrDescr;
ipErrorInfo->GetDescription(&bstrDescr);
4.1.4 Events
The automation interface of XMLSPY provides a large set of events to allow for a tight
integration of XMLSPY and its clients. The way events can be used by clients depends on their
technology used to connect to XMLSPY and on the clients programming language.
XMLSPY scripting environment - macros, forms and event handlers written with the
FormEditor
The XMLSPY scripting environment automatically invokes the event handler with the
corresponding name. Use the FormEditor to add code for those events you want to handle.
The FormEditor predefines the correct signatures for all event handlers when you create a
new project. For more information see the scripting environment.
VBScript
All event handler functions start with 'On_'. To stay compatible to existing events, their
name might differ slightly from the name used on the connection point interface.
Specification of event parameters is optional so that old event handlers that did not expect
any parameters still work.
JScript
All event handler functions start with 'On_'. To stay compatible to existing events, their
name might differ slightly from the name used on the connection point interface.
Specification of event parameters is optional so that old event handlers that did not expect
any parameters still work.
External clients
COM specifies the connection point mechanism to define a way how a client can register
itself at a server for callbacks. The automation interface for XMLSPY defines the necessary
event interfaces. The way to connect to those events, depends on the programming language
you use in your client.
' tell VBA to connect to events once this objects gets created
Dim WithEvents objView As XMLSpyLib.AuthenticView
' initialize the object somewhere in your code
...
Set objView = objSpy.ActiveDocument.AuthenticView
...
' sample event handler for the OnMouseEvent of the object in objView
Private Function objView_OnMouseEvent (ByVal i_nXPos As Long, ByVal
i_nYPos As Long,
ByVal i_eMouseEvent As
XMLSpyLib.SPYMouseEvent,
ByVal i_pRange As
XMLSpyLib.IAuthenticRange ) As Boolean
If (i_eMouseEvent = (XMLSpyLib.spyLeftButtonDownMask Or
XMLSpyLib.spyCtrlKeyDownMask)) Then
On Error Resume Next
i_pRange.Select
objView_OnMouseEvent = True
Else
objView_OnMouseEvent = False
End If
End Function
}
catch(err)
{ WScript.Echo ("Can't create WScript.Shell object or XMLSPY"); }
objDoc = null;
WScript.Echo ("stopped listening for event");
objSpy.Quit();
C++
The following is an excerpt of a C++ client using connection points via ATL
#import "XMLSpy.tlb"
// If only Authentic is installed (and XMLSpy is not installed) use:
// #import "Authentic.tlb"
public:
XMLSpySEApplicationEventPump ();
~XMLSpySEApplicationEventPump();
BEGIN_SINK_MAP(XMLSpySEApplicationEventPump)
// OnBeforeOpenProject
SINK_ENTRY_INFO(XMLSPYSE_APPLICATION_SOURCE_ID,
DIID__IApplicationEvents,
1, OnBeforeOpenProject,
&Info_OnBeforeOpenProject)
END_SINK_MAP()
};
XMLSpySEApplicationEventPump::XMLSpySEApplicationEventPump ()
{
...
// get an IUnknown pointer to XMLSpy application from somewhere and
store it in ipXMLSPY
HRESULT hRes = XMLSpySEApplicationEventImpl::DispEventAdvise(ipXMLSPY,
&DIID__IApplicationEvents);
...
}
XMLSpySEApplicationEventPump::~XMLSpySEApplicationEventPump()
{
...
// disconnect from connection point
HRESULT hRes =
XMLSpySEApplicationEventImpl::DispEventUnadvise(ipXMLSPY,
&DIID__IApplicationEvents);
...
}
Most of the methods for importing and exporting data are placed in the Application object,
the remaining functions are accessible via the Document interface.
There is some preparatory work necessary, before the actual import or export can be started.
Every import/export job consists of two parts. You need to define a connection to your data and
the specific behaviour for the import/export process.
In case of an import, the connection is either a database, a text-file or a Word document. The
behaviour is basically which data (columns) should be imported in XMLSpy.
In case of an export, the connection is either a database or a text file. Specify which data
(elements of the XML file) and additional parameters (e.g. automatic key generation or number
of sub-levels) to use from the XML-structure for the behaviour.
database connection:
To complete the settings you create a SQL select statement to define the data to be queried:
objImpSettings.SQLSelect = "SELECT * FROM myTable"
This collection gives you the opportunity to control which columns should be imported
and what type the new elements will become. Each item of the collection represents
one column to import. If you remove an item, the corresponding column will not be
imported. You can additionally modify the ElementListItem.ElementKind
property, to set the type of the created XML elements for each column.
You have to set at least the ImportFile property to the path of the file for the import.
Another important property is HeaderRow. Set it to False, if the text file does not
contain a leading line as a header row.
objImpSettings.ImportFile = "C:\myFile.txt"
objImpSettings.HeaderRow = False
Export to database
objExpSettings.CreateKeys = False
objExpSettings.ExportAllElements = False
objExpSettings.SubLevelLimit = 2
Export to text
1. Access to the names and values of all kinds of elements (e.g. elements, attributes)
Structure of XMLData
Before you can use the XMLData interface, you have to know how an existing XML file is
mapped into a XMLData structure. One major thing you must be aware of is, that XMLData has
no separate branch of objects for attributes.
The attributes of an element are also children of the element. The XMLData.Kind property,
gives you the opportunity to distinguish between the different types of children of an element.
Example:
<ParentElement>
<FirstChild attr1="Red" attr2="Black">
This is the value of FirstChild
</FirstChild>
<SecondChild>
<!--Your Comment-->
</DeepChild>
</SecondChild>
This is Text
</ParentElement>
The parent of all XML elements inside of a document is the property Document.RootElement
. The first element of a document's content - without the XML prolog - is accessible with the
property Docum ent.DataRoot . Use one of these XMLData objects to get references to all other
XML elements in the structure.
The following example adds a third child between <FirstChild> and the <SecondChild>
element:
Dim objParent As XMLData
Dim objChild As XMLData
Dim objNewChild As XMLData
objParent.InsertChild objNewChild
objNewChild.Name = "OneAndAHalf"
Set objNewChild = Nothing
Child elements should be inserted in a special order. Please avoid inserting attributes into a
sequence after any other child elements, i.e. make sure that attributes are placed first.
Instead of using InsertChild or AppendChild you have to copy the object hierarchy
manually. The following function written in JavaScript is an example for recursively copying
XMLData:
// -----------------------------------------------------------
// XMLSpy scripting environment - GlobalDeclarations - JScript
// return a deep copy of the XMLData Object.
// the new object is owned by the document sepcified in objDoc
// -----------------------------------------------------------
function XMLDataDeepCopy(objXMLData, objDoc)
{
// create new element of same kind
var objNew = objDoc.CreateChild(objXMLData.Kind);
while(objChild)
{
try
{
objNew.AppendChild(XMLDataDeepCopy(objChild, objDoc));
objChild = objXMLData.GetNextChild();
}
catch(e)
{
if ((e.number & 0xffff) == 1503) // end of list
objChild = null;
else
throw(e);
}
}
}
return objNew;
}
To erase XMLData objects you need access to the parent of the elements you want to remove.
Use XMLData.GetFirstChild and XMLData.GetNextChild to get a reference to the
parent XMLData object.
////////////////////////////////////////////////////////////////
// DOM To XMLData conversion
Function ProcessDOMNode(objNode,objCreator)
{
var objRoot;
objRoot = CreateXMLDataFromDOMNode(objNode,objCreator);
If(objRoot) {
var newNode;
newNode = ProcessDOMNode(Attribute,objCreator);
objRoot.AppendChild(newNode);
}
}
If(objNode.hasChildNodes) {
try {
// add children
var Item;
oNodeList = objNode.childNodes;
var newNode;
newNode = ProcessDOMNode(Item,objCreator);
objRoot.AppendChild(newNode);
}
}
catch(err) {
}
}
}
Return objRoot;
}
Function CreateXMLDataFromDOMNode(objNode,objCreator)
{
var bSetName = True;
var bSetValue = True;
var nKind = 4;
switch(objNode.nodeType){
Case 2:nKind = 5;break;
Case 3:nKind = 6;bSetName = False;break;
Case 4:nKind = 7;bSetName = False;break;
Case 8:nKind = 8;bSetName = False;break;
Case 7:nKind = 9;break;
}
var objNew = Null;
objNew = objCreator.CreateChild(nKind);
If(bSetName)
objNew.Name = objNode.nodeName;
Return objNew;
}
////////////////////////////////////////////////////////////////
// XMLData To DOM conversion
Function ProcessXMLDataNode(objXMLData,xmlDoc)
{
var objRoot;
objRoot = CreateDOMNodeFromXMLData(objXMLData,xmlDoc);
If(objRoot) {
If(IsTextNodeEnabled(objRoot) && (objXMLData.TextValue.length > 0))
objRoot.appendChild(xmlDoc.createTextNode(objXMLData.TextValue));
If(objXMLData.HasChildren) {
try {
var objChild;
objChild = objXMLData.GetFirstChild(-1);
While(True) {
If(objChild) {
var newNode;
newNode = ProcessXMLDataNode(objChild,xmlDoc);
If(newNode.nodeType == 2){
// child node is an attribute
objRoot.attributes.setNamedItem(newNode);
}
Else
objRoot.appendChild(newNode);
}
objChild = objXMLData.GetNextChild();
}
}
catch(err) {
}
}
}
Return objRoot;
}
Function CreateDOMNodeFromXMLData(objXMLData,xmlDoc)
{
switch(objXMLData.Kind){
Case 4:Return xmlDoc.createElement(objXMLData.Name);
Case 5:Return xmlDoc.createAttribute(objXMLData.Name);
Case 6:Return xmlDoc.createTextNode(objXMLData.TextValue);
Case 7:Return xmlDoc.createCDATASection(objXMLData.TextValue);
Case 8:Return xmlDoc.createComment(objXMLData.TextValue);
Case 9:Return
xmlDoc.createProcessingInstruction(objXMLData.Name,objXMLData.TextValue);
}
Return xmlDoc.createElement(objXMLData.Name);
}
Function IsTextNodeEnabled(objNode)
{
switch(objNode.nodeType) {
Case 1:
Case 2:
Case 5:
Case 6:
Case 11:Return True;
}
Return False;
}
rows and their contents can be manipulated individually, thereby allowing you to manipulate
each of the repeatable elements individually. Such row operations would be performed by an
external script.
If an external script is to perform row operations then two steps must occur:
The first step checks whether the cursor is currently in a row using a property. Such a
check could be, for example, IsRowInsertEnabled, which returns a value of either
TRUE or FALSE.
If the return value is TRUE then a row method, such as RowAppend, can be called. (
RowAppend has no parameters and returns no value.)
The following is a list of properties and methods available for table operations. Each property
returns a BOOL, and the methods have no parameter.
The only method that does not have a test is the method EditSelectAll, which automatically
selects all elements displayed in the document.
The following is a list of properties and methods that perform editing operations. Each property
returns a BOOL, and the methods have no parameter.
This section also briefly describes some operations that can be performed within Authentic View
. This is to give you an idea of what is possible with the XMLSpy API.
If you can run JScript on you computer - as you most likely will - copy the following code into a
file with extension 'js'. Execute the script by double-clicking it in Windows Explorer, or run it from
the command line.
var spyAuthenticRangeBegin = 2;
{
// calculate current column index
var nColIndex = 0;
while (true)
{
// go left column-by-column
try { objCursor.GotoPrevious(spyAuthenticTableColumn); }
catch (err) { break; }
nColIndex++;
}
The following example is a VB code snippet that shows how to connect to object-level events
from within a VB project.
'
----------------------------------------------------------------------------
' VB code snippet - connecting to object level events
'
----------------------------------------------------------------------------
Dim objSpy As XMLSpyLib.Application
' use VBA keyword WithEvents to automatically connect to object-level event
Dim WithEvents objView As XMLSpyLib.AuthenticView
' this is the event callback routine that will be connected to the
' OnSelectionChanged event of object objView
Private Sub objView_OnSelectionChanged (ByVal i_ipNewRange As
XMLSpyLib.IAuthenticRange)
MsgBox ("new selection: " & i_ipNewRange.Text)
End Sub
' this is the event callback routine that will be connected to the
' OnSelectionChanged event of object objView
Private Sub objView_OnSelectionChanged (ByVal i_ipNewRange As
XMLSpyLib.IAuthenticRange)
MsgBox ("new selection: " & i_ipNewRange.Text)
End Sub
' this is the event callback routine that will be connected to the
' OnMouseEvent event of object objView.
' If you click with the left mouse button while pressing a control key,
' the current selection will be set to the tag below the current
' mouse cursor position
Private Function objView_OnMouseEvent(ByVal i_nXPos As Long, ByVal i_nYPos
As Long, ByVal i_eMouseEvent As XMLSpyLib.SPYMouseEvent, ByVal i_pRange As
XMLSpyLib.IAuthenticRange) As Boolean
If (i_eMouseEvent = (XMLSpyLib.spyLeftButtonDownMask Or
XMLSpyLib.spyCtrlKeyDownMask)) Then
On Error Resume Next
i_pRange.Select
objView_OnMouseEvent = True
Else
objView_OnMouseEvent = False
End If
End Function
objSpy.ShowApplication (True)
If (objSpy.ActiveDocument Is Nothing) Then
Dim objDoc As XMLSpyLib.Document
Rem replace path below With a valid absolute path On your machine
Set objDoc = objSpy.Documents.OpenFile("InputData\orgchart.xml", False)
End If
4.3 Interfaces
Object Hierarchy
Application
SpyProject
SpyProjectItems
SpyProjectItem
Documents
Document
GridView
AuthenticView
AuthenticRange
AuthenticDataTransfer (previously DocEditDataTransfer)
OldAuthenticView (previously DocEditView, now obsolete, superseded by
AuthenticView and AuthenticRange)
AuthenticSelection (previously DocEditSelection, now obsolete,
superseded by AuthenticRange)
AuthenticEvent (previously DocEditEvent, now obsolete)
AuthenticDataTransfer (previously DocEditDataTransfer)
TextView
XMLData
Dialogs
CodeGeneratorDlg
FileSelectionDlg
SchemaDocumentationDlg
GenerateSampleXMLDlg
DTDSchemaGeneratorDlg
FindInFilesDlg
WSDLDocumentationDlg
WSDL20DocumentationDlg
XBRLDocumentationDlg
DatabaseConnection
ExportSettings
TextImportExportSettings
ElementList
ElementListItem
Enumerations
Description
This chapter contains the reference of the XMLSpy 1.5 Type Library.
Most of the given examples are written in VisualBasic. These code snippets assume that there
is a variable defined and set, called objSpy of type Application. There are also some code
samples written in JavaScript.
4.3.1 Application
See also
Methods
GetDatabaseImportElementList
GetDatabaseSettings
GetDatabaseTables
ImportFromDatabase
CreateXMLSchemaFromDBStructure
GetTextImportElementList
GetTextImportExportSettings
ImportFromText
ImportFromWord
ImportFromSchema
GetExportSettings
NewProject
OpenProject
AddMacroMenuItem
ClearMacroMenu
ShowForm
ShowApplication
URLDelete
URLMakeDirectory
Fi
ndInFi
l
es
Quit
Properties
Application
Parent
ActiveDocument
Documents
CurrentProject
Dialogs
WarningNumber
WarningText
Status
MajorVersion
MinorVersion
Edition
IsAPISupported
ServicePackVersion
Description
Application is the root for all other objects. It is the only object you can create by CreateObject
(VisualBasic) or other similar COM related functions.
Example
Events
OnBeforeOpenDocument
See also
Description
This event gets fired whenever a document gets opened via the OpenFile or OpenURL menu
command. It is sent after a document file has been selected but before the document gets
opened. The file selection dialog object is initialized with the name of the selected document file.
You can modify this selection. To continue the opening of the document leave the
Fi
l
eSel
ecti
onDl
g.Di
al
ogActi
on property of io_objDialog at its default value spyDialogO K . To
abort the opening of the document set this property to spyDialogCancel .
Examples
Given below are examples of how this event can be scripted.
OnBeforeOpenProject
See also
Description
This event gets fired after a project file has been selected but before the project gets opened.
The file selection dialog object is initialized with the name of the selected project file. You can
modify this selection. To continue the opening of the project leave the
Fi
l
eSel
ecti
onDl
g.Di
al
ogActi
on property of io_objDialog at its default value spyDialogO K . To
abort the opening of the project set this property to spyDialogCancel .
Examples
Given below are examples of how this event can be scripted.
{
}
OnDocumentOpened
See also
Description
This event gets fired whenever a document opens in XMLSpy. This can happen due to opening
a file with the OpenFile or OpenURL dialog, creating a new file or dropping a file onto XMLSpy.
The new document gets passed as parameter. The operation cannot be canceled.
Examples
Given below are examples of how this event can be scripted.
OnProjectOpened
See also
Description
This event gets fired whenever a project gets opened in XMLSpy. The new project gets passed
as parameter.
Examples
Given below are examples of how this event can be scripted.
ActiveDocument
See also
Description
Reference to the active document. If no document is open, ActiveDocum ent is null (nothing).
Errors
1111 The application object is no longer valid.
1100 Invalid address for the return parameter was specified.
AddMacroMenuItem
See also
Description
Adds a menu item to the Tools menu. This new menu item invokes the macro defined by
strM acro . See also "Calling macros from XMLSpy".
Errors
1111 The application object is no longer valid.
1100 Invalid parameter or invalid address for the return parameter was
specified.
1108 Number of macro items is limited to 16 items.
Application
See also
Description
Access the XMLSpy application object.
Errors
1111 The application object is no longer valid.
1100 Invalid address for the return parameter was specified.
ClearMacroMenu
See also
Method: ClearMacroMenu()
Return Value
None
Description
Removes all menu items from the Tools menu. See also Calling macros from XMLSpy".
Errors
1111 The application object is no longer valid.
CreateXMLSchemaFromDBStructure
See also
Method: CreateXMLSchemaFromDBStructure(pImportSettings as
DatabaseConnection,pTables as ElementList)
Description
CreateXMLSchemaFromDBStructure creates from a database specified in
pImportSettings for the defined tables in pTables new XML Schema document(s)
describing the database tables structure.
The parameter pTables specifies which table structures the XML Schema document should
contain. This parameter can be NULL, specifying that all table structures will be exported.
Errors
1112 Invalid database specified.
1120 Database import failed.
CurrentProject
See also
Description
Reference to the active document. If no project is open, CurrentProj
ect is null (nothing).
Errors
1111 The application object is no longer valid.
1100 Invalid address for the return parameter was specified.
Dialogs
See also
Description
Access the built-in dialogs of XMLSpy.
Errors
1111 The application object is no longer valid.
1100 Invalid address for the return parameter was specified.
Documents
See also
Description
Collection of all open documents. See also Simple document access.
Errors
1111 The application object is no longer valid.
1100 Invalid address for the return parameter was specified.
Edition
See also
Description
Returns the edition of the application. Eg: Enterprise, Professional, Standard
Errors
1111 The application object is no longer valid.
1100 Invalid address for the return parameter was specified.
FindInFiles
See also
Description
Returns a FindInFilesResults object containing information about the files that matched the
specified settings.
Errors
1111 The application object is no longer valid.
1100 Invalid address for the return parameter was specified.
GetDatabaseImportElementList
See also
Method: GetDatabaseImportElementList(pImportSettings as
DatabaseConnection)as ElementList
Description
The function returns a collection of El
em entLi
stItem s where the properties
ElementListItem.Name contain the names of the fields that can be selected for import and
the properties ElementListItem.ElementKind are initialized either to spyXMLDataAttr or
spyXMLDataElement, depending on the value passed in
DatabaseConnection.AsAttributes. This list serves as a filter to what finally gets
imported by a future call to ImportFromDatabase. Use ElementList.RemoveElement to
exclude fields from import.
Properties mandatory to be filled out for the database connection are one of
DatabaseConnection.File, DatabaseConnection.ADOConnection and
DatabaseConnection.ODBCConnection, as well as DatabaseConnection.SQLSelect.
Use the property DatabaseConnection.AsAttributes to initialize
ElementListItem.ElementKind of the resulting element list to either spyXMLDataAttr or
spyXMLDataElement, respectively.
Example
See example at ImportFromDatabase.
Errors
1111 The application object is no longer valid.
1100 Invalid parameter or invalid address for the return parameter was
specified.
1107 Import from database failed.
1112 Invalid database specified.
1114 Select statement is missing.
1119 database element list import failed.
GetDatabaseSettings
See also
Description
GetDatabaseSettings creates a new object of database settings. The object is used to
specify database connection parameters for the methods GetDatabaseTables,
GetDatabaseImportElementList, ImportFromDatabase, ImportFromSchema and
ExportToDatabase.
Example
See example of ImportFromDatabase.
Errors
1111 The application object is no longer valid.
1100 Invalid address for the return parameter was specified.
GetDatabaseTables
See also
Description
GetDatabaseTables reads the table names from the database specified in pImportSettings.
Properties mandatory to be filled out for the database connection are one of
DatabaseConnection.File, DatabaseConnection.ADOConnection and
DatabaseConnection.ODBCConnection. All other properties are ignored.
The function returns a collection of ElementListItems where the properties
ElementListItem.Name contain the names of tables stored in the specified database. The
remaining properties of ElementListItem are unused.
Errors
Example
Dim objImpSettings As DatabaseConnection
Set objImpSettings = objSpy.GetDatabaseSettings
objImpSettings.ADOConnection = TxtADO.Text
GetExportSettings
See also
Description
GetExportSetti
ngs creates a new object of common export settings. This object is used to pass
the parameters to the export functions and defines the behaviour of the export calls. See also
the export functions from Document and the examples at Import and Export.
Errors
1111 The application object is no longer valid.
1100 Invalid address for the return parameter was specified.
GetTextImportElementList
See also
Method: GetTextImportElementList(pImportSettings as
TextImportExportSettings)as ElementList
Description
GetTextIm portElem entLi
st retrieves importing information about the text-file as specified in
pIm portSetti
ngs . The function returns a collection of El
em entLi
stItem s where the properties
ElementListItem.Name contain the names of the fields found in the file. The values of
remaining properties are undefined.
Errors
Example
' ---------------------------------------------------------
' VBA client code fragment - import selected fields from text file
' ---------------------------------------------------------
Dim objImpSettings As TextImportExportSettings
Set objImpSettings = objSpy.GetTextImportExportSettings
objImpSettings.ImportFile = "C:\ImportMe.txt"
objImpSettings.HeaderRow = False
GetTextImportExportSettings
See also
Description
GetTextImportExportSettings creates a new object of common import and export
settings for text files. See also the example for
Application.GetTextImportElementList and Import and Export.
Errors
1111 The application object is no longer valid.
1100 Invalid address for the return parameter was specified.
ImportFromDatabase
See also
Return Value
Creates a new document containing the data imported from the database.
Description
Im portFrom Database imports data from a database as specified in pIm portSetti
ngs and creates
a new document containing the data imported from the database. Properties mandatory to be
The parameter pEl st specifies which fields of the selected data gets written into the
em entLi
newly created document, and which are created as elements and which as attributes. This
parameter can be NULL, specifying that all selected fields will be imported as XML elements.
Errors
1111 The application object is no longer valid.
1100 Invalid parameter or invalid address for the return parameter was
specified.
1107 Import from database failed.
1112 Invalid database specified.
1114 Select statement is missing.
1117 Transformation to XML failed.
1120 Database import failed.
Example
Dim objImpSettings As DatabaseConnection
Set objImpSettings = objSpy.GetDatabaseSettings
objImpSettings.ADOConnection = strADOConnection
objImpSettings.SQLSelect = "SELECT * FROM MyTable"
ImportFromSchema
See also
Return Value
Creates a new document filled with data from the specified database as specified by the
schema definition in pSchemaDoc.
Description
Im portFrom Schem a imports data from a database specified in pIm portSetti
ngs . Properties
mandatory to be filled out are one of DatabaseConnection.File,
DatabaseConnection.ADOConnection or DatabaseConnection.ODBCConnection.
Additionally, you can use DatabaseConnection.AsAttributes,
DatabaseConnection.ExcludeKeys and NumberDateTimeFormat to further
parameterize import. All other properties get ignored.
Im portFrom Schem a does not use and explicit SQL statement to select the data. Instead, it
expects a structure definition of the document to create in form of an XML schema document in
pSchemaDoc. From this definition the database select statement is automatically deduced.
Specify in strTable the table name of the import root that will become the root node in the new
document.
Errors
1111 The application object is no longer valid.
1100 Invalid parameter or invalid address for the return parameter was
specified.
1107 Import from database failed.
1112 Invalid database specified.
1120 Database import failed.
1121 Could not create validator for the specified schema.
1122 Failed parsing schema for database import.
ImportFromText
See also
Description
ImportFromText imports the text file as specified in pImportSettings. The parameter
pElementList can be used as import filter. Either pass the list returned by a previous call to
GetTextImportElementList or nul to import all columns. To avoid import of unnecessary
columns use ElementList.RemoveElement to remove the corresponding field names from
pEl st before calling Im portFrom Text .
em entLi
The method returns the newly created document containing the imported data. This document
is the same as the active document of XMLSpy.
Errors
1111 The application object is no longer valid.
1100 Invalid parameter or invalid address for the return parameter was
specified.
1107 Import from text file failed.
1117 Transformation to XML failed.
Example
' ---------------------------------------------------------
' VBA client code fragment - import from text file
' ---------------------------------------------------------
Dim objImpSettings As TextImportExportSettings
Set objImpSettings = objSpy.GetTextImportExportSettings
objImpSettings.ImportFile = strFileName
objImpSettings.HeaderRow = False
CheckForError
ImportFromWord
See also
Description
Im portFrom W ord imports the MS-Word Document st
rFi
l
e into a new XML document.
Errors
1111 The application object is no longer valid.
1100 Invalid parameter or invalid address for the return parameter was
specified.
Import from document failed.
IsAPISupported
See also
Description
Returns the whether the API is supported in this version or not.
Errors
1111 The application object is no longer valid.
1100 Invalid address for the return parameter was specified.
MajorVersion
See also
Description
Returns the versions major number of the application.
Errors
1111 The application object is no longer valid.
1100 Invalid address for the return parameter was specified.
MinorVersion
See also
Description
Returns the versions minor number of the application.
Errors
1111 The application object is no longer valid.
1100 Invalid address for the return parameter was specified.
NewProject
See also
Description
NewProject creates a new project.
If there is already a project open that has been modified and bDiscardCurrent is false, then
NewProj ect() fails.
Errors
1111 The application object is no longer valid.
1102 A project is already open but bDiscardCurrent is true.
1103 Creation of new project failed.
OpenProject
See also
Parameters
strPath
Path and file name of the project to open. Can be empty if bDi
al
og is true.
bDi
scardCurrent
Discard currently open project and possible lose changes.
bDi
al
og
Show dialogs for user input.
Return Value
None
Description
OpenProject opens an existing project. If there is already a project open that has been modified
and bDiscardCurrent is false, then OpenProject() fails.
Errors
1111 The application object is no longer valid.
1100 Invalid parameter or invalid address for the return parameter was
specified.
1101 Cannot open specified project.
1102 A project is already open but bDiscardCurrent is true.
Parent
See also
Description
Access the XMLSpy application object.
Errors
1111 The application object is no longer valid.
1100 Invalid address for the return parameter was specified.
Quit
See also
Method: Quit()
Return Value
None
Description
This method terminates XMLSpy. All modified documents will be closed without saving the
changes. This is also true for an open project.
Errors
1111 The application object is no longer valid.
ReloadSettings
See also
Method: ReloadSettings
Return Value
Description
The application settings are reloaded from the registry.
Errors
1111 The application object is no longer valid.
RunMacro
See also
Return Value
Description
Calls the specified macro either from the project scripts (if present) or from the global scripts.
Errors
1111 The application object is no longer valid.
ScriptingEnvironment
See also
Description
Reference to any active scripting environment. This property makes it possible to access the
TypeLibrary of the XMLSpyFormEditor.exe application which is used as the current scripting
environment.
Errors
1111 The application object is no longer valid.
1100 Invalid address for the return parameter was specified.
ServicePackVersion
See also
Description
Returns the Service Pack version number of the application. Eg: 1 for 2010 R2 SP1
Errors
1111 The application object is no longer valid.
1100 Invalid address for the return parameter was specified.
ShowApplication
See also
Return Value
None
Description
The method shows (bShow = True) or hides (bShow = Fal
se) XMLSpy.
Errors
1110 The application object is no longer valid.
ShowFindInFiles
See also
Return Value
Returns false if the user pressed the Cancel button, true otherwise.
Description
Displays the FindInFiles dialog preset with the given settings. The user modifications of the
settings are stored in the passed dialog object.
Errors
1111 The application object is no longer valid.
1100 Invalid parameter or invalid address for the return parameter was
specified.
ShowForm
See also
Return Value
Returns zero if the user pressed a Cancel button or the form calls TheView.Cancel() .
Description
Displays the form strForm Nam e .
Forms, event handlers and macros can be created with the Scripting Environment. Select
"Switch to scripting environment" from the Tools menu to invoke the Scripting Environment.
Errors
1111 The application object is no longer valid.
1100 Invalid parameter or invalid address for the return parameter was
specified.
Status
See also
Description
Returns the current status of the running application.
Errors
1111 The application object is no longer valid.
1100 Invalid address for the return parameter was specified.
URLDelete
See also
Return Value
None
Description
The method deletes the file at the URL strURL .
Errors
URLMakeDirectory
See also
Return Value
None
Description
The method creates a new directory at the URL strURL .
Errors
1111 The application object is no longer valid.
1100 Invalid parameter specified.
Visible
See also
Description
Sets or gets the visibility attribute of XMLSpy. This standard automation property makes usage of
ShowAppli
cati
on obsolete.
Errors
1110 The application object is no longer valid.
1100 Invalid address for the return parameter was specified.
WarningNumber
See also
Description
Some methods fill the property W arningNum ber with additional information if an error occurs.
Errors
1111 The application object is no longer valid.
1100 Invalid address for the return parameter was specified.
WarningText
See also
Description
Some methods fill the property W arni
ngText with additional information if an error occurs.
Errors
1111 The application object is no longer valid.
1100 Invalid address for the return parameter was specified.
4.3.2 AuthenticContextMenu
The context menu interface provides the mean for the user to customize the context menus
shown in Authentic. The interface has the methods listed in this section.
CountItems
Method: CountItems()
Return Value
Returns number of menu items.
Errors
2501 Invalid object.
DeleteItem
Method: DeleteItem(position as integer)
Return Value
Deletes an existing menu item.
Errors
2501 Invalid object
2502 Invalid index
GetItemText
Method: GetItemText(position as integer) menu item name as string
Return Value
Gets the menu item's name.
Errors
2501 Invalid object
2502 Invalid index
InsertItem
Method: InsertItem(position as integer, menu item name as string, macro name
as string)
Return Value
Inserts a user-defined menu item. The menu item will start a macro, so a valid macro name must be
submitted.
Errors
2501 Invalid object
2502 Invalid index
2503 No such macro
2504 Internal error
SetItemText
Method: SetItemText(position as integer, menu item name as string)
Return Value
Sets the menu item's name.
Errors
2501 Invalid object
2502 Invalid index
4.3.3 AuthenticDataTransfer
Renamed from DocEditDataTransfer to AuthenticDataTransfer
The DocEditView object is renamed to OldAuthenticView .
DocEdi
tSelecti
on is renamed to Authenti
cSel
ecti
on .
DocEditEvent is renamed to Authenti cEvent .
DocEditDataTransfer is renamed to Authenti
cDataTransfer .
For examples on migrating from DocEdit to Authentic see the description of the
different methods and properties of the different DocEdit objects.
See also
Methods
getData
Properties
dropEffect
ownDrag
type
Description
The events O nDragO ver and O nBeforeDrop provide information about the object being dragged
dropEffect
See also
Description
The property stores the drop effect from the default event handler. You can set the drop effect if
you change this value and return TRUE for the event handler (or set
AuthenticEvent.cancelBubble to T R U Eif you are still using the now obsolete
Authenti
cEvent interface).
Errors
2101 Invalid address for the return parameter was specified.
getData
See also
Description
Retrieve the data associated with the dragged object. Depending on
AuthenticDataTransfer.type, that data is either a string or a COM interface pointer of
type IUnknown .
Errors
2101 Invalid address for the return parameter was specified.
ownDrag
See also
Description
The property is T R U Eif the current dragging source comes from inside Authentic View.
Errors
2101 Invalid address for the return parameter was specified.
type
See also
Description
Holds the type of data you get with the DocEditDataTransfer.getData method.
Errors
2101 Invalid address for the return parameter was specified.
4.3.4 AuthenticEventContext
The EventContext interface gives access to many properties of the context in which a macro is
executed.
EvaluateXPath
Method: EvaluateXPath (string expression) as string
Return Value
The method evaluates the XPath expression in the context of the node within which the event was
triggered and returns a string.
Description
EvaluateXPath() executes an XPath expressions with the given event context. The result is
returned as string, in the case of a sequence it is a space-separated string.
Errors
2201 Invalid object.
2202 No context.
2209 Invalid parameter.
2210 Internal error.
2211 XPath error.
GetEventContextType
Method: GetEventContextType () as EventContextType enumeration
Return Value
Returns the context node type.
Description
GetEventContextType allows the user to determine whether the macro is in an XML node or in
an XPath atomic item context. The enumeration AuthenticEventContextType is defined as
follows:
authenticEventContextXML,
authenticEventContextAtomicItem,
authenticEventContextOther
If the context is a normal XML node, the GetXMLNode() function gives access to it (returns NULL
if not).
Errors
2201 Invalid object.
2202 No context.
2209 Invalid parameter.
GetNormalizedTextValue
Method: GetNormalizedTextValue() value as string
Return Value
Returns the value of the current node as string
Errors
2201 Invalid object.
2202 No context.
2203 Invalid context
2209 Invalid parameter.
GetVariableValue
Method: GetVariableValue(name as string, value as string)
Return Value
Gets the value of the named variable.
Description
GetVariableValue gets the variable's value in the scope of the context.
Errors
2201 Invalid object.
2202 No context.
2204 No such variable in scope
2205 Variable cannot be evaluated
2206 Variable returns sequence
2209 Invalid parameter
GetXMLNode
Method: GetXMLNode() XMLData object
Return Value
Returns the context XML node or NULL
Errors
2201 Invalid object.
2202 No context.
2203 Invalid context
2209 Invalid parameter.
IsAvailable
Method: IsAvailable()
Return Value
Returns true if EventContext is set.
Errors
2201 Invalid object.
SetVariableValue
Method: SetVariableValue(name as string, value as string)
Return Value
Sets the value of the named variable.
Description
SetVariableValue sets the variable's value in the scope of the context.
Errors
2201 Invalid object.
2202 No context.
2204 No such variable in scope
2205 Variable cannot be evaluated
2206 Variable returns sequence
2207 Variable read-only
2208 No modification allowed
4.3.5 AuthenticRange
See also
The first table lists the properties and methods of AuthenticRange that can be used to navigate
through the document and select specific portions.
Properties Methods
Appl i
cati
on Clone M oveBegin
Fi
rstTextPosi
ti
on CollapsToBegin M oveEnd
FirstXM LData CollapsToEnd NextCursorPositi
on
FirstXM LDataOffset ExpandTo Previ
ousCursorPositi
on
LastTextPosi ti
on G oto Sel
ect
LastXM LData G otoNext SelectNext
LastXM LDataOffset GotoPrevious SelectPrevi
ous
Parent IsEm pty SetFrom Range
IsEqual
The following table lists the content modification methods, most of which can be found on the
right/button mouse menu.
Delete DuplicateRow
IsCopyEnabled InsertRow
IsCutEnabled IsFirstRow
IsDeleteEnabl
ed IsInDynam icTable
IsPasteEnabled IsLastRow
Paste M oveR ow D ow n
M oveR ow U p
The following methods provide the functionality of the Authentic entry helper windows for range
objects.
Description
AuthenticRange objects are the 'cursor' selections of the automation interface. You can use
them to point to any cursor position in the Authentic view, or select a portion of the document.
The operations available for AuthenticRange objects then work on this selection in the same
way, as the corresponding operations of the user interface do with the current user interface
selection. The main difference is that you can use an arbitrary number of AuthenticRange
objects at the same time, whereas there is exactly one cursor selection in the user interface.
Another method to select a portion of the document is to use the position properties of the
range object. Two positioning systems are available and can be combined arbitrarily:
Absolute text cursor positions, starting with position 0 at the document beginning, can
be set and retrieved for the beginning and end of a range. For more information see
FirstTextPosition and LastTextPosition. This method requires complex
internal calculations and should be used with care.
The XMLData element and a text position inside this element, can be set and retrieved
for the beginning and end of a range. For more information see FirstXMLData,
FirstXMLDataOffset, LastXMLData, and LastXMLDataOffset. This method is
very efficient but requires knowledge on the underlying document structure. It can be
used to locate XMLData objects and perform operations on them otherwise not
accessible through the user interface.
AppendRow
See also
Description
If the beginning of the range is inside a dynamic table, this method inserts a new row at the end
of the selected table. The selection of the range is modified to point to the beginning of the new
row. The function returns true if the append operation was successful, otherwise false.
Errors
2001 The authentic range object or its related view object is no longer valid.
2005 Invalid address for the return parameter was specified.
Examples
' ---------------------------------------------------------
' XMLSpy scripting environment - VBScript
' Append row at end of current dynamically growable table
' ---------------------------------------------------------
Dim objRange
' we assume that the active document is open in authentic view mode
Set objRange = Application.ActiveDocument.AuthenticView.Selection
Application
See also
Description
Access the XMLSpy application object.
Errors
2001 The authentic range object or its related view object is no longer valid.
2005 Invalid address for the return parameter was specified.
CanPerformAction
See also
Description
CanPerform Action and its related methods enable access to the entry-helper functions of
Authentic. This function allows easy and consistent modification of the document content,
without having to know exactly where the modification will take place. The beginning of the
range object is used to locate the next valid location where the specified action can be
performed. If the location can be found, the method returns True, otherwise it returns False.
HINT: To find out all valid element names for a given action, use CanPerformActionWith.
Errors
2001 The authentic range object or its related view object is no longer valid.
2005 Invalid address for the return parameter was specified.
2007 Invalid action was specified.
Examples
See PerformAction.
CanPerformActionWith
See also
Description
Perform ActionW ith and its related methods, enable access to the entry-helper functions of
Authentic. These function allows easy and consistent modification of the document content
without having to know exactly where the modification will take place.
This method returns an array of those element names that the specified action can be
performed with.
Errors
2001 The authentic range object, or its related view object is no longer valid.
2005 Invalid address for the return parameter was specified.
2007 Invalid action was specified.
Examples
See PerformAction.
Clone
See also
Description
Returns a copy of the range object.
Errors
2001 The authentic range object, or its related view object is no longer valid.
2005 Invalid address for the return parameter was specified.
CollapsToBegin
See also
Description
Sets the end of the range object to its begin. The method returns the modified range object.
Errors
2001 The authentic range object, or its related view object is no longer valid.
2005 Invalid address for the return parameter was specified.
CollapsToEnd
See also
Description
Sets the beginning of the range object to its end. The method returns the modified range
object.
Errors
2001 The authentic range object, or its related view object is no longer valid.
2005 Invalid address for the return parameter was specified.
Copy
See also
Description
Returns False if the range contains no portions of the document that may be copied.
Returns True if text, and in case of fully selected XML elements the elements as well, has been
copied to the copy/paste buffer.
Errors
2001 The authentic range object or its related view object is no longer valid.
2005 Invalid address for the return parameter was specified.
Cut
See also
Description
Returns False if the range contains portions of the document that may not be deleted.
Returns True after text, and in case of fully selected XML elements the elements as well, has
been deleted from the document and saved in the copy/paste buffer.
Errors
2001 The authentic range object, or its related view object is no longer valid.
2005 Invalid address for the return parameter was specified.
Delete
See also
Description
Returns False if the range contains portions of the document that may not be deleted.
Returns True after text, and in case of fully selected XML elements the elements as well, has
been deleted from the document.
Errors
2001 The authentic range object or its related view object is no longer valid.
2005 Invalid address for the return parameter was specified.
DeleteRow
See also
Description
If the beginning of the range is inside a dynamic table, this method deletes the selected row.
The selection of the range gets modified to point to the next element after the deleted row. The
function returns true, if the delete operation was successful, otherwise false.
Errors
2001 The authentic range object, or its related view object is no longer valid.
2005 Invalid address for the return parameter was specified.
Examples
' ---------------------------------------------------------
' XMLSpy scripting environment - VBScript
' Delete selected row from dynamically growing table
' ---------------------------------------------------------
Dim objRange
' we assume that the active document is open in authentic view mode
Set objRange = Application.ActiveDocument.AuthenticView.Selection
DuplicateRow
See also
Description
If the beginning of the range is inside a dynamic table, this method inserts a duplicate of the
current row after the selected one. The selection of the range gets modified to point to the
beginning of the new row. The function returns true if the duplicate operation was successful,
otherwise false.
Errors
2001 The authentic range object, or its related view object is no longer valid.
2005 Invalid address for the return parameter was specified.
Examples
' ---------------------------------------------------------
' XMLSpy scripting environment - VBScript
' duplicate row in current dynamically growable table
' ---------------------------------------------------------
Dim objRange
' we assume that the active document is open in authentic view mode
Set objRange = Application.ActiveDocument.AuthenticView.Selection
EvaluateXPath
Method: EvaluateXPath (string expression) as string
Return Value
The method returns a string
Description
EvaluateXPath() executes an XPath expressions with the context node being the beginning of
the range selection. The result returned as string, in the case of a sequence it is a
space-separated string. If XML context node is irrelevant, the user may provide any node, like
AuthenticView.XMLDataRoot.
Errors
2001 Invalid object
2005 Invalid parameter
2008 Internal error
2202 Missing context node
2211 XPath error
ExpandTo
See also
Description
Selects the whole element of type eKind , that starts at, or contains, the first cursor position of
the range. The method returns the modified range object.
Errors
2001 The authentic range object, or its related view object is no longer valid.
2003 Range expansion would be beyond end of document.
2005 Invalid address for the return parameter was specified.
FirstTextPosition
See also
Description
Set or get the left-most text position index of the range object. This index is always less or equal
to LastTextPosition. Indexing starts with 0 at document beginning, and increments with
every different position that the text cursor can occupy. Incrementing the test position by 1, has
the same effect as the cursor-right key. Decrementing the test position by 1 has the same effect
as the cursor-left key.
If you set Fi
rstTextPosi
ti
on to a value greater than the current LastTextPosition,
LastTextPosition gets set to the new Fi rstTextPosi
ti
on .
HINT: Use text cursor positions with care, since this is a costly operation compared to XMLData
based cursor positioning.
Errors
2001 The authentic range object, or its related view object is not valid.
2005 Invalid address for the return parameter was specified.
2006 A text position outside the document was specified.
Examples
' ---------------------------------------
' XMLSpy scripting environment - VBScript
' ---------------------------------------
Dim objAuthenticView
' we assume that the active document is open in authentic view mode
Set objAuthenticView = Application.ActiveDocument.AuthenticView
nDocStartPosition = objAuthenticView.DocumentBegin.FirstTextPosition
nDocEndPosition = objAuthenticView.DocumentEnd.FirstTextPosition
FirstXMLData
See also
Description
Set or get the first XMLData element in the underlying document that is partially, or completely
selected by the range. The exact beginning of the selection is defined by the
FirstXMLDataOffset attribute.
Whenever you set FirstXM LData to a new data object, FirstXMLDataOffset gets set to the
first cursor position inside this element. Only XMLData objects that have a cursor position may
be used. If you set FirstXM LData / FirstXMLDataOffset selects a position greater then the
current LastXMLData / LastXMLDataOffset, the latter gets moved to the new start position.
HINT: You can use the FirstXMLData and LastXMLData properties, to directly access and
manipulate the underlying XML document in those cases where the methods available with the
AuthenticRange object are not sufficient.
Errors
2001 The authentic range object, or its related view object is not valid.
2005 Invalid address for the return parameter was specified.
2008 Internal error
2009 The XMLData object cannot be accessed.
Examples
' -----------------------------------------------
' XMLSpy scripting environment - VBScript
' show name of currently selected XMLData element
' -----------------------------------------------
Dim objAuthenticView
' we assume that the active document is open in authentic view mode
Set objAuthenticView = Application.ActiveDocument.AuthenticView
Dim objXmlData
Set objXMLData = objAuthenticView.Selection.FirstXMLData
' authentic view adds a 'text' child element to elements
' of the document which have content. So we have to go one
' element up.
Set objXMLData = objXMLData.Parent
MsgBox "Current selection selects element " & objXMLData.Name
FirstXMLDataOffset
See also
Description
Set or get the cursor position offset inside FirstXMLData element for the beginning of the
range. Offset positions are based on the characters returned by the Text property, and start
with 0. When setting a new offset, use -1 to set the offset to the last possible position in the
element. The following cases require specific attention:
The textual form of entries in Combo Boxes, Check Boxes and similar controls can be
different from what you see on screen. Although the data offset is based on this text,
there only two valid offset positions, one at the beginning and one at the end of the
entry. An attempt to set the offset to somewhere in the middle of the entry, will result in
the offset being set to the end.
The textual form of XML Entities might differ in length from their representation on the
screen. The offset is based on this textual form.
Errors
2001 The authentic range object, or its related view object is not valid.
2005 Invalid offset was specified.
Invalid address for the return parameter was specified.
Examples
' ---------------------------------------------
' XMLSpy scripting environment - VBScript
' Select the complete text of an XMLData element
' using XMLData based selection and ExpandTo
' ---------------------------------------------
Dim objAuthenticView
' we assume that the active document is open in authentic view mode
Set objAuthenticView = Application.ActiveDocument.AuthenticView
GetElementAttributeNames
See also
Description
Retrieve the names of all attributes for the enclosing element with the specified name. Use the
element/attribute pairs, to set or get the attribute value with the methods
GetElementAttributeValue and SetElementAttributeValue.
Errors
2001 The authentic range object, or its related view object is no longer valid.
2005 Invalid element name was specified.
Invalid address for the return parameter was specified.
Examples
See SetElementAttributeValue.
GetElementAttributeValue
See also
Description
Retrieve the value of the attribute specified in strAttri
buteNam e , for the element identified with
strElem entNam e . If the attribute is supported but has no value assigned, the empty string is
returned. To find out the names of attributes supported by an element, use
GetElementAttributeNames, or HasElementAttribute.
Errors
2001 The authentic range object, or its related view object is no longer valid.
2005 Invalid element name was specified.
Invalid attribute name was specified.
Invalid address for the return parameter was specified.
Examples
See SetElementAttributeValue.
GetElementHierarchy
See also
Description
Retrieve the names of all XML elements that are parents of the current selection. Inner
elements get listed before enclosing elements. An empty list is returned whenever the current
selection is not inside a single XM LD ata element.
The names of the element hierarchy, together with the range object uniquely identify XM LD ata
elements in the document. The attributes of these elements can be directly accessed by
GetElementAttributeNames, and related methods.
Errors
2001 The authentic range object, or its related view object is no longer valid.
2005 Invalid address for the return parameter was specified.
C# Examples
' --------------------------------------------
' C#
' --------------------------------------------
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
XMLSpyLib.Application app = new XMLSpyLib.Application();
app.ShowApplication(true);
object o = null;
range.GetElementHierarchy(ref o);
GetEntityNames
See also
Description
Retrieve the names of all defined entities. The list of retrieved entities is independent of the
current selection, or location. Use one of these names with the InsertEntity function.
Errors
2001 The authentic range object, or its related view object is no longer valid.
2005 Invalid address for the return parameter was specified.
Examples
See: GetElementHierarchy and InsertEntity.
GetVariableValue
Method: GetVariableValue(name as string, value as string)
Return Value
Gets the value of the named variable.
Errors
2001 Invalid object.
2202 No context.
2204 No such variable in scope
2205 Variable cannot be evaluated
2206 Variable returns sequence
2209 Invalid parameter
Goto
See also
Description
Sets the range to point to the beginning of the nCount element of type eKind . The start position
is defined by the parameter eFrom .
Use positive values for nCount to navigate to the document end. Use negative values to
navigate to the beginning of the document. The method returns the modified range object.
Errors
2001 The authentic range object, or its related view object is no longer valid.
2003 Target lies after end of document.
2004 Target lies before begin of document.
2005 Invalid element kind specified.
Invalid start position specified.
Invalid address for the return parameter was specified.
GotoNext
See also
Description
Sets the range to the beginning of the next element of type eKind . The method returns the
modified range object.
Errors
2001 The authentic range object, or its related view object is no longer valid.
2003 Target lies after end of document.
2005 Invalid element kind specified.
Invalid address for the return parameter was specified.
Examples
' --------------------------------------------
' XMLSpy scripting environment - VBScript
' Scan through the whole document word-by-word
' --------------------------------------------
Dim objAuthenticView
' we assume that the active document is open in authentic view mode
Set objAuthenticView = Application.ActiveDocument.AuthenticView
Dim objRange
Set objRange = objAuthenticView.DocumentBegin
Dim bEndOfDocument
bEndOfDocument = False
GotoNextCursorPosition
See also
Description
Sets the range to the next cursor position after its current end position. Returns the modified
object.
Errors
2001 The authentic range object, or its related view object is no longer valid.
2003 Target lies after end of document.
2005 Invalid address for the return parameter was specified.
GotoPrevious
See also
Description
Sets the range to the beginning of the element of type eKind which is before the beginning of
the current range. The method returns the modified range object.
Errors
2001 The authentic range object, or its related view object is no longer valid.
2004 Target lies before beginning of document.
2005 Invalid element kind specified.
Invalid address for the return parameter was specified.
Examples
' --------------------------------------------
' XMLSpy scripting environment - VBScript
' Scan through the whole document tag-by-tag
' --------------------------------------------
Dim objAuthenticView
' we assume that the active document is open in authentic view mode
Set objAuthenticView = Application.ActiveDocument.AuthenticView
Dim objRange
Set objRange = objAuthenticView.DocumentEnd
Dim bEndOfDocument
bBeginOfDocument = False
GotoPreviousCursorPosition
See also
Description
Set the range to the cursor position immediately before the current position. Returns the
modified object.
Errors
2001 The authentic range object, or its related view object is no longer valid.
2004 Target lies before begin of document.
2005 Invalid address for the return parameter was specified.
HasElementAttribute
See also
Description
Tests if the enclosing element with name strElem entNam e , supports the attribute specified in
strAttri
buteNam e .
Errors
2001 The authentic range object, or its related view object is no longer valid.
2005 Invalid element name was specified.
Invalid address for the return parameter was specified.
InsertEntity
See also
Description
Replace the ranges selection with the specified entity. The specified entity must be one of the
entity names returned by GetEntityNames.
Errors
2001 The authentic range object, or its related view object is no longer valid.
2005 Unknown entry name was specified.
Examples
' ---------------------------------------------------------
' XMLSpy scripting environment - VBScript
' Insert the first entity in the list of available entities
' ---------------------------------------------------------
Dim objRange
' we assume that the active document is open in authentic view mode
Set objRange = Application.ActiveDocument.AuthenticView.Selection
InsertRow
See also
Description
If the beginning of the range is inside a dynamic table, this method inserts a new row before the
current one. The selection of the range, gets modified to point to the beginning of the newly
inserted row. The function returns true if the insert operation was successful, otherwise false.
Errors
2001 The authentic range object, or its related view object is no longer valid.
2005 Invalid address for the return parameter was specified.
Examples
' -------------------------------------------------------------
' XMLSpy scripting environment - VBScript
' Insert row at beginning of current dynamically growing table
' -------------------------------------------------------------
Dim objRange
' we assume that the active document is open in authentic view mode
Set objRange = Application.ActiveDocument.AuthenticView.Selection
IsCopyEnabled
See also
Description
Checks if the copy operation is supported for this range.
Errors
2001 The authentic range object, or its related view object is no longer valid.
2005 Invalid address for the return parameter was specified.
IsCutEnabled
See also
Description
Checks if the cut operation is supported for this range.
Errors
2001 The authentic range object, or its related view object is no longer valid.
2005 Invalid address for the return parameter was specified.
IsDeleteEnabled
See also
Description
Checks if the delete operation is supported for this range.
Errors
2001 The authentic range object, or its related view object is no longer valid.
2005 Invalid address for the return parameter was specified.
IsEmpty
See also
Description
Tests if the first and last position of the range are equal.
Errors
2001 The authentic range object, or its related view object is no longer valid.
2005 Invalid address for the return parameter was specified.
IsEqual
See also
Description
Tests if the start and end of both ranges are the same.
Errors
2001 One of the two range objects being compared, is invalid.
2005 Invalid address for a return parameter was specified.
IsFirstRow
See also
Description
Test if the range is in the first row of a table. Which table is taken into consideration depends on
the extend of the range. If the selection exceeds a single row of a table, the check is if this table
is the first element in an embedding table. See the entry helpers of the user manual for more
information.
Errors
2001 The authentic range object, or its related view object is no longer valid.
2005 Invalid address for the return parameter was specified.
IsInDynamicTable
See also
Description
Test if the whole range is inside a table that supports the different row operations like 'insert',
'append', duplicate, etc.
Errors
2001 The authentic range object, or its related view object is no longer valid.
2005 Invalid address for the return parameter was specified.
IsLastRow
See also
Description
Test if the range is in the last row of a table. Which table is taken into consideration depends on
the extend of the range. If the selection exceeds a single row of a table, the check is if this table
is the last element in an embedding table. See the entry helpers of the user manual for more
information.
Errors
2001 The authentic range object, or its related view object is no longer valid.
2005 Invalid address for the return parameter was specified.
IsPasteEnabled
See also
Description
Checks if the paste operation is supported for this range.
Errors
2001 The authentic range object, or its related view object is no longer valid.
2005 Invalid address for the return parameter was specified.
IsSelected
Property: IsSelected as Boolean
Description
Returns true() if selection is present. The selection range still can be empty: that happens when
e.g. only the cursor is set.
IsTextStateApplied
See also
Description
Checks if all the selected text is embedded into an XML Element with name i_strElem entNam e .
Common examples for the parameter i_strElem entNam e are "strong", "bold" or "italic".
Errors
2001 The authentic range object, or its related view object is no longer valid.
2005 Invalid address for the return parameter was specified.
LastTextPosition
See also
Description
Set or get the rightmost text position index of the range object. This index is always greater or
equal to FirstTextPosition. Indexing starts with 0 at the document beginning, and
increments with every different position that the text cursor can occupy. Incrementing the test
position by 1, has the same effect as the cursor-right key. Decreasing the test position by 1 has
the same effect as the cursor-left key.
HINT: Use text cursor positions with care, since this is a costly operation compared to XMLData
based cursor positioning.
Errors
2001 The authentic range object, or its related view object is not valid.
2005 Invalid address for the return parameter was specified.
2006 A text position outside the document was specified.
Examples
' ---------------------------------------
' XMLSpy scripting environment - VBScript
' ---------------------------------------
Dim objAuthenticView
' we assume that the active document is open in authentic view mode
Set objAuthenticView = Application.ActiveDocument.AuthenticView
nDocStartPosition = objAuthenticView.DocumentBegin.FirstTextPosition
nDocEndPosition = objAuthenticView.DocumentEnd.FirstTextPosition
If objRange.isEqual(objAuthenticView.WholeDocument) Then
MsgBox "Test using direct text cursor positioning was ok"
Else
MsgBox "Oops!"
End If
LastXMLData
See also
Description
Set or get the last XM LD ata element in the underlying document that is partially or completely
selected by the range. The exact end of the selection is defined by the LastXMLDataOffset
attribute.
Whenever you set LastXM LData to a new data object, LastXMLDataOffset gets set to the
last cursor position inside this element. Only XM LD ata objects that have a cursor position may
be used. If you set LastXM LData / LastXMLDataOffset, select a position less then the
current FirstXMLData / FirstXMLDataOffset, the latter gets moved to the new end
position.
HINT: You can use the FirstXMLData and LastXMLData properties to directly access and
manipulate the underlying XML document in those cases, where the methods available with the
AuthenticRange object are not sufficient.
Errors
2001 The authentic range object, or its related view object is not valid.
2005 Invalid address for the return parameter was specified.
2008 Internal error
2009 The XM LD ata object cannot be accessed.
LastXMLDataOffset
See also
Description
Set or get the cursor position inside LastXMLData element for the end of the range.
Offset positions are based on the characters returned by the Text property and start with 0.
When setting a new offset, use -1 to set the offset to the last possible position in the element.
The following cases require specific attention:
The textual form of entries in Combo Boxes, Check Boxes and similar controls can be
different from what you see on the screen. Although, the data offset is based on this
text, there only two valid offset positions, one at the beginning and one at the end of the
entry. An attempt to set the offset to somewhere in the middle of the entry, will result in
the offset being set to the end.
The textual form of XML Entities might differ in length from their representation on the
screen. The offset is based on this textual form.
Errors
2001 The authentic range object, or its related view object is not valid.
2005 Invalid offset was specified.
Invalid address for the return parameter was specified.
Examples
' ---------------------------------------------
' XMLSpy scripting environment - VBScript
' Select the complete text of an XMLData element
' using XMLData based selection and ExpandTo
' ---------------------------------------------
Dim objAuthenticView
' we assume that the active document is open in authentic view mode
Set objAuthenticView = Application.ActiveDocument.AuthenticView
MoveBegin
See also
Description
Move the beginning of the range to the beginning of the nCount element of type eKind . Counting
starts at the current beginning of the range object.
Use positive numbers for nCount to move towards the document end, use negative numbers to
move towards document beginning. The end of the range stays unmoved, unless the new
beginning would be larger than it. In this case, the end is moved to the new beginning. The
method returns the modified range object.
Errors
2001 The authentic range object, or its related view object is no longer valid.
2003 Target lies after end of document.
2004 Target lies before beginning of document.
2005 Invalid element kind specified.
Invalid address for the return parameter was specified.
MoveEnd
See also
Description
Move the end of the range to the begin of the nCount element of type eKind . Counting starts at
the current end of the range object.
Use positive numbers for nCount to move towards the document end, use negative numbers to
move towards document beginning. The beginning of the range stays unmoved, unless the new
end would be less than it. In this case, the beginning gets moved to the new end. The method
returns the modified range object.
Errors
2001 The authentic range object, or its related view object is no longer valid.
2003 Target lies after end of document.
2004 Target lies before begin of document.
2005 Invalid element kind specified.
Invalid address for the return parameter was specified.
MoveRowDown
See also
Description
If the beginning of the range is inside a dynamic table and selects a row which is not the last
row in this table, this method swaps this row with the row immediately below. The selection of
the range moves with the row, but does not otherwise change. The function returns true if the
move operation was successful, otherwise false.
Errors
2001 The authentic range object or its related view object is no longer valid.
2005 Invalid address for the return parameter was specified.
MoveRowUp
See also
Description
If the beginning of the range is inside a dynamic table and selects a row which is not the first
row in this table, this method swaps this row with the row above. The selection of the range
moves with the row, but does not change otherwise. The function returns true if the move
operation was successful, otherwise false.
Errors
2001 The authentic range object, or its related view object is no longer valid.
2005 Invalid address for the return parameter was specified.
Examples
See JScript - Bubble Sort Dynamic Tables.
Parent
See also
Description
Access the view that owns this range object.
Errors
2001 The authentic range object, or its related view object is no longer valid.
2005 Invalid address for the return parameter was specified.
Paste
See also
Description
Returns False if the copy/paste buffer is empty, or its content cannot replace the current
selection.
Otherwise, deletes the current selection, inserts the content of the copy/paste buffer, and
returns True.
Errors
2001 The authentic range object, or its related view object is no longer valid.
2005 Invalid address for the return parameter was specified.
PerformAction
See also
Description
Perform Acti
on and its related methods, give access to the entry-helper functions of Authentic.
This function allows easy and consistent modification of the document content without a need to
know exactly where the modification will take place. The beginning of the range object is used
to locate the next valid location where the specified action can be performed. If no such location
can be found, the method returns False. Otherwise, the document gets modified and the range
points to the beginning of the modification.
HINT: To find out element names that can be passed as the second parameter use
CanPerformActionWith.
Errors
2001 The authentic range object, or its related view object is no longer valid.
2005 Invalid address for the return parameter was specified.
2007 Invalid action was specified.
Examples
' --------------------------------------------
' XMLSpy scripting environment - VBScript
' Insert the innermost element
' --------------------------------------------
Dim objRange
' we assume that the active document is open in authentic view mode
Set objRange = Application.ActiveDocument.AuthenticView.Selection
' we determine the elements that can be inserted at the current position
Dim arrElements()
objRange.CanPerformActionWith spyAuthenticInsertBefore, arrElements
Select
See also
Method: Select()
Description
Makes this range the current user interface selection. You can achieve the same result using: '
objRange.Parent.Selection = objRange'
Errors
2001 The authentic range object or its related view object is no longer valid.
Examples
' ---------------------------------------
' XMLSpy scripting environment - VBScript
' ---------------------------------------
Dim objAuthenticView
' we assume that the active document is open in authentic view mode
Set objAuthenticView = Application.ActiveDocument.AuthenticView
SelectNext
See also
Description
Selects the element of type eKind after the current end of the range. The method returns the
modified range object.
Errors
2001 The authentic range object, or its related view object is no longer valid.
Examples
' --------------------------------------------
' XMLSpy scripting environment - VBScript
' Scan through the whole document word-by-word
' --------------------------------------------
Dim objAuthenticView
' we assume that the active document is open in authentic view mode
Set objAuthenticView = Application.ActiveDocument.AuthenticView
Dim objRange
Set objRange = objAuthenticView.DocumentBegin
Dim bEndOfDocument
bEndOfDocument = False
SelectPrevious
See also
Description
Selects the element of type eKind before the current beginning of the range. The method
returns the modified range object.
Errors
2001 The authentic range object, or its related view object is no longer valid.
2004 Target lies before begin of document.
2005 Invalid element kind specified.
Invalid address for the return parameter was specified.
Examples
' --------------------------------------------
' XMLSpy scripting environment - VBScript
' Scan through the whole document tag-by-tag
' --------------------------------------------
Dim objAuthenticView
' we assume that the active document is open in authentic view mode
Set objAuthenticView = Application.ActiveDocument.AuthenticView
Dim objRange
Set objRange = objAuthenticView.DocumentEnd
Dim bEndOfDocument
bBeginOfDocument = False
SetElementAttributeValue
See also
Description
Retrieve the value of the attribute specified in strAttri
buteNam e for the element identified with
strElem entNam e . If the attribute is supported but has no value assigned, the empty string is
returned. To find out the names of attributes supported by an element, use
GetElementAttributeNames, or HasElementAttribute.
Errors
2001 The authentic range object or its related view object is no longer valid.
2005 Invalid element name was specified.
Invalid attribute name was specified.
Invalid attribute value was specified.
Examples
' --------------------------------------------
' XMLSpy scripting environment - VBScript
' Get and set element attributes
' --------------------------------------------
Dim objRange
' we assume that the active document is open in authentic view mode
Set objRange = Application.ActiveDocument.AuthenticView.Selection
' first we find out all the elements below the beginning of the range
Dim arrElements
objRange.GetElementHierarchy arrElements
If IsArray(arrElements) Then
If UBound(arrElements) >= 0 Then
' we use the top level element and find out its valid attributes
Dim arrAttrs()
objRange.GetElementAttributeNames arrElements(0), arrAttrs
strAttrVal = objRange.GetElementAttributeValue
(arrElements(0), arrAttrs(0))
msgbox "new value of " & arrElements(0) & "//" &
arrAttrs(0) & " is: " & strAttrVal
End If
End If
End If
SetFromRange
See also
Description
Sets the range object to the same beginning and end positions as objSrcRange .
Errors
2001 One of the two range objects, is invalid.
2005 Null object was specified as source object.
SetVariableValue
Method: SetVariableValue(name as string, value as string)
Return Value
Sets the value of the named variable.
Errors
2201 Invalid object.
2202 No context.
2204 No such variable in scope
2205 Variable cannot be evaluated
2206 Variable returns sequence
2207 Variable read-only
2208 No modification allowed
Text
See also
Description
Set or get the textual content selected by the range object.
The number of characters retrieved are not necessarily identical, as there are text cursor
positions between the beginning and end of the selected range. Most document elements
support an end cursor position different to the beginning cursor position of the following
element. Drop-down lists maintain only one cursor position, but can select strings of any length.
In the case of radio buttons and check boxes, the text property value holds the string of the
corresponding XML element.
If the range selects more then one element, the text is the concatenation of the single texts.
XML entities are expanded so that '&' is expected as '&'.
Setting the text to the empty string, does not delete any XML elements. Use Cut, Delete or
PerformAction instead.
Errors
2001 The authentic range object or its related view object is no longer valid.
2005 Invalid address for a return parameter was specified.
4.3.6 AuthenticView
See also
Description
AuthenticView and its child objects AuthenticRange and AuthenticDataTransfer provide
you with an interface for Authentic View, which allow easy and consistent modification of
document contents. These interfaces replace the following interfaces which are marked now as
obsolete:
OldAuthenticView (old name was DocEditView)
AuthenticSelection (old name was DocEditSelection, superseded by
AuthenticRange)
AuthenticEvent (old name was DocEditEvent)Interfaces
AuthenticView gives you easy access to specific features such as printing, the multi-level
undo buffer, and the current cursor selection, or position.
Examples
' ---------------------------------------
' XMLSpy scripting environment - VBScript
' secure access to authentic view object
' ---------------------------------------
Dim objDocument
Set objDocument = Application.ActiveDocument
If (Not objDocument Is Nothing) Then
' we have an active document, now check for view mode
If (objDocument.CurrentViewMode <> spyViewAuthentic) Then
If (Not objDocument.SwitchViewMode (spyViewAuthentic)) Then
End If
End If
Else
MsgBox "No document is open"
End If
Events
OnBeforeCopy
See also
Description
This event gets triggered before a copy operation gets performed on the document. Return True
(or nothing) to allow copy operation. Return False to disable copying.
OnBeforeCut
See also
Description
This event gets triggered before a cut operation gets performed on the document. Return True
(or nothing) to allow cut operation. Return False to disable operation.
OnBeforeDelete
See also
Description
This event gets triggered before a delete operation gets performed on the document. Return
True (or nothing) to allow delete operation. Return False to disable operation.
OnBeforeDrop
See also
Description
This event gets triggered whenever a previously dragged object gets dropped inside the
The first two parameters specify the mouse position at the time when the event occurred. The
parameter objRange passes a range object that selects the XML element below the mouse
position. The value of this parameter might be NULL. Be sure to check before you access the
range object. The parameter objData allows to access information about the object being
dragged.
Return False to cancle the drop operation. Return True (or nothing) to continue normal
operation.
Examples
'
----------------------------------------------------------------------------
' VB code snippet - connecting to object level events
'
----------------------------------------------------------------------------
' access XMLSpy (without checking for any errors)
Dim objSpy As XMLSpyLib.Application
Set objSpy = GetObject("", "XMLSpy.Application")
OnBeforePaste
See also
Description
This event gets triggered before a paste operation gets performed on the document. The
parameter strType is one of "TEXT", "UNICODETEXT" or "IUNKNOWN". In the first two
cases objData contains a string representation of the object that will be pasted. In the later
case, objData contains a pointer to an IUnknown COM interface.
Return True (or nothing) to allow paste operation. Return False to disable operation.
OnBeforeSave
Event: OnBeforeSave (SaveAs flag) as Boolean
Description: OnBeforeSave gives the opportunity to e.g. warn the user about overwriting the
existing XML document, or to make the document read-only when specific circumstances are
not met. The event will be fired before the file dialog is shown. (Please note, that the event fires
when saving the XML document, and not when saving the SPS design in StyleVision.)
OnDragOver
See also
Description
This event gets triggered whenever an object from within our outside of Authentic View gets
dragged with the mouse over the application window. All event related information gets passed
as parameters.
The first three parameters specify the mouse position, the mouse button status and the status
of the virtual keys at the time when the event occurred. The parameter objRange passes a
range object that selects the XML element below the mouse position. The value of this
parameter might be NULL. Be sure to check before you access the range object. The
parameter objData allows to access information about the object being dragged.
Return False to cancel the drag operation. Return True (or nothing) to continue normal
operation.
Examples
'
----------------------------------------------------------------------------
' VB code snippet - connecting to object level events
'
----------------------------------------------------------------------------
' access XMLSpy (without checking for any errors)
Dim objSpy As XMLSpyLib.Application
Set objSpy = GetObject("", "XMLSpy.Application")
Return True;
End Function
OnKeyboardEvent
See also
Description
This event gets triggered for WM_KEYDOWN, WM_KEYUP and WM_CHAR Windows
messages.
The actual message type is available in the eKeyEvent parameter. The status of virtual keys is
combined in the parameter nVirtualKeyStatus. Use the bit-masks defined in the enumeration
datatype SPYVirtualKeyMask, to test for the different keys or their combinations.
REMARK: The following events from the scripting environment and IDE Plugin of XMLSpy are
still supported but become obsolete with this event:
On_AuthenticKeyUp() IXMLSpyPlugIn.OnEvent (13, ...) //nEventId=
13
On_AuthenticKeyDown() IXMLSpyPlugIn.OnEvent (12, ...) //nEventId=
12
On_AuthenticKeyPressed() IXMLSpyPlugIn.OnEvent (14, ...) //nEventId=
14
Examples
'
----------------------------------------------------------------------------
' VB code snippet - connecting to object level events
'
----------------------------------------------------------------------------
' access XMLSpy (without checking for any errors)
Dim objSpy As XMLSpyLib.Application
Set objSpy = GetObject("", "XMLSpy.Application")
OnLoad
Event: OnLoad ()
Description: OnLoad can be used e.g. to restrict some AuthenticView functionality, as shown in
the example below:
function On_AuthenticLoad( )
{
// We are disabling all entry helpers in order to prevent user from
manipulating XML tree
AuthenticView.DisableElementEntryHelper();
AuthenticView.DisableAttributeEntryHelper();
// We are also disabling the markup buttons for the same purpose
AuthenticView.SetToolbarButtonState( 'AuthenticMarkupSmall',
authenticToolbarButtonDisabled );
AuthenticView.SetToolbarButtonState( 'AuthenticMarkupLarge',
authenticToolbarButtonDisabled );
AuthenticView.SetToolbarButtonState( 'AuthenticMarkupMixed',
authenticToolbarButtonDisabled );
}
In the example the status of the Markup Small, Markup Large, Markup Mixed toolbar buttons
are manipulated with the help of button identifiers. See complete list.
OnMouseEvent
See also
Description
This event gets triggered for every mouse movement and mouse button Windows message.
The actual message type and the mouse buttons status, is available in the eMouseEvent
parameter. Use the bit-masks defined in the enumeration datatype SPYMouseEvent to test for
the different messages, button status, and their combinations.
The parameter objRange identifies the part of the document found at the current mouse cursor
position. The range objects always selects a complete tag of the document. (This might change
in future versions, when a more precise positioning mechanism becomes available). If no
selectable part of the document is found at the current position, the range object is null.
REMARK: The following events from the scripting environment and IDE Plugin of XMLSpy are
still supported but become obsolete with this event:
On_AuthenticMouseMove() IXMLSpyPlugIn.OnEvent (15, ...)
//nEventId=15
On_AuthenticButtonUp() IXMLSpyPlugIn.OnEvent (16, ...) /
nEventId = 16
On_AuthenticButtonDown() IXMLSpyPlugIn.OnEvent (17, ...)
//nEventId=17
On_AuthenticButtonDoubleClick() IXMLSpyPlugIn.OnEvent (24, ...) /
nEventId = 24
Examples
'
----------------------------------------------------------------------------
' VB code snippet - connecting to object level events
'
----------------------------------------------------------------------------
' access XMLSpy (without checking for any errors)
Dim objSpy As XMLSpyLib.Application
Set objSpy = GetObject("", "XMLSpy.Application")
OnSelectionChanged
See also
Description
This event gets triggered whenever the selection in the user interface changes.
Examples
'
----------------------------------------------------------------------------
' VB code snippet - connecting to object level events
'
----------------------------------------------------------------------------
' access XMLSpy (without checking for any errors)
Dim objSpy As XMLSpyLib.Application
Set objSpy = GetObject("", "XMLSpy.Application")
OnToolbarButtonClicked
Event: OnToolbarButtonClicked (Button identifier)
Description: OnToolbarButtonClicked is fired when a toolbar button was clicked by user. The
parameter button identifier helps to determine which button was clicked. The list of predefined
button identifiers is below:
AuthenticPrint
AuthenticPrintPreview
AuthenticUndo
AuthenticRedo
AuthenticCut
AuthenticCopy
AuthenticPaste
AuthenticClear
AuthenticMarkupHide
AuthenticMarkupLarge
AuthenticMarkupMixed
AuthenticMarkupSmall
AuthenticValidate
AuthenticChangeWorkingDBXMLCell
AuthenticSave
AuthenticSaveAs
AuthenticReload
AuthenticTableInsertRow
AuthenticTableAppendRow
AuthenticTableDeleteRow
AuthenticTableInsertCol
AuthenticTableAppendCol
AuthenticTableDeleteCol
AuthenticTableJoinCellRight
AuthenticTableJoinCellLeft
AuthenticTableJoinCellAbove
AuthenticTableJoinCellBelow
AuthenticTableSplitCellHorizontally
AuthenticTableSplitCellVertically
AuthenticTableAlignCellContentTop
AuthenticTableCenterCellVertically
AuthenticTableAlignCellContentBottom
AuthenticTableAlignCellContentLeft
AuthenticTableCenterCellContent
AuthenticTableAlignCellContentRight
AuthenticTableJustifyCellContent
AuthenticTableInsertTable
AuthenticTableDeleteTable
AuthenticTableProperties
AuthenticAppendRow
AuthenticInsertRow
AuthenticDuplicateRow
AuthenticMoveRowUp
AuthenticMoveRowDown
AuthenticDeleteRow
AuthenticDefineEntities
For custom buttons the user might add his own identifiers. Please, note that the user must take
care, as the identifiers are not checked for uniqueness. The same identifiers can be used to
identify buttons in the Set/GetToolbarState() COM API calls. By adding code for different
buttons, the user is in the position to completely redefine the AuthenticView toolbar behavior,
adding own methods for table manipulation, etc.
OnToolbarButtonExecuted
Event: OnToolbarButtonExecuted (Button identifier)
Description: OnToolbarButtonClicked is fired when a toolbar button was clicked by user. The
parameter button identifier helps to determine which button was clicked. See the list of
predefined button identifiers.
OnToolbarButtonExecuted is fired after the toolbar action was executed. It is useful e.g. to add
update code, as shown in the example below:
OnUserAddedXMLNode
Event: OnUserAddedXMLNode (XML node)
Description: OnUserAddedXMLNode will be fired when the user adds an XML node as a primary
action. This happens in the situations, where the user clicks on
auto-add hyperlinks (see example OnUserAddedXMLNode.sps)
the Insert…, Insert After…, Insert Before… context menu items
Append row, Insert row toolbar buttons
Insert After…, Insert Before… actions in element entry helper (outside StyleVision)
The event doesn’t get fired on Duplicate row, or when the node was added externally (e.g. via
COM API), or on Apply (e.g. Text State Icons), or when in XML table operations or in DB
operations.
The event parameter is the XML node object, which was added giving the user an opportunity to
manipulate the XML node added. An elaborate example for an event handler can be found in
the OnUserAddedXMLNode.sps file.
Application
See also
Description
Access the XMLSpy application object.
Errors
2000 The authentic view object is no longer valid.
2005 Invalid address for the return parameter was specified.
AsXMLString
See also
Description
Returns or sets the document content as an XML string. Setting the content to a new value
does not change the schema file or sps file in use. If the new XMLString does not match the
actual schema file error 2011 gets returned.
Errors
2000 The authentic view object is no longer valid.
2011 AsXMLString was set to a value which is no valid XML for the current
schema file.
ContextMenu
Property: ContextMenu as ContextMenu
Description
The property ContextMenu gives access to customize the context menu. The best place to do it
is in the event handler OnContextMenuActivated.
Errors
2000 Invalid object.
2005 Invalid parameter.
CreateXMLNode
Method: CreateXMLNode (nKind as SPYXMLDataKind) as XMLData
Return Value
Description
To create a new XMLData object use the CreateXMLNode() method. See also Using XMLData.
Errors
2000 Invalid object.
2012 Cannot create XML node.
DisableAttributeEntryHelper
Method: DisableAttributeEntryHelper()
Description
DisableAttributeEntryHelper() disables the attribute entry helper in XMLSpy, Authentic
Desktop and Authentic Browser plug-in.
Errors
2000 Invalid object.
DisableElementEntryHelper
Method: DisableElementEntryHelper()
Description
DisableElementEntryHelper() disables the element entry helper in XMLSpy, Authentic
Desktop and Authentic Browser plug-in.
Errors
2000 Invalid object.
DisableEntityEntryHelper
Method: DisableEntityEntryHelper()
Description
DisableEntityEntryHelper() disables the entity entry helper in XMLSpy, Authentic
Desktop and Authentic Browser plug-in.
Errors
2000 Invalid object.
DocumentBegin
See also
Description
Retrieve a range object that points to the beginning of the document.
Errors
2000 The authentic view object is no longer valid.
2005 Invalid address for the return parameter was specified.
DocumentEnd
See also
Description
Retrieve a range object that points to the end of the document.
Errors
2000 The authentic view object is no longer valid.
2005 Invalid address for the return parameter was specified.
DoNotPerformStandardAction
Method: DoNotPerformStandardAction ()
Description
DoNotPerformStandardAction() serves as cancel bubble for macros, and stops further
execution after macro has finished.
Errors
2000 Invalid object.
EvaluateXPath
Method: EvaluateXPath (XMLData, string expression) as string
Return Value
The method returns a string
Description
EvaluateXPath() executes an XPath expressions with the given XML context node. The result
returned as string, in the case of a sequence it is a space-separated string.
Errors
2000 Invalid object.
2005 Invalid parameter.
2008 Internal error.
2013 XPath error.
Event
See also
Description
This property gives access to parameters of the last event in the same way as
OldAuthenti
cVi
ew.event does. Since all events for the scripting environment and external clients
are now available with parameters this Event property should only be used from within
IDE-Plugins.
Errors
2000 The authentic view object is no longer valid.
2005 Invalid address for the return parameter was specified.
EventContext
Property: EventContext as EventContext
Description
EventContext property gives access to the running macros context. See the EventContext
interface description for more below details.
Errors
2000 Invalid object.
GetToolbarButtonState
Method: GetToolbarButtonState (ButtonIdentifier as string) as
AuthenticToolbarButtonState
Return Value
The method returns AuthenticToolbarButtonState
Description
Get/SetToolbarButtonState queries the status of a toolbar button, and lets the user disable
or enable the button, identified via its button identifier (see list above). One usage is to disable
toolbar buttons permanently. Another usage is to put SetToolbarButtonState in the
OnSelectionChanged event handler, as toolbar buttons are updated regularly when the
selection changes in the document.
The default state means that the enable/disable of the button is governed by AuthenticView.
When the user sets the button state to enable or disable, the button remains in that state as
long as the user does not change it.
Errors
2000 Invalid object.
2005 Invalid parameter.
2008 Internal error.
2014 Invalid button identifier.
Goto
See also
Description
Retrieve a range object that points to the beginning of the nCount element of type eKind. The
start position is defined by the parameter eFrom. Use positive values for nCount to navigate to
the document end. Use negative values to navigate towards the beginning of the document.
Errors
2000 The authentic view object is no longer valid.
2003 Target lies after end of document.
Examples
' ---------------------------------------
' XMLSpy scripting environment - VBScript
' ---------------------------------------
Dim objAuthenticView
' we assume that the active document is open in authentic view mode
Set objAuthenticView = Application.ActiveDocument.AuthenticView
IsRedoEnabled
See also
Description
True if redo steps are available and Redo is possible.
Errors
2000 The authentic view object is no longer valid.
2005 Invalid address for the return parameter was specified.
IsUndoEnabled
See also
Description
True if undo steps are available and Undo is possible.
Errors
2000 The authentic view object is no longer valid.
2005 Invalid address for the return parameter was specified.
MarkupVisibility
See also
Description
Set or get current visibility of markup.
Errors
2000 The authentic view object is no longer valid.
2005 Invalid enumeration value was specified.
Invalid address for the return parameter was specified.
Parent
See also
Description
Access the document shown in this view.
Errors
2000 The authentic view object is no longer valid.
2005 Invalid address for the return parameter was specified.
Print
See also
Description
Print the document shown in this view. If bWithPreview is set to True, the print preview dialog
pops up. If bPromptUser is set to True, the print dialog pops up. If both parameters are set to
False, the document gets printed without further user interaction.
Errors
2000 The authentic view object is no longer valid.
Redo
See also
Description
Redo the modification undone by the last undo command.
Errors
2000 The authentic view object is no longer valid.
2005 Invalid address for the return parameter was specified.
Selection
See also
Description
Set or get current text selection in user interface.
Errors
2000 The authentic view object is no longer valid.
2002 No cursor selection is active.
2005 Invalid address for the return parameter was specified.
Examples
' ---------------------------------------
' XMLSpy scripting environment - VBScript
' ---------------------------------------
Dim objAuthenticView
' we assume that the active document is open in authentic view mode
Set objAuthenticView = Application.ActiveDocument.AuthenticView
SetToolbarButtonState
Method: SetToolbarButtonState (ButtonIdentifier as string,
AuthenticToolbarButtonState state)
Description
Get/SetToolbarButtonState queries the status of a toolbar button, and lets the user disable
or enable the button, identified via its button identifier (see list above). One usage is to disable
toolbar buttons permanently. Another usage is to put SetToolbarButtonState in the
OnSelectionChanged event handler, as toolbar buttons are updated regularly when the
selection changes in the document.
The default state means that the enable/disable of the button is governed by AuthenticView.
When the user sets the button state to enable or disable, the button remains in that state as
long as the user does not change it.
Errors
2000 Invalid object.
2008 Internal error.
2014 Invalid button identifier.
Undo
See also
Description
Undo the last modification of the document from within this view.
Errors
2000 The authentic view object is no longer valid.
2005 Invalid address for the return parameter was specified.
UpdateXMLInstanceEntities
See also
Method: UpdateXMLInstanceEntities()
Description
Updates the internal representation of the declared entities, and refills the entry helper. In
addition, the validator is reloaded, allowing the XML file to validate correctly. Please note that
this may also cause schema files to be reloaded.
Errors
The method never returns an error.
Example
// -----------------------------------------
// XMLSpy scripting environment - JavaScript
// -----------------------------------------
if(Application.ActiveDocument &&
(Application.ActiveDocument.CurrentViewMode == 4))
{
var objDocType;
objDocType =
Application.ActiveDocument.DocEditView.XMLRoot.GetFirstChild(10);
if(objDocType)
{
var objEntity = Application.ActiveDocument.CreateChild(14);
objEntity.Name = "child";
objEntity.TextValue = "SYSTEM \"child.xml\"";
objDocType.AppendChild(objEntity);
Application.ActiveDocument.AuthenticView.UpdateXMLInstanceEntities();
}
}
WholeDocument
See also
Description
Retrieve a range object that selects the whole document.
Errors
2000 The authentic view object is no longer valid.
2005 Invalid address for the return parameter was specified.
XMLDataRoot
See also
Description
Returns or sets the top-level XMLData element of the current document. This element typically
describes the document structure and would be of kind spyXMLDataXMLDocStruct,
spyXMLDataXMLEntityDocStruct or spyXMLDataDTDDocStruct..
Errors
2000 The authentic view object is no longer valid.
2005 Invalid address for the return parameter was specified.
4.3.7 CodeGeneratorDlg
See also
Only available/enabled in the Enterprise edition. An error is returned, if accessed by any other
version.
Presentation of result
OutputResul
tDi
alogActi
on
Description
Use this object to configure the generation of program code for schema files. The method
G enerateProgram Code expects a CodeGeneratorDlg as parameter to configure code
generation as well as the associated user interactions.
Application
See also
Only available/enabled in the Enterprise edition. An error is returned, if accessed by any other
version.
Description
Access the XMLSpy application object.
Errors
2200 The object is no longer valid.
2201 Invalid address for the return parameter was specified.
CompatibilityMode
Property: CompatibilityMode as Boolean
Only available/enabled in the Enterprise edition. An error is returned, if accessed by any other
version.
Description
Set to t
rue to generate code compatible to XMLSpy 2005R3. Set to f
al
se to use newly added
code-generation features.
Errors
2200 The object is no longer valid.
2201 Invalid action passed as parameter or an invalid address was specified
for the return parameter.
CPPSettings_DOMType
Property: CPPSettings_DOMType as SPYDOMType
Only available/enabled in the Enterprise edition. An error is returned, if accessed by any other
version.
Description
Defines one of the settings that configure generation of C++ code.
Errors
2200 The object is no longer valid.
2201 Invalid action passed as parameter or an invalid address was specified
for the return parameter.
CPPSettings_GenerateVC6ProjectFile
Property: CPPSettings_GenerateVC6ProjectFile as Boolean
Only available/enabled in the Enterprise edition. An error is returned, if accessed by any other
version.
Description
Defines one of the settings that configure generation of C++ code.
Errors
2200 The object is no longer valid.
2201 Invalid action passed as parameter or an invalid address was specified
for the return parameter.
CPPSettings_GenerateGCCMakefile
Property: CPPSettings_GenerateGCCMakefile as Boolean
Only available/enabled in the Enterprise edition. An error is returned, if accessed by any other
version.
Description
Creates makefiles to compile the generated code under Linux with GCC.
Errors
2200 The object is no longer valid.
2201 Invalid action passed as parameter or an invalid address was specified
for the return parameter.
CPPSettings_GenerateVSProjectFile
Property: CSharpSettings_GenerateVSProjectFile as SPYProjectType
Only available/enabled in the Enterprise edition. An error is returned, if accessed by any other
version.
Description
Defines one of the settings that configure generation of C++ code. Only
spyVisualStudio2005Project (=4) and spyVisualStudio2008Project (=5) and
spyVisualStudio2010Project (=6) are valid project types.
Errors
2200 The object is no longer valid.
2201 Invalid action passed as parameter or an invalid address was specified
for the return parameter.
CPPSettings_LibraryType
Property: CPPSettings_LibraryType as SPYLibType
Only available/enabled in the Enterprise edition. An error is returned, if accessed by any other
version.
Description
Defines one of the settings that configure generation of C++ code.
Errors
2200 The object is no longer valid.
2201 Invalid action passed as parameter or an invalid address was specified
for the return parameter.
CPPSettings_UseMFC
Property: CPPSettings_UseMFC as Boolean
Only available/enabled in the Enterprise edition. An error is returned, if accessed by any other
version.
Description
Defines one of the settings that configure generation of C++ code.
Errors
2200 The object is no longer valid.
2201 Invalid action passed as parameter or an invalid address was specified
for the return parameter.
CSharpSettings_ProjectType
Property: CSharpSettings_ProjectType as SPYProjectType
Only available/enabled in the Enterprise edition. An error is returned, if accessed by any other
version.
Description
Defines the only setting to configure generation of C# code.
Errors
2200 The object is no longer valid.
2201 Invalid action passed as parameter or an invalid address was specified
for the return parameter.
OutputPath
Property: OutputPath as String
Only available/enabled in the Enterprise edition. An error is returned, if accessed by any other
version.
Description
Selects the base directory for all generated code.
Errors
2200 The object is no longer valid.
2201 Invalid address for the return parameter was specified.
OutputPathDialogAction
Property: OutputPathDialogAction as SPYDialogAction
Only available/enabled in the Enterprise edition. An error is returned, if accessed by any other
version.
Description
Defines how the sub-dialog for selecting the code generation output path gets handled. Set this
value to spyDialogUserInput(2) to show the dialog with the current value of the OutputPath
property as default. Use spyDialogOK(0) to hide the dialog from the user.
Errors
2200 The object is no longer valid.
2201 Invalid action passed as parameter or an invalid address was specified
for the return parameter.
OutputResultDialogAction
Property: OutputResultDialogAction as SPYDialogAction
Only available/enabled in the Enterprise edition. An error is returned, if accessed by any other
version.
Description
Defines how the sub-dialog that asks to show the result of the code generation process gets
handled. Set this value to spyDialogUserInput(2) to show the dialog. Use spyDialogOK(0) to
hide the dialog from the user.
Errors
2200 The object is no longer valid.
2201 Invalid action passed as parameter or an invalid address was specified
for the return parameter.
Parent
See also
Only available/enabled in the Enterprise edition. An error is returned, if accessed by any other
version.
Description
Access the parent of the object.
Errors
2200 The object is no longer valid.
2201 Invalid address for the return parameter was specified.
ProgrammingLanguage
Property: ProgrammingLanguage as ProgrammingLanguage
Only available/enabled in the Enterprise edition. An error is returned, if accessed by any other
version.
Description
Selects the output language for the code to be generated.
CAUTION: Setting this property to one of C++, C# or Java, changes the property
TemplateFileName to the appropriate template file delivered with XMLSpy as well. If you want
to generate C++, C# or Java code based on your own templates, set first the programming
language and then select your template file.
Errors
PropertySheetDialogAction
Property: PropertySheetDialogAction as SPYDialogAction
Only available/enabled in the Enterprise edition. An error is returned, if accessed by any other
version.
Description
Defines how the sub-dialog that configures the code generation process gets handled. Set this
value to spyDialogUserInput(2) to show the dialog with the current values as defaults. Use
spyDialogOK(0) to hide the dialog from the user.
Errors
2200 The object is no longer valid.
2201 Invalid action passed as parameter or an invalid address was specified
for the return parameter.
TemplateFileName
Property: TemplateFileName as String
Only available/enabled in the Enterprise edition. An error is returned, if accessed by any other
version.
Description
Selects the code generation template file. XMLSpy comes with template files for C++, C# or
Java in the SPL folder of your installation directory.
Setting this property to one of the code generation template files of your XMLSpy installation
automatically sets the ProgrammingLanguage property to its appropriate value.
Errors
2200 The object is no longer valid.
2201 Invalid address for the return parameter was specified.
4.3.8 DatabaseConnection
See also
Description
DatabaseConnection specifies the parameters for the database connection.
Please note that the properties of the DatabaseConnection interface are referring to the settings
of the import and export dialogs of XMLSpy.
ADOConnection
See also
Property: ADOConnection as St
ri
ng
Description
The property ADOConnection contains a connection string. Either use this property or
ODBCConnection or File to refer to a database.
Errors
No error codes are returned.
Example
AsAttributes
See also
Description
Set AsAttributes to true if you want to initialize all import fields to be imported as attributes.
Default is false and will initialize all fields to be imported as elements. This property is used only
in calls to Appl
i
cati
on.GetDatabaseIm portEl
em entList .
Errors
No error codes are returned.
CommentIncluded
See also
Description
This property tells whether additional comments are added to the generated XML. Default is
true. This property is used only when importing from databases.
Errors
No error codes are returned.
CreateMissingTables
See also
Description
If CreateMissingTables is true, tables which are not already defined in the export database
will be created during export. Default is true. This property is used only when exporting to
databases.
Errors
No error codes are returned.
CreateNew
See also
Description
Set CreateNew true if you want to create a new database on export. Any existing database will
be overwritten. See also DatabaseConnection.File. Default is false. This property is used
only when exporting to databases.
Errors
No error codes are returned.
DatabaseKind
See also
Description
Select the kind of database that gets access. The default value is spyDB_Unspecified(7) and is
sufficient in most cases. This property is used only when importing from databases.
Errors
DatabaseSchema
See also
Description
This property specifies the Schema used for export in Schema aware databases. Default is "".
This property is used only when exporting to databases.
Errors
No error codes are returned.
ExcludeKeys
See also
Description
Set ExcludeKeys to true if you want to exclude all key columns from the import data. Default
is false. This property is used only when importing from databases.
Errors
No error codes are returned.
File
See also
Property: File as St
ri
ng
Description
The property File sets the path for the database during export or import. This property can
only be used in conjunction with a Microsoft Access database. Either use this property or
ODBCConnection or ADOConnection to refer to the database.
Errors
No error codes are returned.
ForeignKeys
See also
Description
Specifies whether the Foreign Keys constraint is created or not. Default is true. This property is
used only when creating a XML Schema from a DB structure.
Errors
No error codes are returned.
ImportColumnsType
See also
Description
Defines if column information from the DB is saved as element or attribute in the XML Schema.
Default is as element. This property is used only when creating a XML Schema from a DB
structure.
Errors
No error codes are returned.
IncludeEmptyElements
See also
Description
Set IncludeEmptyElements to false if you want to exclude all empty elements. Default is
true. This property is used only when importing from databases.
Errors
No error codes are returned.
NullReplacement
See also
Description
This property contains the text value that is used during import for empty elements (null values).
Default is "". This property is used only when importing from databases.
Errors
No error codes are returned.
NumberDateTimeFormat
See also
Description
The property NumberDateTimeFormat sets the format of numbers and date- and time-values.
Default is spySystemLocale. This property is used only when importing from databases.
Errors
No error codes are returned.
ODBCConnection
See also
Property: ODBCConnection as St
ri
ng
Description
The property ODBCConnection contains a ODBC connection string. Either use this property
or ADOConnection or File to refer to a database.
Errors
No error codes are returned.
PrimaryKeys
See also
Description
Specifies whether the Primary Keys constraint is created or not. Default is true. This property is
used only when creating a XML Schema from a DB structure.
Errors
No error codes are returned.
SchemaExtensionType
See also
Description
Defines the Schema extension type used during the Schema generation. This property is used
only when creating a XML Schema from a DB structure.
Errors
No error codes are returned.
SchemaFormat
See also
Description
Defines the Schema format used during the Schema generation. This property is used only
when creating a XML Schema from a DB structure.
Errors
No error codes are returned.
SQLSelect
See also
Property: SQLSelect as St
ri
ng
Description
The SQL query for the import is stored in the property SQLSelect. This property is used only when
importing from databases. See also Import and Export.
Errors
No error codes are returned.
TextFieldLen
See also
Property: TextFieldLen as l
ong
Description
The property TextFieldLen sets the length for created text fields during the export. Default is
255. This property is used only when exporting to databases.
Errors
No error codes are returned.
UniqueKeys
See also
Description
Specifies whether the Unique Keys constraint is created or not. Default is true. This property is
used only when creating a XML Schema from a DB structure.
Errors
No error codes are returned.
4.3.9 Dialogs
See also
FindInFilesDlg
WSDLDocumentationDlg
WSDL20DocumentationDlg
XBRLDocumentationDlg
Description
The Dialogs object provides access to different built-in dialogs of XMLSpy. These dialog objects
allow to initialize the fields of user dialogs before they get presented to the user or allow to
simulate complete user input by your program.
Application
See also
Description
Access the XMLSpy application object.
Errors
2300 The object is no longer valid.
2301 Invalid address for the return parameter was specified.
CodeGeneratorDlg
See also
Only available/enabled in the Enterprise edition. An error is returned, if accessed by any other
version.
Description
Get a new instance of a code generation dialog object. You will need this object to pass the
necessary parameters to the code generation methods. Initial values are taken from last usage
of the code generation dialog.
Errors
2300 The Dialogs object or one of its parents is no longer valid.
2301 Invalid address for the return parameter was specified.
FileSelectionDlg
See also
Description
Get a new instance of a file selection dialog object.
File selection dialog objects are passed to you with the some events that signal opening or
saving of documents and projects.
Errors
2300 The Dialogs object or one of its parents is no longer valid.
Parent
See also
Description
Access the XMLSpy application object.
Errors
2300 The object is no longer valid.
2301 Invalid address for the return parameter was specified.
SchemaDocumentationDlg
See also
Description
Get a new instance of a dialog object that parameterizes generation of schema documentation.
See Document.GenerateSchemaDocumentation for its usage.
Errors
2300 The Dialogs object or one of its parents is no longer valid.
2301 Invalid address for the return parameter was specified.
GenerateSampleXMLDlg
See also
Description
Get a new instance of a dialog object that parameterizes generation of a sample XML based on
a W3C schema or DTD. See GenerateSampleXML for its usage.
Errors
2300 The Dialogs object or one of its parents is no longer valid.
2301 Invalid address for the return parameter was specified.
DTDSchemaGeneratorDlg
See also
Description
Get a new instance of a dialog object that parameterizes generation of a schema or DTD. See
Document.GenerateDTDOrSchemaEx for its usage.
Errors
2300 The Dialogs object or one of its parents is no longer valid.
FindInFilesDlg
See also
Description
Get a new instance of a dialog object that parameterizes the search (or replacement) of strings
in files. See Application.FindInFiles for its usage.
Errors
2300 The Dialogs object or one of its parents is no longer valid.
2301 Invalid address for the return parameter was specified.
WSDLDocumentationDlg
See also
Description
Get a new instance of a dialog object that parameterizes generation of WSDL documentation.
See Document.GenerateWSDLDocumentation for its usage.
Errors
2300 The Dialogs object or one of its parents is no longer valid.
2301 Invalid address for the return parameter was specified.
WSDL20DocumentationDlg
See also
Description
Get a new instance of a dialog object that parameterizes generation of WSDL 2.0
documentation. See Document.GenerateWSD20LDocumentation for its usage.
Errors
2300 The Dialogs object or one of its parents is no longer valid.
2301 Invalid address for the return parameter was specified.
XBRLDocumentationDlg
See also
Description
Get a new instance of a dialog object that parameterizes generation of WSDL 2.0
documentation. See Document.GenerateXBRLDocumentation for its usage.
Errors
4.3.10 Document
See also
XML validation
IsWellFormed
IsValid
SetExternalIsValid
Document export
GetExportElementList
ExportToText
ExportToDatabase
CreateDBStructureFromXMLSchema
GetDBStructureList
Title
IsModified
Saved
SaveAs
Save
SaveInString
SaveToURL
Close
View access
CurrentViewMode
SwitchViewMode
AuthenticView
GridView
DocEditView (obsolete)
Access to XMLData
RootElement
DataRoot
CreateChild
UpdateViews
StartChanges
EndChanges
UpdateXMLData
Description
Document objects represent XML documents opened in XMLSpy.
Use one of the following properties to access documents that are already open XMLSpy:
Application.ActiveDocument
Application.Documents
Events
OnBeforeSaveDocument
See also
Function On_BeforeSaveDocument(objDocument,objDialog)
End Function
Description
This event gets fired on any attempt to save a document. The file selection dialog object is
initialized with the name chosen for the document file. You can modify this selection. To
continue saving the document leave the Fi l
eSel
ecti
onDl
g.Di
al
ogActi
on property of io_objDialog
at its default value spyDialogO K . To abort saving of the document set this property to
spyDialogCancel .
OnBeforeCloseDocument
See also
Description
This event gets fired on any attempt to close a document. To prevent the document from being
closed return false.
OnBeforeValidate
See also
Description
This event gets fired before the document is validated. It is possible to suppress the default
validation by returning false from the event handler. In this case the script should also set the
validation result using the SetExternalIsValid method.
bOnLoading is true if the the event is raised on the initial validation on loading the document.
bOnCommand is true whenever the user selected the Validate command from the Toolbar or
menu.
OnCloseDocument
See also
Description
This event gets fired as a result of closing a document. Do not modify the document from within
this event.
OnViewActivation
See also
Description
This event gets fired whenever a view of a document becomes visible (i.e. becomes the active
view) or invisible (i.e. another view becomes the active view or the document gets closed).
However, the first view activation event after a document gets opened cannot be received, since
there is no document object to get the event from. Use the Application.O nDocum entO pened
event instead.
Application
See also
Description
Access the XMLSpy application object.
Errors
1400 The object is no longer valid.
1407 Invalid address for the return parameter was specified.
AssignDTD
See also
Description
The method places a reference to the DTD file "strDTDFile" into the document. Note that no
error occurs if the file does not exist, or is not accessible. If bDialog is true XMLSpy presents
a dialog to set the file.
Errors
1400 The object is no longer valid.
AssignSchema
See also
Description
The method places a reference to the schema file "strSchemaFile" into the document. Note that
no error occurs if the file does not exist or is not accessible. If bDialog is true XMLSpy
presents a dialog to set the file.
Errors
1400 The object is no longer valid.
1409 You are not allowed to assign a schema file to the document.
AssignXSL
See also
Description
The method places a reference to the XSL file "strXSLFile" into the document. Note that no
error occurs if the file does not exist or is not accessible. If bDialog is true XMLSpy presents a
dialog to set the file.
Errors
1400 The object is no longer valid.
1409 You are not allowed to assign an XSL file to the document.
AssignXSLFO
See also
Description
The method places a reference to the XSLFO file "strXSLFile" into the document. Note that no
error occurs if the file does not exist or is not accessible. If bDialog is true XMLSpy presents a
dialog to set the file.
Errors
1400 The object is no longer valid.
1409 You are not allowed to assign an XSL file to the document.
AsXMLString
See also
Description
This property can be used to get or set the document content.
Errors
1400 The document object is no longer valid.
1404 Cannot create XMLData object.
1407 View mode cannot be switched.
AuthenticView
See also
Description
Returns an object that gives access to properties and methods specific to Authentic view. The
object returned is only valid if the current document is opened in Authentic view mode. The
lifetime of an object ends with the next view switch. Any attempt to access objects or any of its
children afterwards will result in an error indicating that the object is invalid.
AuthenticView and DocEditView both provide automation access to the Authentic view
mode of XMLSpy. Functional overlap is intentional. A future version of Authentic View will
include all functionality of DocEditView and its sub-objects, thereby making usage of
DocEditView obsolete.
Errors
1400 The object is no longer valid.
1417 Document needs to be open in authentic view mode.
Examples
' ---------------------------------------
' XMLSpy scripting environment - VBScript
' secure access to authentic view object
' ---------------------------------------
Dim objDocument
Set objDocument = Application.ActiveDocument
If (Not objDocument Is Nothing) Then
' we have an active document, now check for view mode
If (objDocument.CurrentViewMode <> spyViewAuthentic) Then
If (Not objDocument.SwitchViewMode (spyViewAuthentic)) Then
MsgBox "Active document does not support authentic view
mode"
Else
' now it is safe to access the authentic view object
Dim objAuthenticView
Set objAuthenticView = objDocument.AuthenticView
' now use the authentic view object
End If
End If
Else
MsgBox "No document is open"
End If
Close
See also
Description
To close the document call this method. If bDiscardChanges is true and the document is
modified, the document will be closed but not saved.
Errors
1400 The object is no longer valid.
1401 Document needs to be saved first.
ConvertDTDOrSchema
See also
Parameters
nFormat
Sets the schema output format to DTD, or W3C.
nFrequentElements
Create complex elements as elements or complex types.
Description
ConvertDTDOrSchema takes an existing schema format and converts it into a different format.
For a finer tuning of DTD / schema conversion, use ConvertDTDOrSchemaEx.
Errors
1400 The object is no longer valid.
1412 Error during conversion.
ConvertDTDOrSchemaEx
See also
Parameters
nFormat
Sets the schema output format to DTD, or W3C.
nFrequentElements
Create complex elements as elements or complex types.
sOutputPath
The file path for the newly generated file.
nOutputPathDialogAction
Defines the dialog interaction for this call.
Description
ConvertDTDOrSchemaEx takes an existing schema format and converts it into a different
format.
Errors
1400 The object is no longer valid.
1412 Error during conversion.
ConvertToWSDL20
Method: ConvertToWSDL20 (sFilePath as String, bShowDialogs as Boolean)
Parameters
sFilePath
This specifies the file name of the converted WSDL. In case the source WSDL includes files
which also must be converted, then only the directory part of the given path is used and the file
names are generated automatically.
bShowDialogs
Defines whether file/folder selection dialogs are shown.
Description
Converts the WSDL 1.1 document to a WSDL 2.0 file. It will also convert any referenced WSDL
files that are referenced from within this document.
Errors
1400 The document object is no longer valid.
1407 Invalid parameters have been passed or an empty file name has been
specified as output target.
1417 The document is not opened in WSDL view, maybe it is not an '.wsdl' file.
1421 Feature is not available in this edition.
1433 WSDL 1.1 to WSDL 2.0 conversion failed.
CreateChild
See also
Return Value
The method returns the new XMLData object.
Description
To create a new XMLData object use the CreateChild() method. See also Using XMLData.
Errors
1400 The object is no longer valid.
1404 Cannot create XMLData object.
1407 Invalid address for the return parameter was specified.
CreateDBStructureFromXMLSchema
See also
Description
CreateDBStructureFromXMLSchema exports the given tables to the specified database.
The function returns the SQL statements that were necessary to perform the changes.
Errors
1429 Database selection missing.
1430 Document export failed.
CreateSchemaDiagram
See also
Return Value
None.
Description
The method creates a diagram of the schema type strName of kind nKind and saves the
output file into strFile.
Errors
1400 The object is no longer valid.
1414 Failed to save diagram.
1415 Invalid schema definition type specified.
CurrentViewMode
See also
Description
The property holds the current view mode of the document. See also
Document.SwitchViewMode.
Errors
1400 The object is no longer valid.
1407 Invalid address for the return parameter was specified.
DataRoot
See also
Description
This property provides access to the document's first XMLData object of type
spyXMLDataElement. This is typically the root element for all document content data. See
XMLSpyDocument.RootElement to get the root element of the whole document including XML
Errors
1400 The document object is no longer valid.
1407 Invalid address for the return parameter was specified.
DocEditView
See also
Description
Holds a reference to the current Authentic View object.
Errors
1400 The object is no longer valid.
1407 Invalid address for the return parameter was specified.
1417 Document needs to be open in authentic view mode.
Encoding
See also
Description
This property provides access to the document's encoding value. However, this property can
only be accessed when the document is opened in spyViewGrid, spyViewText or
spyViewAuthentic. See CurrentViewMode on how to detect that a document's actual view
mode.
8859-1,
8859-2,
ASCII, ISO-646,
850,
1252,
1255,
SHIFT-JIS, MS-KANJI,
BIG5, FIVE,
UTF-7,
UTF-8,
UTF-16
Errors
1400 The document object is no longer valid.
1407 Invalid address for the return parameter was specified.
1416 Operation not supported in current view mode.
EndChanges
See also
Method: EndChanges()
Description
Use the method EndChanges to display all changes since the call to
Document.StartChanges.
Errors
1400 The object is no longer valid.
ExecuteXQuery
See also
Description
Execute the XQuery statements contained in the document. Use the XML file specified as XML
source for the transformation. If your XQuery script does not use an XML source set the
parameter strXM LFileNam e to an empty string.
Errors
1400 The document object is no longer valid.
1423 XQuery transformation error.
1424 Not all files required for operation could be loaded. Most likely, the file
specified in strXM LFileNam e does not exist or is not valid.
ExportToDatabase
See also
Description
ExportToDatabase exports the XML document starting with the element pFromChild. The
parameter pExportSettings defines the behaviour of the export (see
Application.GetExportSettings). The parameter pDatabase specifies the destination
of the export (see Application.GetDatabaseSettings).
Errors
1400 The object is no longer valid.
1407 Invalid parameter or invalid address for the return parameter was
specified.
1416 Error during export.
1429 Database selection missing.
1430 Document export failed.
Example
objDB.CreateMissingTables = True
objDB.CreateNew = True
objDB.File = "C:\Export.mdb"
ExportToText
See also
Description
ExportToText exports tabular information from the document starting at pFrom Child into one
or many text files. Columns of the resulting tables are generated in alphabetical order of the
column header names. Use GetExportElementList to learn about the data that will be
exported. The parameter pExportSettings defines the specifics for the export. Set the property
ExportSettings.ElementList to the - possibly modified - list returned by
GetExportElementList to avoid exporting all contained tables. The parameter
pTextSetti
ngs defines the options specific to text export and import. You need to set the
property TextImportExportSettings.DestinationFolder before you call ExportToText
.
Errors
1400 The object is no longer valid.
1407 Invalid parameter or invalid address for the return parameter was
specified.
1416 Error during export.
1430 Document export failed.
Example
' ---------------------------------------------------------
' VBA client code fragment - export document to text files
' ---------------------------------------------------------
Dim objDoc As Document
Set objDoc = objSpy.ActiveDocument
objTextExp.HeaderRow = True
objTextExp.DestinationFolder = "C:\Exports"
FullName
See also
Description
This property can be used to get or set the full file name - including the path - to where the
document gets saved. The validity of the name is not verified before the next save operation.
Errors
1400 The document object is no longer valid.
1402 Empty string has been specified as full file name.
GenerateDTDOrSchema
See also
Parameters
nFormat
Sets the schema output format to DTD, or W3C.
nValuesList
Generate not more than this amount of enumeration-facets per type. Set to -1 for unlimited.
nDetection
Specifies granularity of simple type detection.
nFrequentElements
Shall the types for all elements be defined as global? Use that value spyGlobalComplexType to
define them on global scope. Otherwise, use the value spyGlobalElements.
Description
Use this method to automatically generate a DTD or schema for the current XML document.
For a finer tuning of DTD / schema generation, use GenerateDTDOrSchemaEx.
Errors
1400 The object is no longer valid.
1407 Invalid parameter or invalid address for the return parameter was
specified.
GenerateDTDOrSchemaEx
See also
Description
Use this method to automatically generate a DTD or schema for the current XML document. A
DTDSchemaGeneratorDlg object is used to pass information to the schema/DTD generator.
The generation process can be configured to allow user interaction or run without further user
input.
Errors
1400 The object is no longer valid.
1407 Invalid parameter or invalid address for the return parameter was
specified.
GenerateProgramCode
Method: GenerateProgramCode (objDlg as CodeGeneratorDlg)
Only available/enabled in the Enterprise edition. An error is returned, if accessed by any other
version.
Description
Generate Java, C++ or C# class files from the XML Schema definitions in your document. A
CodeGeneratorDlg object is used to pass information to the code generator. The generation
process can be configured to allow user interaction or run without further user input.
Errors
1400 The document object is no longer valid.
1407 An empty file name has been specified.
1421 Feature not available in this edition
GenerateSampleXML
Method: GenerateSampleXML (objDlg as GenerateSampleXMLDlg) as Document
Description
Generates a sample XML if the document is a schema or DTD. Use
Dialogs.GenerateSampleXMLDlg to get an initialized set of options.
Errors
1400 The document object is no longer valid.
GenerateSchemaDocumentation
Method: GenerateSchemaDocumentation (objDlg as SchemaDocumentationDlg)
Description
Generate documentation for a schema definition file in HTML, MS-Word, or RTF format. The
parameter objDlg is used to parameterize the generation process. Use
Dialogs.Schem aDocum entationDlg to get an initialized set of options. As a minimum, you will
need to set the property Schem aDocum entationDlg.OutputFile before starting the generation
process.
Errors
1400 The document object is no longer valid.
1407 Invalid parameters have been passed or an empty file name has been
specified as output target.
1417 The document is not opened in schema view, maybe it is not an '.xsd'
file.
1421 Feature is not available in this edition.
1422 Error during generation
GenerateWSDL20Documentation
Method: GenerateWSDL20Documentation (objDlg as WSDL20DocumentationDlg)
Description
Generate documentation for a WSDL definition file in HTML, MS-Word, or RTF format. The
parameter objDlg is used to parameterize the generation process. Use
Dialogs.W SDL20Docum entationDlg to get an initialized set of options. As a minimum, you will
need to set the property W SDL20Docum entationDlg.OutputFile before starting the generation
process.
Errors
1400 The document object is no longer valid.
1407 Invalid parameters have been passed or an empty file name has been
specified as output target.
1417 The document is not opened in schema view, maybe it is not an '.xsd'
file.
1421 Feature is not available in this edition.
1422 Error during generation
GenerateWSDLDocumentation
Method: GenerateWSDLDocumentation (objDlg as WSDLDocumentationDlg)
Description
Generate documentation for a WSDL definition file in HTML, MS-Word, or RTF format. The
parameter objDlg is used to parameterize the generation process. Use
Dialogs.W SDLDocum entationDlg to get an initialized set of options. As a minimum, you will
need to set the property W SDLDocum entationDlg.OutputFile before starting the generation
process.
Errors
1400 The document object is no longer valid.
1407 Invalid parameters have been passed or an empty file name has been
specified as output target.
1417 The document is not opened in schema view, maybe it is not an '.xsd'
file.
1421 Feature is not available in this edition.
1422 Error during generation
GenerateXBRLDocumentation
Method: GenerateXBRLDocumentation (objDlg as XBRLDocumentationDlg)
Description
Generate documentation for a WSDL definition file in HTML, MS-Word, or RTF format. The
parameter objDlg is used to parameterize the generation process. Use
Dialogs.XBRLDocum entationDlg to get an initialized set of options. As a minimum, you will need
to set the property XBRLDocum entationDlg.OutputFile before starting the generation process.
Errors
1400 The document object is no longer valid.
1407 Invalid parameters have been passed or an empty file name has been
specified as output target.
1417 The document is not opened in schema view, maybe it is not an '.xsd'
file.
1421 Feature is not available in this edition.
1422 Error during generation
GetDBStructureList
See also
Description
GetDBStructureList creates a collection of elements from the Schema document for which
tables in the specified database are created. The function returns a collection of
Elem entLi
stItem s where the properties ElementListItem.Name contain the names of the
tables.
Errors
1400 The object is no longer valid.
1427 Failed creating parser for the specified XML.
1428 Export of element list failed.
1429 Database selection missing.
GetExportElementList
See also
Description
GetExportElementList creates a collection of elements to export from the document,
depending on the settings in pExportSettings and starting from the element pFromChild.
The function returns a collection of El
em entLi
stItem s where the properties
ElementListItem.Name contain the names of the tables that can be exported from the
document. The property ElementListItem.FieldCount contains the number of columns in
Errors
1400 The object is no longer valid.
1407 Invalid parameter or invalid address for the return parameter was
specified.
1427 Failed creating parser for the specified XML.
1428 Export of element list failed.
GetPathName (obsolete)
Superseded by Document.FullName
// ----- javascript sample -----
// instead of:
// strPathName = Application.ActiveDocument.GetPathName();
// use now:
strPathName = Application.ActiveDocument.FullName;
See also
Description
The method GetPathName gets the path of the active document.
GridView
See also
Description
This property provides access to the grid view functionality of the document.
Errors
1400 The object is no longer valid.
1407 Invalid address for the return parameter was specified.
1417 Document needs to be open in enhanced grid view mode.
IsModified
See also
Description
True if the document is modified.
Errors
1400 The object is no longer valid.
1407 Invalid address for the return parameter was specified.
IsValid
See also
Return Value
True if the document is valid, false if not.
Description
IsValid() validates the document against its associated schema or DTD. strError gives you the
same error message as XMLSpy, if you validate the file within the editor.
nErrorPos is obsolete and only present for compatibility reasons. pBadData is a reference to the
XMLData object raising the error. It is only available if the document is currently displayed in
TextView, GridView or AuthenticView.
Errors
1400 The object is no longer valid.
1407 Invalid parameter or invalid address for the return parameter was
specified.
1408 Unable to validate file.
Examples
' ---------------------------------------
' XMLSpy scripting environment - VBScript
' ---------------------------------------
Dim errorText
Dim errorPos
Dim badData
Call MsgBox("validation error[" & errorPos & "]: " & Text)
End If
// ---------------------------------------
// XMLSpy scripting environment - JScript
// ---------------------------------------
// define as arrays to support their usage as return parameters
if (! valid)
{
// compose the error description
var text = errorText;
IsWellFormed
See also
Return Value
True if the document is well formed.
Description
IsWellFormed checks the document for well-formedness starting at the element pData.
If the document is not well formed, strError contains an error message, nErrorPos the
position in the file and pBadXMLData holds a reference to the element which breaks the
well-formedness. These out-parameters are defined as VARIANTs to support scripting
languages like VBScript.
Errors
1400 The object is no longer valid.
1407 Invalid parameter or invalid address for the return parameter was
specified.
Example
See IsValid.
Name
See also
Description
Use this property to retrieve the name - not including the path - of the document file. To change
the file name for a document use the property FullName.
Errors
1400 The document object is no longer valid.
1407 Invalid address for the return parameter was specified.
Parent
See also
Description
Access the parent of the document object.
Errors
1400 The document object is no longer valid.
1407 Invalid address for the return parameter was specified.
Path
See also
Description
Use this property to retrieve the path - not including the file name - of the document file. To
change the file name and path for a document use the property FullName.
Errors
1400 The document object is no longer valid.
1407 Invalid address for the return parameter was specified.
RootElement
See also
Description
The property RootElement provides access to the root element of the XML structure of the
document including the XML prolog data. To access the first element of a document's content
navigate to the first child of kind spyXMLDataElement or use the Document.DataRoot property.
If the CurrentViewMode is not spyViewGrid or spyViewAuthentic an UpdateXMLData may be
necessary to get access to the latest XMLData.
Errors
1400 The document object is no longer valid.
1407 Invalid address for the return parameter was specified.
Save
See also
Method: Save()
Description
The method writes any modifications of the document to the associated file. See also
Document.FullName.
Errors
1400 The document object is no longer valid.
1407 An empty file name has been specified.
1403 Error when saving file, probably the file name is invalid.
SaveAs
See also
Description
Save the document to the file specified. If saving was successful, the FullName property gets
set to the specified file name.
Errors
1400 The document object is no longer valid.
1407 An empty file name has been specified.
1403 Error when saving file, probably the file name is invalid.
Saved
See also
Description
This property can be used to check if the document has been saved after the last modifications.
It returns the negation of IsModified.
Errors
1400 The document object is no longer valid.
1407 Invalid address for the return parameter was specified.
SaveInString
See also
Parameters
pData
XMLData element to start. Set pData to Document.RootElement if you want to copy the
complete file.
bMarked
If bMarked is true, only the elements selected in the grid view are copied.
Return Value
Returns a string with the XML data.
Description
SaveInString starts at the element pData and converts the XMLData objects to a string
representation.
Errors
1400 The object is no longer valid.
1407 Invalid parameter or invalid address for the return parameter was
specified.
SaveToURL
See also
Return Value
Description
SaveToURL() writes the document to the URL strURL. This method does not set the
permanent file path of the document.
Errors
1400 The object is no longer valid.
1402 Invalid URL specified.
1403 Error while saving to URL.
SetActiveDocument
See also
Method: SetActiveDocument()
Description
The method sets the document as the active and brings it to the front.
Errors
1400 The object is no longer valid.
SetEncoding (obsolete)
Superseded by Document.Encoding
// ----- javascript sample -----
// instead of:
// Application.ActiveDocument.SetEncoding("UTF-16");
// use now:
Application.ActiveDocument.Encoding = "UTF-16";
See also
Description
SetEncoding sets the encoding of the document like the menu item "File/Encoding..." in
8859-1,
8859-2,
ASCII, ISO-646,
850,
1252,
1255,
SHIFT-JIS, MS-KANJI,
BIG5, FIVE,
UTF-7,
UTF-8,
UTF-16
SetExternalIsValid
See also
Parameters
bValid
Sets the result of an external validation process.
Description
The internal information set by this method is only queried on cancelling the default validation in
any OnBeforeValidate handler.
Errors
1400 The object is no longer valid.
SetPathName (obsolete)
Superseded by Document.FullName
// ----- javascript sample -----
// instead of:
// Application.ActiveDocument.SetPathName("C:\\myXMLFiles\\test.xml");
// use now:
Application.ActiveDocument.FullName = "C:\\myXMLFiles\\test.xml";
See also
Description
The method SetPathName sets the path of the active document. SetPathName only copies
the string and does not check if the path is valid. All succeeding save operations are done into
this file.
StartChanges
See also
Method: StartChanges()
Description
After StartChanges is executed XMLSpy will not update its editor windows until
Document.EndChanges is called. This increases performance of complex tasks to the XML
structure.
Errors
1400 The object is no longer valid.
Suggestions
Property: Suggestions as Array
Description
This property contains the last valid user suggestions for this document. The XMLSpy
generated suggestions can be modified before they are shown to the user in the
OnBeforeShowSuggestions event.
Errors
1400 The object is no longer valid.
1407 Invalid parameter or invalid address for the return parameter was
specified.
SwitchViewMode
See also
Return value
Returns true if view mode is switched.
Description
The method sets the current view mode of the document in XMLSpy. See also
Document.CurrentViewMode.
Errors
1400 The object is no longer valid.
1407 Invalid address for the return parameter was specified.
1417 Invalid view mode specified.
TextView
See also
Description
This property provides access to the text view functionality of the document.
Errors
1400 The object is no longer valid.
1407 Invalid address for the return parameter was specified.
Title
See also
Description
Title contains the file name of the document. To get the path and filename of the file use
FullName.
Errors
1400 The document object is no longer valid.
1407 Invalid address for the return parameter was specified.
TransformXSL
See also
Method: TransformXSL()
Description
TransformXSL processes the XML document via the associated XSL file. See
Document.AssignXSL on how to place a reference to a XSL file into the document.
Errors
1400 The document object is no longer valid.
1411 Error during transformation process.
TransformXSLEx
See also
Description
TransformXSL processes the XML document via the associated XSL file. See
Document.AssignXSL on how to place a reference to a XSL file into the document.
Errors
1400 The document object is no longer valid.
1411 Error during transformation process.
TransformXSLFO
See also
Method: TransformXSLFO()
Description
TransformXSLFO processes the XML document via the associated XSLFO file. See
AssignXSLFO on how to place a reference to a XSLFO file into the document. You need to
assign a FOP processor to XMLSpy before you can use this method.
Errors
1400 The document object is no longer valid.
1411 Error during transformation process.
TreatXBRLInconsistencies AsErrors
Property: TreatXBRLInconsistenciesAsErrors as Boolean
Description
If this is set to true the Document.IsValid() method will return false for XBRL instances
containing inconsistencies as defined by the XBRL Specification. The default value of this
property is false.
Errors
1400 The document object is no longer valid.
1407 Invalid address for the return parameter was specified.
UpdateViews
See also
Method: UpdateViews()
Description
To redraw the Enhanced Grid View and the Tree View call UpdateViews. This can be
important after you changed the XMLData structure of a document. This method does not
redraw the text view of XMLSpy.
Errors
1400 The document object is no longer valid.
UpdateXMLData
See also
Description
The XMLData tree is updated from the current view. Please note that this can fail in case of the
TextView if the current XML text is not well-formed. This is not necessary if CurrentViewMode
is spyViewGrid or spyViewAuthentic because these views keep the XMLData updated.
Errors
1400 The document object is no longer valid.
4.3.11 Documents
See also
Properties
Count
Item
Methods
NewFile
OpenFile
OpenURL
OpenURLDialog
NewFileFromText
Description
This object represents the set of documents currently open in XMLSpy. Use this object to open
further documents or iterate through already opened documents.
Examples
' ---------------------------------------
' XMLSpy scripting environment - VBScript
' iterate through open documents
' ---------------------------------------
Dim objDocuments
Set objDocuments = Application.Documents
// ---------------------------------------
// XMLSpy scripting environment - JScript
// close all open documents
// ---------------------------------------
for (var iter = new Enumerator (Application.Documents);
! iter.atEnd();
iter.moveNext())
{
// MsgBox ("Closing file " + iter.item().Name);
iter.item().Close (true);
}
Count
See also
Description
Count of open documents.
Item
See also
Description
Gets the document with the index n in this collection. Index is 1-based.
NewFile
See also
Parameters
st
rFi
l
e
Full path of new file.
strType
Type of new file as string (i.e. "xml", "xsd", ... )
Return Value
Returns the new file.
Description
NewFile creates a new file of type strType (i.e. "xml"). The newly created file is also the
ActiveDocument.
NewFileFromText
See also
Parameters
st
rText
The content of the new document in plain text.
strType
Type of the document to create (i.e. "xml").
Return Value
The method returns the new document.
Description
NewFileFromText creates a new document with strText as its content.
OpenFile
See also
Parameters
strPath
Path and file name of file to open.
bDi
al
og
Show dialogs for user input.
Return Value
Returns the opened file on success.
Description
OpenFile opens the file strPath . If bDi
al
og is TRUE, a file-dialog will be displayed.
Example
Dim objDoc As Document
Set objDoc = objSpy.Documents.OpenFile(strFile, False)
OpenURL
See also
Parameters
strURL
URL to open as document.
nU R LType
Type of document to open. Set to -1 for auto detection.
nLoading
Set nLoading to 0 (zero) if you want to load it from cache or proxy. Otherwise set nLoading to 1.
strUser
Name of the user if required. Can be empty.
strPassword
Password for authentification. Can be empty.
Return Value
The method returns the opened document.
Description
O penU R Lopens the URL strURL.
OpenURLDialog
See also
Parameters
strURL
URL to open as document.
nU R LType
Type of document to open. Set to -1 for auto detection.
nLoading
Set nLoading to 0 (zero) if you want to load it from cache or proxy. Otherwise set nLoading to 1.
strUser
Name of the user if required. Can be empty.
strPassword
Password for authentification. Can be empty.
Return Value
The method returns the opened document.
Description
O penURLDialog displays the "open URL" dialog to the user and presets the input fields with the given
parameters.
4.3.12 DTDSchemaGeneratorDlg
See also
D TD Schem aForm at
Val ueList
TypeDetection
FrequentElem ents
M ergeAllEqualNam ed
Resol veEntiti
es
Attri
buteTypeDefi ni
ti
on
Gl obalAttri
butes
OnlyStringEnum s
M axEnum Length
OutputPath
OutputPathDi alogActi
on
Description
Use this object to configure the generation of a schema or DTD. The method
GenerateDTDOrSchemaEx expects a DTDSchemaGeneratorDlg as parameter to configure the
generation as well as the associated user interactions.
Application
Property: Application as Application (read-only)
Description
Access the XMLSpy application object.
Errors
3000 The object is no longer valid.
3001 Invalid address for the return parameter was specified.
AttributeTypeDefinition
Property: AttributeTypeDefinition as SPYAttributeTypeDefinition
Description
Specifies how attribute definitions get merged.
Errors
3000 The object is no longer valid.
3001 Invalid address for the return parameter was specified.
DTDSchemaFormat
Property: DTDSchemaFormat as SPYDTDSchemaFormat
Description
Sets the schema output format to DTD, or W3C.
Errors
3000 The object is no longer valid.
3001 Invalid address for the return parameter was specified.
FrequentElements
Property: FrequentElements as SPYFrequentElements
Description
Shall the types for all elements be defined as global? Use that value spyGlobalComplexType to
define them on global scope. Otherwise, use the value spyGlobalElements.
Errors
3000 The object is no longer valid.
3001 Invalid address for the return parameter was specified.
GlobalAttributes
Property: GlobalAttributes as Boolean
Description
Shall attributes with same name and type be resolved globally?
Errors
3000 The object is no longer valid.
3001 Invalid address for the return parameter was specified.
MaxEnumLength
Property: MaxEnumLength as Integer
Description
Specifies the maximum number of characters allowed for enumeration names. If one value is
longer than this, no enumeration will be generated.
Errors
3000 The object is no longer valid.
3001 Invalid address for the return parameter was specified.
MergeAllEqualNamed
Property: MergeAllEqualNamed as Boolean
Description
Shall types of all elements with the same name be merged into one type?
Errors
3000 The object is no longer valid.
3001 Invalid address for the return parameter was specified.
OnlyStringEnums
Property: OnlyStringEnums as Boolean
Description
Specifies if enumerations will be created only for plain strings or all types of values.
Errors
3000 The object is no longer valid.
3001 Invalid address for the return parameter was specified.
OutputPath
Property: OutputPath as String
Description
Selects the file name for the generated schema/DTD.
Errors
3000 The object is no longer valid.
3001 Invalid address for the return parameter was specified.
OutputPathDialogAction
Property: OutputPathDialogAction as SPYDialogAction
Description
Defines how the sub-dialog for selecting the schema/DTD output path gets handled. Set this
value to spyDialogUserInput(2) to show the dialog with the current value of the OutputPath
property as default. Use spyDialogOK(0) to hide the dialog from the user.
Errors
3000 The object is no longer valid.
3001 Invalid address for the return parameter was specified.
Parent
Property: Parent as Dialogs (read-only)
Description
Access the parent of the object.
Errors
3000 The object is no longer valid.
3001 Invalid address for the return parameter was specified.
ResolveEntities
Property: ResolveEntities as Boolean
Description
Shall all entities be resolved before generation starts? If yes, an info-set will be built.
Errors
3000 The object is no longer valid.
3001 Invalid address for the return parameter was specified.
TypeDetection
Property: TypeDetection as SPYTypeDetection
Description
Specifies granularity of simple type detection.
Errors
3000 The object is no longer valid.
3001 Invalid address for the return parameter was specified.
ValueList
Property: ValueList as Integer
Description
Generate not more than this amount of enumeration-facets per type. Set to -1 for unlimited.
Errors
3000 The object is no longer valid.
3001 Invalid address for the return parameter was specified.
4.3.13 ElementList
See also
Properties
Count
Item
Methods
RemoveElement
Description
Element lists are used for different purposes during export and import of data. Depending on
this purpose, different properties of ElementListItem are used.
It can hold
a list of table names returned by a call to Application.GetDatabaseTables,
a list of field names retuned by a call to
Application.GetDatabaseImportElementList or
Application.GetTextImportElementList,
a field name filter list used in Application.ImportFromDatabase and
Application.ImportFromText,
a list of table names and counts for their rows and columns as returned by calls to
GetExportElementList or
Count
See also
Description
Count of elements in this collection.
Item
See also
Description
Gets the element with the index n from this collection. The first item has index 1.
RemoveElement
See also
Description
Rem oveElem ent removes the element Index from the collection. The first Item has index 1.
4.3.14 ElementListItem
See also
Properties
Name
ElementKind
FieldCount
RecordCount
Description
An element in an ElementList. Usage of its properties depends on the purpose of the
element list. For details see ElementList.
ElementKind
See also
Description
Specifies if a field should be imported as XML element (data value of spyXM LDataElem ent ) or
attribute (data value of spyXM LDataAttr ).
FieldCount
See also
Description
Count of fields (i.e. columns) in the table described by this element. This property is only valid
after a call to Docum ent.GetExportElem entList .
Name
See also
Description
Name of the element. This is either the name of a table or a field, depending on the purpose of
th element list.
RecordCount
See also
Description
Count of records (i.e. rows) in the table described by this element. This property is only valid
after a call to Docum ent.GetExportElem entList .
4.3.15 ExportSettings
See also
Properties
ElementList
EntitiesToText
ExportAllElements
SubLevelLimit
FromAttributes
FromSingleSubElements
FromTextValues
CreateKeys
IndependentPrimaryKey
Namespace
ExportCompleteXML
StartFromElement
Description
ExportSetti
ngs contains options used during export of XML data to a database or text file. See
Import and export of data for a general overview.
CreateKeys
See also
Description
This property turns creation of keys (i.e. primary key and foreign key) on or off. Default is True.
ElementList
See also
Description
Default is empty list. This list of elements defines which fields will be exported. To get the list of
available fields use Docum ent.GetExportElem entList . It is possible to prevent exporting
columns by removing elements from this list with ElementList.RemoveElement before
passing it to Docum ent.ExportToDatabase or Docum ent.ExportToText .
EntitiesToText
See also
Description
Defines if XML entities should be converted to text or left as they are during export. Default is
True.
ExportAllElements
See also
Description
If set to t
rue , all elements in the document will be exported. If set to fse , then
al
ExportSettings.SubLevelLimit is used to restrict the number of sub levels to export.
Default is t rue .
ExportCompleteXML
See also
Description
Defines whether the complete XML is exported or only the element specified by
FromAttributes
See also
Description
SetFrom Attri
butes to false if no export data should be created from attributes. Default is True.
FromSingleSubElements
See also
Description
SetFrom SingleSubElem ents to false if no export data should be created from elements. Default
is True.
FromTextValues
See also
Description
SetFrom TextValues to false if no export data should be created from text values. Default is
True.
IndependentPrimaryKey
See also
Description
Turns creation of independent primary key counter for every element on or off. If
ExportSettings.CreateKeys is False, this property will be ignored. Default is True.
Namespace
See also
Description
The default setting removes all namespace prefixes from the element names. In some
database formats the colon is not a legal character. Default is spyN oN am espace .
StartFromElement
See also
Description
Specifies the start element for the export. This property is only considered when
ExportCompleteXML is false.
SubLevelLimit
See also
Description
Defines the number of sub levels to include for the export. Default is 0. This property is ignored
if ExportSettings.ExportAllElements is t rue .
4.3.16 FileSelectionDlg
See also
Dialog properties
FullNam e
Description
The dialog object allows you to receive information about an event and pass back information to
the event handler in the same way as with a user dialog. Use the Fil
eSel
ecti
onDl
g.Ful
l
Nam e to
select or modify the file path and set the Fi
l
eSel
ecti
onDl
g.Di
al
ogActi
on property to cancel or
agree with the action that caused the event.
Application
See also
Description
Access the XMLSpy application object.
Errors
2400 The object is no longer valid.
2401 Invalid address for the return parameter was specified.
DialogAction
Property: DialogAction as SPYDialogAction
Description
If you want your script to perform the file selection operation without any user interaction
necessary, simulate user interaction by either setting the property to spyDialogOK(0) or
spyDialogCancel(1).
To allow your script to fill in the default values but let the user see and react on the dialog, use
the value spyDialogUserInput(2). If you receive a FileSelectionDlg object in an event handler,
spyDialogUserInput(2) is not supported and will be interpreted as spyDialogOK(0).
Errors
2400 The object is no longer valid.
2401 Invalid value for dialog action or invalid address for the return parameter
was specified.
FullName
Property: FullName as String
Description
Access the full path of the file the gets selected by the dialog. Most events that pass a
FileSelectionDlg object to you allow you modify this value and thus influence the action that
caused the event (e.g. load or save to a different location).
Errors
2400 The object is no longer valid.
2401 Invalid address for the return parameter was specified.
Parent
See also
Description
Access the parent of the object.
Errors
2400 The object is no longer valid.
2401 Invalid address for the return parameter was specified.
4.3.17 FindInFilesDlg
See also
Fi
nd
RegularExpression
Replace
DoReplace
ReplaceO nDisk
M atchW holeW ord
M atchCase
SearchLocation
StartFol
der
Incl
udeSubfol ders
SearchInProj ectFi
l
esDoExternal
Fil
eExtension
AdvancedXM LSearch
XM LElem entN am es
XM LElem entContents
XM LAttributeNam es
XM LAttributeContents
X M LC om m ents
XM LC D ata
XM LPI
XM LR est
ShowResult
Description
Use this object to configure the search (or replacement) for strings in files. The method
FindInFiles expects a FindInFilesDlg as parameter.
AdvancedXMLSearch
Property: AdvancedXMLSearch as Boolean
Description
Specifies if the XML search properties (XMLElementNames, XMLElementContents,
XMLAttributeNames, XMLAttributeContents, XMLComments, XMLCData, XMLPI and XMLRest
) are considered. The default is false.
Errors
3500 The object is no longer valid.
3501 Invalid address for the return parameter was specified.
Application
Property: Application as Application (read-only)
Description
Access the XMLSpy application object.
Errors
3500 The object is no longer valid.
3501 Invalid address for the return parameter was specified.
DoReplace
Property: DoReplace as Boolean
Description
Specifies if the matched string is replaced by the string defined in Replace. The default is false.
Errors
3500 The object is no longer valid.
3501 Invalid address for the return parameter was specified.
FileExtension
Property: FileExtension as String
Description
Specifies the file filter of the files that should be considered during the search. Multiple file filters
must be delimited with a semicolon (eg: *.xml;*.dtd;a*.xsd). Use the wildcards * and ? to define
the file filter.
Errors
3500 The object is no longer valid.
3501 Invalid address for the return parameter was specified.
Find
Property: Find as String
Description
Specifies the string to search for.
Errors
3500 The object is no longer valid.
3501 Invalid address for the return parameter was specified.
IncludeSubfolders
Property: IncludeSubfolders as Boolean
Description
Specifies if subfolders are searched too. The default is true.
Errors
3500 The object is no longer valid.
3501 Invalid address for the return parameter was specified.
MatchCase
Property: MatchCase as Boolean
Description
Specifies if the search is case sensitive. The default is true.
Errors
3500 The object is no longer valid.
3501 Invalid address for the return parameter was specified.
MatchWholeWord
Property: MatchWholeWord as Boolean
Description
Specifies whether the whole word or just a part of it must match. The default is false.
Errors
3500 The object is no longer valid.
3501 Invalid address for the return parameter was specified.
Parent
Property: Parent as Dialogs (read-only)
Description
Access the parent of the object.
Errors
3500 The object is no longer valid.
3501 Invalid address for the return parameter was specified.
RegularExpression
Property: RegularExpression as Boolean
Description
Specifies if Find contains a regular expression. The default is false.
Errors
3500 The object is no longer valid.
3501 Invalid address for the return parameter was specified.
Replace
Property: Replace as String
Description
Specifies the replacement string. The matched string is only replaced if DoReplace is set true.
Errors
3500 The object is no longer valid.
3501 Invalid address for the return parameter was specified.
ReplaceOnDisk
Property: ReplaceOnDisk as Boolean
Description
Specifies if the replacement is done directly on disk. The modified file is not opened. The default
is false.
Errors
3500 The object is no longer valid.
3501 Invalid address for the return parameter was specified.
SearchInProjectFilesDoExternal
Property: SearchInProjectFilesDoExternal as Boolean
Description
Specifies if the external folders in the open project are searched, when a project search is
Errors
3500 The object is no longer valid.
3501 Invalid address for the return parameter was specified.
SearchLocation
Property: SearchLocation as SPYFindInFilesSearchLocation
Description
Specifies the location of the search. The default is spyFindInFiles_Documents.
Errors
3500 The object is no longer valid.
3501 Invalid address for the return parameter was specified.
ShowResult
Property: ShowResult as Boolean
Description
Specifies if the result is displayed in the Find in Files output window. The default is false.
Errors
3500 The object is no longer valid.
3501 Invalid address for the return parameter was specified.
StartFolder
Property: StartFolder as String
Description
Specifies the folder where the disk search starts.
Errors
3500 The object is no longer valid.
3501 Invalid address for the return parameter was specified.
XMLAttributeContents
Property: XMLAttributeContents as Boolean
Description
Specifies if attribute contents are searched when AdvancedXMLSearch is true. The default is
true.
Errors
3500 The object is no longer valid.
3501 Invalid address for the return parameter was specified.
XMLAttributeNames
Property: XMLAttributeNames as Boolean
Description
Specifies if attribute names are searched when AdvancedXMLSearch is true. The default is
true.
Errors
3500 The object is no longer valid.
3501 Invalid address for the return parameter was specified.
XMLCData
Property: XMLCData as Boolean
Description
Specifies if CData tags are searched when AdvancedXMLSearch is true. The default is true.
Errors
3500 The object is no longer valid.
3501 Invalid address for the return parameter was specified.
XMLComments
Property: XMLComments as Boolean
Description
Specifies if comments are searched when AdvancedXMLSearch is true. The default is true.
Errors
3500 The object is no longer valid.
3501 Invalid address for the return parameter was specified.
XMLElementContents
Property: XMLElementContents as Boolean
Description
Specifies if element contents are searched when AdvancedXMLSearch is true. The default is
true.
Errors
3500 The object is no longer valid.
3501 Invalid address for the return parameter was specified.
XMLElementNames
Property: XMLElementNames as Boolean
Description
Specifies if element names are searched when AdvancedXMLSearch is true. The default is
true.
Errors
3500 The object is no longer valid.
3501 Invalid address for the return parameter was specified.
XMLPI
Property: XMLPI as Boolean
Description
Specifies if XML processing instructions are searched when AdvancedXMLSearch is true. The
default is true.
Errors
3500 The object is no longer valid.
3501 Invalid address for the return parameter was specified.
XMLRest
Property: XMLRest as Boolean
Description
Specifies if the rest of the XML (which is not covered by the other XML search properties) is
searched when AdvancedXMLSearch is true. The default is true.
Errors
3500 The object is no longer valid.
3501 Invalid address for the return parameter was specified.
4.3.18 FindInFilesResult
See also
Count
Item
Path
Docum ent
Description
This object represents a file that matched the search criteria. It contains a list of
FindInFilesResultMatch objects that describe the matching position.
Application
Property: Application as Application (read-only)
Description
Access the XMLSpy application object.
Errors
3700 The object is no longer valid.
3701 Invalid address for the return parameter was specified.
Count
Property: Count as long (read-only)
Description
Count of elements in this collection.
Document
Property: Path as Document (read-only)
Description
This property returns the Document object if the matched file is already open in XMLSpy.
Errors
3700 The object is no longer valid.
3701 Invalid address for the return parameter was specified.
Item
Method: Item(n as long) as FindInFilesResultMatch
Description
Gets the element with the index n from this collection. The first item has index 1.
Parent
Property: Parent as FindInFilesResults (read-only)
Description
Access the parent of the object.
Errors
3700 The object is no longer valid.
3701 Invalid address for the return parameter was specified.
Path
Property: Path as String (read-only)
Description
Returns the path of the file that matched the search criteria.
Errors
3700 The object is no longer valid.
3701 Invalid address for the return parameter was specified.
4.3.19 FindInFilesResultMatch
See also
Li
ne
Posi
t
i
on
Length
Li
neText
Replaced
Description
Contains the exact position in the file of the matched string.
Application
Property: Application as Application (read-only)
Description
Access the XMLSpy application object.
Errors
3800 The object is no longer valid.
3801 Invalid address for the return parameter was specified.
Length
Property: Length as Long (read-only)
Description
Returns the length of the matched string.
Errors
3800 The object is no longer valid.
3801 Invalid address for the return parameter was specified.
Line
Property: Line as Long (read-only)
Description
Returns the line number of the match. The line numbering starts with 0.
Errors
3800 The object is no longer valid.
3801 Invalid address for the return parameter was specified.
LineText
Property: LineText as String (read-only)
Description
Returns the text of the line.
Errors
3800 The object is no longer valid.
3801 Invalid address for the return parameter was specified.
Parent
Property: Parent as FindInFilesResult (read-only)
Description
Access the parent of the object.
Errors
3800 The object is no longer valid.
3801 Invalid address for the return parameter was specified.
Position
Property: Position as Long (read-only)
Description
Returns the start position of the match in the line. The position numbering starts with 0.
Errors
3800 The object is no longer valid.
3801 Invalid address for the return parameter was specified.
Replaced
Property: Replaced as Boolean (read-only)
Description
True if the matched string was replaced.
Errors
3800 The object is no longer valid.
3801 Invalid address for the return parameter was specified.
4.3.20 FindInFilesResults
See also
Count
Item
Description
Application
Property: Application as Application (read-only)
Description
Access the XMLSpy application object.
Errors
3600 The object is no longer valid.
3601 Invalid address for the return parameter was specified.
Count
Property: Count as long (read-only)
Description
Count of elements in this collection.
Item
Method: Item(n as long) as FindInFilesResult
Description
Gets the element with the index n from this collection. The first item has index 1.
Parent
Property: Parent as Application (read-only)
Description
Access the parent of the object.
Errors
3600 The object is no longer valid.
3601 Invalid address for the return parameter was specified.
4.3.21 GenerateSampleXMLDlg
See also
NonMandatoryAttributes
RepeatCount
FillAttributesWithSampleData
FillElementsWithSampleData
ContentOfNillableElementsIsNonMandatory
TryToUseNonAbstractTypes
Optimization
SchemaOrDTDAssignment
LocalNameOfRootElement
NamespaceURIOfRootElement
OptionsDialogAction
Description
Used to set the parameters for the generation of sample XML instances based on a W3C
schema or DTD.
Application
Property: Application as Application (read-only)
Description
Access the XMLSpy application object.
Errors
2200 The object is no longer valid.
2201 Invalid address for the return parameter was specified.
Parent
Property: Parent as Dialogs (read-only)
Description
Access the parent of the object.
Errors
2200 The object is no longer valid.
2201 Invalid address for the return parameter was specified.
NonMandatoryAttributes
Property: NonMandatoryAttributes as Boolean
Description
If true attributes which are not mandatory are created in the sample XML instance file.
Errors
2200 The object is no longer valid.
2201 Invalid address for the return parameter was specified.
NonMandatoryElements - obsolete
Property: NonMandatoryElements as Boolean
Description
Do no longer use this property. Use Optimization, instead.
Errors
0001 The property is no longer accessible.
TakeFirstChoice - obsolete
Property: TakeFirstChoice as Boolean
Description
Do no longer use this property.
Errors
0001 The property is no longer accessible.
RepeatCount
Property: RepeatCount as long
Description
Number of elements to create for repeated types.
Errors
2200 The object is no longer valid.
2201 Invalid address for the return parameter was specified.
FillWithSampleData - obsolete
Description
Do no longer access this property. Use FillAttributesWithSampleData and
FillElementsWithSampleData, instead.
Errors
0001 The property is no longer accessible.
FillElementsWithSampleData
Property: FillElementsWithSampleData as Boolean
Description
If true, elements will have sample content.
Errors
2200 The object is no longer valid.
2201 Invalid address for the return parameter was specified.
FillAttributesWithSampleData
Property: FillAttributesWithSampleData as Boolean
Description
If true, attributes will have sample content.
Errors
2200 The object is no longer valid.
ContentOfNillableElementsIsNonMandatory
Property: ContentOfNillableElementsIsNonMandatory as Boolean
Description
If true, the contents of elements that are nillable will not be treated as mandatory.
Errors
2200 The object is no longer valid.
2201 Invalid address for the return parameter was specified.
TryToUseNonAbstractTypes
Property: TryToUseNonAbstractTypes as Boolean
Description
If true, tries to use a non-abstract type for xsi:type, if element has an abstract type.
Errors
2200 The object is no longer valid.
2201 Invalid address for the return parameter was specified.
Optimization
Property: Optimization as SPYSampleXMLGenerationOptimization
Description
Specifies which elements will be generated.
Errors
2200 The object is no longer valid.
2201 Invalid address for the return parameter was specified.
SchemaOrDTDAssignment
Property: SchemaOrDTDAssignment as
SPYSampleXMLGenerationSchemaOrDTDAssignment
Description
Specifies in which way a reference to the related schema or DTD - which is this document - will
be generated into the sample XML.
Errors
2200 The object is no longer valid.
2201 Invalid address for the return parameter was specified.
LocalNameOfRootElement
Property: LocalNameOfRootElement as String
Description
Specifies the local name of the root element for the generated sample XML.
Errors
NamespaceURIOfRootElement
Property: NamespaceURIOfRootElement as String
Description
Specifies the namespace URI of the root element for the generated sample XML.
Errors
2200 The object is no longer valid.
2201 Invalid address for the return parameter was specified.
OptionsDialogAction
Property: OptionsDialogAction as SPYDialogAction
Description
To allow your script to fill in the default values and let the user see and react on the dialog, set
this property to the value spyDialogUserInput(2). If you want your script to define all the options
in the schema documentation dialog without any user interaction necessary, use
spyDialogOK(0). Default is spyDialogOK.
Errors
2200 The object is no longer valid.
2201 Invalid value has been used to set the property.
Invalid address for the return parameter was specified.
4.3.22 GridView
See also
Methods
Deselect
Select
SetFocus
Properties
CurrentFocus
IsVisible
Description
GridView Class
Events
OnBeforeDrag
See also
Event: OnBeforeDrag()asBoolean
Description
This event gets fired on an attempt to drag an XMLData element on the grid view. Return false
to prevent dragging the data element to a different position.
OnBeforeDrop
See also
Description
This event gets fired on an attempt to drop a previously dragged XMLData element on the grid
view. Return false to prevent the data element to be moved from its original position to the drop
destination position.
OnBeforeStartEditing
See also
End Function
Description
This event gets fired before the editing mode for a grid cell gets entered. If the parameter
bEditingName is true, the name part of the element will be edited, it its value is false, the value
part will be edited.
OnEditingFinished
See also
Description
This event gets fired when the editing mode of a grid cell gets left. The parameter
bEditingName specifies if the name part of the element has been edited.
OnFocusChanged
See also
Description
This event gets fired whenever a grid cell receives or looses the cursor focus. If the parameter
bEditingName is true, focus of the name part of the grid element has changed. Otherwise, focus
of the value part has changed.
CurrentFocus
See also
Description
Holds the XML element with the current focus. This property is read-only.
Deselect
See also
Description
Deselects the element pData in the grid view.
IsVisible
See also
Description
True if the grid view is the active view of the document. This property is read-only.
Select
See also
Description
Selects the XML element pData in the grid view.
SetFocus
See also
Description
Sets the focus to the element pFocusData in the grid view.
4.3.23 SchemaDocumentationDlg
See also
IncludeAll
IncludeIndex
IncludeGlobalAttributes
IncludeGlobalElements
IncludeLocalAttributes
IncludeLocalElements
IncludeGroups
IncludeComplexTypes
IncludeSimpleTypes
IncludeAttributeGroups
IncludeRedefines
IncludeReferencedSchemas
AllDetails
ShowDiagram
ShowNamespace
ShowType
ShowChildren
ShowUsedBy
ShowProperties
ShowSingleFacets
ShowPatterns
ShowEnumerations
ShowAttributes
ShowIdentityConstraints
ShowAnnotations
ShowSourceCode
Description
This object combines all options for schema document generation as they are available through
user interface dialog boxes in XMLSpy. The document generation options are initialized with the
values used during the last generation of schema documentation. However, before using the
object you have to set the SetOutputFile property to a valid file path. Use
OptionsDialogAction, OutputFileDialogAction and ShowProgressBar to specify
the level of user interaction desired. You can use I
ncl
udeAl
l and All
Det
ai
l
s to set whole option
groups at once or the individual properties to operate on a finer granularity.
AllDetails
See also
Description
Use this method to turn all details options on or off.
Errors
2900 The object is no longer valid.
Application
See also
Description
Access the XMLSpy application object.
Errors
2900 The object is no longer valid.
2901 Invalid address for the return parameter was specified.
CreateDiagramsFolder
See also
Description
Set this property to t
rue , to create a directory for the created images. Otherwise the diagrams
will be created next to the documentation. This property is only available when the diagrams are
not embedded. The property is initialized with the value used during the last call to
Docum ent.G enerateW SDLDocum entation . The default for the first run is false.
Errors
2900 The object is no longer valid.
2901 Invalid address for the return parameter was specified.
DiagramFormat
See also
Description
This property specifies the generated diagram image type. This property is not available for
HTML documentation. The property is initialized with the value used during the last call to
Docum ent.G enerateSchem aDocum entation . The default for the first run is PNG.
Errors
2900 The object is no longer valid.
2901 Invalid address for the return parameter was specified.
EmbedCSSInHTML
See also
Description
Set this property to true , to embed the CSS data in the generated HTML document. Otherwise a
separate file will be created and linked. This property is only available for HTML documentation.
The property is initialized with the value used during the last call to
Docum ent.G enerateW SDLDocum entation . The default for the first run is true.
Errors
2900 The object is no longer valid.
2901 Invalid address for the return parameter was specified.
EmbedDiagrams
See also
Description
Set this property to true , to embed the diagrams in the generated document. This property is not
available for HTML documentation. The property is initialized with the value used during the last
call to Docum ent.G enerateSchem aDocum entation . The default for the first run is true.
Errors
2900 The object is no longer valid.
2901 Invalid address for the return parameter was specified.
GenerateRelativeLinks
See also
Description
Set this property to t
rue , to create relative paths to local files. This property is not available for
HTML documentation. The property is initialized with the value used during the last call to
Docum ent.G enerateSchem aDocum entation . The default for the first run is false.
Errors
2900 The object is no longer valid.
2901 Invalid address for the return parameter was specified.
IncludeAll
See also
Description
Use this method to mark or unmark all include options.
Errors
2900 The object is no longer valid.
IncludeAttributeGroups
See also
Description
Set this property to t rue , to include attribute groups in the schema documentation. The property
is initialized with the value used during the last call to
Docum ent.G enerateSchem aDocum entation . The default for the first run is true.
Errors
2900 The object is no longer valid.
2901 Invalid address for the return parameter was specified.
IncludeComplexTypes
See also
Description
Set this property to true , to include complex types in the schema documentation. The property is
initialized with the value used during the last call to Docum ent.G enerateSchem aDocum entation .
The default for the first run is true.
Errors
2900 The object is no longer valid.
2901 Invalid address for the return parameter was specified.
IncludeGlobalAttributes
See also
Description
Set this property to t rue , to include global attributes in the schema documentation. The property
is initialized with the value used during the last call to
Docum ent.G enerateSchem aDocum entation . The default for the first run is true.
Errors
2900 The object is no longer valid.
2901 Invalid address for the return parameter was specified.
IncludeGlobalElements
See also
Description
Set this property to t rue , to include global elements in the schema documentation. The property
is initialized with the value used during the last call to
Docum ent.G enerateSchem aDocum entation . The default for the first run is true.
Errors
2900 The object is no longer valid.
2901 Invalid address for the return parameter was specified.
IncludeGroups
See also
Description
Set this property to true , to include groups in the schema documentation. The property is
initialized with the value used during the last call to Docum ent.G enerateSchem aDocum entation .
The default for the first run is true.
Errors
2900 The object is no longer valid.
2901 Invalid address for the return parameter was specified.
IncludeIndex
See also
Description
Set this property to true , to include an index in the schema documentation. The property is
initialized with the value used during the last call to Docum ent.G enerateSchem aDocum entation .
Errors
2900 The object is no longer valid.
2901 Invalid address for the return parameter was specified.
IncludeLocalAttributes
See also
Description
Set this property to t rue , to include local attributes in the schema documentation. The property
is initialized with the value used during the last call to
Docum ent.G enerateSchem aDocum entation . The default for the first run is true.
Errors
2900 The object is no longer valid.
2901 Invalid address for the return parameter was specified.
IncludeLocalElements
See also
Description
Set this property to true , to include local elements in the schema documentation. The property is
initialized with the value used during the last call to Docum ent.G enerateSchem aDocum entation .
The default for the first run is true.
Errors
2900 The object is no longer valid.
2901 Invalid address for the return parameter was specified.
IncludeRedefines
See also
Description
Set this property to true , to include redefines in the schema documentation. The property is
initialized with the value used during the last call to Docum ent.G enerateSchem aDocum entation .
The default for the first run is true.
Errors
2900 The object is no longer valid.
2901 Invalid address for the return parameter was specified.
IncludeReferencedSchemas
See also
Description
Set this property to t rue , to include referenced schemas in the schema documentation. The
property is initialized with the value used during the last call to
Docum ent.G enerateSchem aDocum entation . The default for the first run is true.
Errors
2900 The object is no longer valid.
2901 Invalid address for the return parameter was specified.
IncludeSimpleTypes
See also
Description
Set this property to true , to include simple types in the schema documentation. The property is
initialized with the value used during the last call to Docum ent.G enerateSchem aDocum entation .
The default for the first run is true.
Errors
2900 The object is no longer valid.
2901 Invalid address for the return parameter was specified.
MultipleOutputFiles
See also
Description
Set this property to t
rue , to split the documentation files. The property is initialized with the value
used during the last call to Docum ent.G enerateSchem aDocum entation . The default for the first
run is false.
Errors
2900 The object is no longer valid.
2901 Invalid value has been used to set the property.
Invalid address for the return parameter was specified.
OptionsDialogAction
See also
Description
To allow your script to fill in the default values and let the user see and react on the dialog, set
this property to the value spyDialogUserInput(2). If you want your script to define all the options
in the schema documentation dialog without any user interaction necessary, use
spyDialogOK(0). Default is spyDialogOK.
Errors
OutputFileDialogAction
See also
Description
To allow the user to select the output file with a file selection dialog, set this property to
spyDialogUserInput(2). If the value stored in OutputFile should be taken and no user interaction
should occur, use spyDialogOK(0). Default is spyDialogOK.
Errors
2900 The object is no longer valid.
2901 Invalid value has been used to set the property.
Invalid address for the return parameter was specified.
OutputFormat
See also
Description
Defines the kind of documentation that will be generated: HTML (value=0), MS-Word (value=1),
or RTF (value=2). The property gets initialized with the value used during the last call to
Docum ent.G enerateSchem aDocum entation . The default for the first run is HTML.
Errors
2900 The object is no longer valid.
2901 Invalid value has been used to set the property.
Invalid address for the return parameter was specified.
Parent
See also
Description
Access the parent of the object.
Errors
2900 The object is no longer valid.
2901 Invalid address for the return parameter was specified.
SetOutputFile
See also
Property: SetOutputFile as St
ri
ng
Description
Full path and name of the file that will contain the generated documentation. In case of HTML
output, additional '.png' files will be generated based on this filename. The default value for this
property is an empty string and needs to be replaced before using this object in a call to
Docum ent.G enerateSchem aDocum entation .
Errors
2900 The object is no longer valid.
2901 Invalid address for the return parameter was specified.
ShowAnnotations
See also
Description
Set this property to t
rue , to show the annotations to a type definition in the schema
documentation. The property is initialized with the value used during the last call to
Docum ent.G enerateSchem aDocum entation . The default for the first run is true.
Errors
2900 The object is no longer valid.
2901 Invalid address for the return parameter was specified.
ShowAttributes
See also
Description
Set this property to true , to show the type definitions attributes in the schema documentation.
The property is initialized with the value used during the last call to
Docum ent.G enerateSchem aDocum entation . The default for the first run is true.
Errors
2900 The object is no longer valid.
2901 Invalid address for the return parameter was specified.
ShowChildren
See also
Description
Set this property to t
rue , to show the children of a type definition as links in the schema
documentation. The property is initialized with the value used during the last call to
Docum ent.G enerateSchem aDocum entation . The default for the first run is true.
Errors
2900 The object is no longer valid.
ShowDiagram
See also
Description
Set this property to true , to show type definitions as diagrams in the schema documentation.
The property is initialized with the value used during the last call to
Docum ent.G enerateSchem aDocum entation . The default for the first run is true.
Errors
2900 The object is no longer valid.
2901 Invalid address for the return parameter was specified.
ShowEnumerations
See also
Description
Set this property to t
rue , to show the enumerations contained in a type definition in the schema
documentation. The property is initialized with the value used during the last call to
Docum ent.G enerateSchem aDocum entation . The default for the first run is true.
Errors
2900 The object is no longer valid.
2901 Invalid address for the return parameter was specified.
ShowIdentityConstraints
See also
Description
Set this property to t
rue , to show a type definitions identity constraints in the schema
documentation. The property is initialized with the value used during the last call to
Docum ent.G enerateSchem aDocum entation . The default for the first run is true.
Errors
2900 The object is no longer valid.
2901 Invalid address for the return parameter was specified.
ShowNamespace
See also
Description
Set this property to t
rue , to show the namespace of type definitions in the schema
documentation. The property is initialized with the value used during the last call to
Docum ent.G enerateSchem aDocum entation . The default for the first run is true.
Errors
2900 The object is no longer valid.
2901 Invalid address for the return parameter was specified.
ShowPatterns
See also
Description
Set this property to true , to show the patterns of a type definition in the schema documentation.
The property is initialized with the value used during the last call to
Docum ent.G enerateSchem aDocum entation . The default for the first run is true.
Errors
2900 The object is no longer valid.
2901 Invalid address for the return parameter was specified.
ShowProgressBar
See also
Description
Set this property to t
rue , to make the window showing the document generation progress
visible. Use fse , to hide it. Default is f
al se .
al
Errors
2900 The object is no longer valid.
2901 Invalid address for the return parameter was specified.
ShowProperties
See also
Description
Set this property to true , to show the type definition properties in the schema documentation.
The property is initialized with the value used during the last call to
Docum ent.G enerateSchem aDocum entation . The default for the first run is true.
Errors
2900 The object is no longer valid.
2901 Invalid address for the return parameter was specified.
ShowResult
See also
Description
Set this property to t
rue , to automatically open the resulting document when generation was
successful. HTML documentation will be opened in XMLSpy. To show Word documentation,
MS-Word will be started. The property gets initialized with the value used during the last call to
Docum ent.G enerateSchem aDocum entation . The default for the first run is true.
Errors
2900 The object is no longer valid.
2901 Invalid address for the return parameter was specified.
ShowSingleFacets
See also
Description
Set this property to true , to show the facets of a type definition in the schema documentation.
The property is initialized with the value used during the last call to
Docum ent.G enerateSchem aDocum entation . The default for the first run is true.
Errors
2900 The object is no longer valid.
2901 Invalid address for the return parameter was specified.
ShowSourceCode
See also
Description
Set this property to t
rue , to show the XML source code for type definitions in the schema
documentation. The property is initialized with the value used during the last call to
Docum ent.G enerateSchem aDocum entation . The default for the first run is true.
Errors
2900 The object is no longer valid.
2901 Invalid address for the return parameter was specified.
ShowType
See also
Description
Set this property to t rue , to show the type of type definitions in the schema documentation. The
property is initialized with the value used during the last call to
Docum ent.G enerateSchem aDocum entation . The default for the first run is true.
Errors
2900 The object is no longer valid.
2901 Invalid address for the return parameter was specified.
ShowUsedBy
See also
Description
Set this property to t
rue , to show the used-by relation for type definitions in the schema
documentation. The property is initialized with the value used during the last call to
Docum ent.G enerateSchem aDocum entation . The default for the first run is true.
Errors
2900 The object is no longer valid.
2901 Invalid address for the return parameter was specified.
4.3.24 SpyProject
See also
Methods
CloseProject
SaveProject
SaveProjectAs
Properties
RootItems
ProjectFile
Description
ect Class
SpyProj
CloseProject
See also
Parameters
bDiscardChanges
Set bDiscardChanges to FALSE if you want to save the changes of the open project files and
the project.
bCloseFiles
Set bCloseFiles to TRUE to close all open project files.
bDialog
Show dialogs for user input.
Description
CloseProject closes the current project.
ProjectFile
See also
Description
Path and filename of the project.
RootItems
See also
Description
Root level of collection of project items.
SaveProject
See also
Declaration: SaveProject
Description
SaveProject saves the current project.
SaveProjectAs
See also
Parameters
strPath
Full path with file name of new project file.
bDialog
If bDialog is TRUE, a file-dialog will be displayed.
Description
SaveProjectAs stores the project data into a new location.
4.3.25 SpyProjectItem
See also
Methods
Open
Properties
ChildItems
ParentItem
FileExtensions
ItemType
Name
Path
ValidateWith
XMLForXSLTransformation
XSLForXMLTransformation
XSLTransformationFileExtension
XSLTransformationFolder
Description
SpyProjectItem Class
ChildItems
See also
Description
If the item is a folder, Chi
l
dItem s is the collection of the folder content.
FileExtensions
See also
Description
Used to set the file extensions if the project item is a folder.
ItemType
See also
Description
This property is read-only.
Name
See also
Description
Name of the project item. This property is read-only.
Open
See also
Return Value
The project item opened as document.
Description
Opens the project item.
ParentItem
See also
Description
Parent item of the current project item. Can be NULL (Nothing) if the project item is a top-level
item.
Path
See also
Description
Path of project item. This property is read-only.
ValidateWith
See also
Description
Used to set the schema/DTD for validation.
XMLForXSLTransformation
See also
Description
Used to set the XML for XSL transformation.
XSLForXMLTransformation
See also
Description
Used to set the XSL for XML transformation.
XSLTransformationFileExtension
See also
Description
Used to set the file extension for XSL transformation output files.
XSLTransformationFolder
See also
Description
Used to set the destination folder for XSL transformation output files.
4.3.26 SpyProjectItems
See also
Methods
AddFile
AddFolder
AddURL
RemoveItem
Properties
Count
Item
Description
SpyProjectItem s Class
AddFile
See also
Parameters
strPath
Full path with file name of new project item
Description
The method adds a new file to the collection of project items.
AddFolder
See also
Parameters
strNam e
Name of the new folder.
Description
The method AddFolder adds a folder with the name strNam e to the collection of project items.
AddURL
See also
Description
strURL
URL to open as document.
nU R LType
Type of document to open. Set to -1 for auto detection.
strUser
Name of the user if required. Can be empty.
strPassword
Password for authentification. Can be empty.
bSave
Save user and password information.
Description
The method adds an URL item to the project collection.
Count
See also
Description
This property gets the count of project items in the collection. The property is read-only.
Item
See also
Description
Retrieves the n-th element of the collection of project items. The first item has index 1.
RemoveItem
See also
Description
RemoveItem deletes the item pItem from the collection of project items.
4.3.27 TextImportExportSettings
See also
Description
TextIm portExportSetti
ngs contains options common to text import and export functions.
CommentIncluded
See also
Description
This property tells whether additional comments are added to the generated text file. Default is
true. This property is used only when exporting to text files.
DestinationFolder
See also
Description
The property DestinationFolder sets the folder where the created files are saved during
text export.
EnclosingCharacter
See also
Description
This property defines the character that encloses all field values for import and export. Default
is spyNoEnclosing.
Encoding
See also
Description
The property Encoding sets the character encoding for the text files for importing and
exporting.
EncodingByteOrder
See also
Description
The property EncodingByteOrder sets the byte order for Unicode characters. Default is spyNONE.
FieldDelimiter
See also
Description
The property FieldDelimiter defines the delimiter between the fields during import and
export. Default is spyTabulator.
FileExtension
See also
Description
This property sets the file extension for files created on text export.
HeaderRow
See also
Description
The property HeaderRow is used during import and export. Set HeaderRow true on import, if
the first line of the text file contains the names of the columns. Set HeaderRow true on export, if
the first line in the created text files should contain the name of the columns. Default value is
true.
ImportFile
See also
Description
This property is used to set the text file for import. The string has to be a full qualified path. See
also Import and Export.
RemoveDelimiter
See also
Description
The property RemoveDelimiter defines whether characters in the text that are equal to the
delimiter character are removed. Default is false. This property is used only when exporting to
text files.
RemoveNewline
See also
Description
The property RemoveNewline defines whether newline characters in the text are removed.
Default is false. This property is used only when exporting to text files.
4.3.28 TextView
See also
Application
Parent
LineFromPosition
PositionFromLine
LineLength
SelText
GetRangeText
ReplaceText
MoveCaret
GoToLineChar
SelectText
SelectionStart
SelectionEnd
Text
LineCount
Length
Description
Events
OnBeforeShowSuggestions
See also
Event: OnBeforeShowSuggestions()asBoolean
Description
This event gets fired before a suggestion window is shown. The Document property
Suggestions contains a string array that is recommended to the user. It is possible to modify the
displayed recommendations during this event. Before doing so you have to assign an empty
array to the Suggestions property. The best location for this is the OnDocumentOpened event.
To prevent the suggestion window to show up return false and true to continue its display.
Examples
Given below are examples of how this event can be scripted.
OnChar
See also
Description
This event gets fired on each key stroke. The parameter nChar is the key that was pressed and
bExistSuggestions tells whether a XMLSpy generated suggestions window is displayed after
this key. The Document property Suggestions contains a string array that is recommended to
the user. It is possible to modify the displayed recommendations during this event. Before doing
so you have to assign an empty array to the Suggestions property. The best location for this is
the OnDocumentOpened event. To prevent the suggestion window to show up return false and
Examples
Given below are examples of how this event can be scripted.
Application
Property: Application as Application (read-only)
Description
Access the XMLSpy application object.
Errors
3900 The object is no longer valid.
3901 Invalid address for the return parameter was specified.
GetRangeText
Method: GetRangeText(nStart as Long, nEnd as Long) as String
Description
Returns the text in the specified range.
Errors
3900 The object is no longer valid.
3901 Invalid address for the return parameter was specified.
GoToLineChar
Method: GoToLineChar(nLine as Long, nChar as Long)
Description
Moves the caret to the specified line and character position.
Errors
3900 The object is no longer valid.
Length
Property: Length as Long
Description
Returns the character count of the document.
Errors
3900 The object is no longer valid.
3901 Invalid address for the return parameter was specified.
LineCount
Property: LineCount as Long
Description
Returns the number of lines in the document.
Errors
3900 The object is no longer valid.
3901 Invalid address for the return parameter was specified.
LineFromPosition
Method: LineFromPosition(nCharPos as Long) as Long
Description
Returns the line number of the character position.
Errors
3900 The object is no longer valid.
3901 Invalid address for the return parameter was specified.
LineLength
Method: LineLength(nLine as Long) as Long
Description
Returns the length of the line.
Errors
3900 The object is no longer valid.
3901 Invalid address for the return parameter was specified.
MoveCaret
Method: MoveCaret(nDiff as Long)
Description
Moves the caret nDiff characters.
Errors
3900 The object is no longer valid.
3901 Invalid address for the return parameter was specified.
Parent
Property: Parent as Document (read-only)
Description
Access the parent of the object.
Errors
3900 The object is no longer valid.
3901 Invalid address for the return parameter was specified.
PositionFromLine
Method: PositionFromLine(nLine as Long) as Long
Description
Returns the start position of the line.
Errors
3900 The object is no longer valid.
3901 Invalid address for the return parameter was specified.
ReplaceText
Method: ReplaceText(nPosFrom as Long, nPosTill as Long, sText as String)
Description
Replaces the text in the specified range.
Errors
3900 The object is no longer valid.
3901 Invalid address for the return parameter was specified.
SelectionEnd
Property: SelectionEnd as Long
Description
Returns/sets the text selection end position.
Errors
3900 The object is no longer valid.
3901 Invalid address for the return parameter was specified.
SelectionStart
Property: SelectionStart as Long
Description
Returns/sets the text selection start position.
Errors
3900 The object is no longer valid.
3901 Invalid address for the return parameter was specified.
SelectText
Method: SelectText(nPosFrom as Long, nPosTill as Long)
Description
Selects the text in the specified range.
Errors
3900 The object is no longer valid.
3901 Invalid address for the return parameter was specified.
SelText
Property: SelText as String
Description
Returns/sets the selected text.
Errors
3900 The object is no longer valid.
3901 Invalid address for the return parameter was specified.
Text
Property: Text as String
Description
Returns/sets the document text.
Errors
3900 The object is no longer valid.
3901 Invalid address for the return parameter was specified.
4.3.29 WSDL20DocumentationDlg
See also
CreateDiagramsFolder
IncludeAll
IncludeBinding
IncludeImportedWSDLFiles
IncludeInterface
IncludeOverview
IncludeService
IncludeTypes
AllDetails
ShowBindingDiagram
ShowExtensibility
ShowEndpoint
ShowFault
ShowInterfaceDiagram
ShowOperation
ShowServiceDiagram
ShowSourceCode
ShowTypesDiagram
ShowUsedBy
Description
This object combines all options for WSDL document generation as they are available through
user interface dialog boxes in XMLSpy. The document generation options are initialized with the
values used during the last generation of WSDL documentation. However, before using the
object you have to set the OutputFile property to a valid file path. Use
OptionsDialogAction, OutputFileDialogAction and ShowProgressBar to specify
the level of user interaction desired. You can use I
ncl
udeAl
l and AllDetails to set whole
option groups at once or the individual properties to operate on a finer granularity.
AllDetails
See also
Description
Use this method to turn all details options on or off.
Errors
4300 The object is no longer valid.
Application
See also
Description
Access the XMLSpy application object.
Errors
4300 The object is no longer valid.
4301 Invalid address for the return parameter was specified.
CreateDiagramsFolder
See also
Description
Set this property to t
rue , to create a directory for the created images. Otherwise the diagrams
will be created next to the documentation. This property is only available when the diagrams are
not embedded. The property is initialized with the value used during the last call to
Docum ent.G enerateW SD20LDocum entation . The default for the first run is false.
Errors
4300 The object is no longer valid.
4301 Invalid address for the return parameter was specified.
DiagramFormat
See also
Description
This property specifies the generated diagram image type. This property is not available for
HTML documentation. The property is initialized with the value used during the last call to
Docum ent.G enerateW SDL20Docum entation . The default for the first run is PNG.
Errors
4300 The object is no longer valid.
4301 Invalid address for the return parameter was specified.
EmbedCSSInHTML
See also
Description
Set this property to true , to embed the CSS data in the generated HTML document. Otherwise a
separate file will be created and linked. This property is only available for HTML documentation.
The property is initialized with the value used during the last call to
Docum ent.G enerateW SDL20Docum entation . The default for the first run is true.
Errors
4300 The object is no longer valid.
4301 Invalid address for the return parameter was specified.
EmbedDiagrams
See also
Description
Set this property to t
rue , to embed the diagrams in the generated document. This property is not
available for HTML documentation. The property is initialized with the value used during the last
call to Docum ent.G enerateW SDL20Docum entation . The default for the first run is true.
Errors
4300 The object is no longer valid.
4301 Invalid address for the return parameter was specified.
IncludeAll
See also
Description
Use this method to mark or unmark all include options.
Errors
4300 The object is no longer valid.
IncludeBinding
See also
Description
Set this property to true , to include bindings in the WSDL documentation. The property is
initialized with the value used during the last call to Docum ent.G enerateW SDL20Docum entation
. The default for the first run is true.
Errors
4300 The object is no longer valid.
4301 Invalid address for the return parameter was specified.
IncludeImportedWSDLFiles
See also
Description
Set this property to t rue , to include imported WSDL finles in the WSDL documentation. The
property is initialized with the value used during the last call to
Docum ent.G enerateW SDL20Docum entation . The default for the first run is true.
Errors
4300 The object is no longer valid.
4301 Invalid address for the return parameter was specified.
IncludeInterface
See also
Description
Set this property to true , to include interfaces in the WSDL documentation. The property is
initialized with the value used during the last call to Docum ent.G enerateW SDL20Docum entation
. The default for the first run is true.
Errors
4300 The object is no longer valid.
4301 Invalid address for the return parameter was specified.
IncludeOverview
See also
Description
Set this property to true , to include an overview in the WSDL documentation. The property is
initialized with the value used during the last call to Docum ent.G enerateW SDL20Docum entation
. The default for the first run is true.
Errors
4300 The object is no longer valid.
4301 Invalid address for the return parameter was specified.
IncludeService
See also
Description
Set this property to true , to include services in the WSDL documentation. The property is
initialized with the value used during the last call to Docum ent.G enerateW SDL20Docum entation
. The default for the first run is true.
Errors
4300 The object is no longer valid.
4301 Invalid address for the return parameter was specified.
IncludeTypes
See also
Description
Set this property to t rue , to include types in the WSDL documentation. The property is initialized
with the value used during the last call to Docum ent.G enerateW SDL20Docum entation . The
default for the first run is true.
Errors
4300 The object is no longer valid.
4301 Invalid address for the return parameter was specified.
MultipleOutputFiles
See also
Description
Set this property to t
rue , to split the documentation files. The property is initialized with the value
used during the last call to Docum ent.G enerateW SDL20Docum entation . The default for the first
run is false.
Errors
4300 The object is no longer valid.
4301 Invalid value has been used to set the property.
Invalid address for the return parameter was specified.
OptionsDialogAction
See also
Description
To allow your script to fill in the default values and let the user see and react on the dialog, set
this property to the value spyDialogUserInput(2). If you want your script to define all the options
in the schema documentation dialog without any user interaction necessary, use
spyDialogOK(0). Default is spyDialogOK.
Errors
4300 The object is no longer valid.
4301 Invalid value has been used to set the property.
Invalid address for the return parameter was specified.
OutputFile
See also
Property: OutputFile as St
ri
ng
Description
Full path and name of the file that will contain the generated documentation. In case of HTML
output, additional '.png' files will be generated based on this filename. The default value for this
property is an empty string and needs to be replaced before using this object in a call to
Docum ent.G enerateW SDL20Docum entation .
Errors
OutputFileDialogAction
See also
Description
To allow the user to select the output file with a file selection dialog, set this property to
spyDialogUserInput(2). If the value stored in OutputFile should be taken and no user interaction
should occur, use spyDialogOK(0). Default is spyDialogOK.
Errors
4300 The object is no longer valid.
4301 Invalid value has been used to set the property.
Invalid address for the return parameter was specified.
OutputFormat
See also
Description
Defines the kind of documentation that will be generated: HTML (value=0), MS-Word (value=1),
or RTF (value=2). The property gets initialized with the value used during the last call to
Docum ent.G enerateW SDL20Docum entation . The default for the first run is HTML.
Errors
4300 The object is no longer valid.
4301 Invalid value has been used to set the property.
Invalid address for the return parameter was specified.
Parent
See also
Description
Access the parent of the object.
Errors
4300 The object is no longer valid.
4301 Invalid address for the return parameter was specified.
ShowBindingDiagram
See also
Description
Set this property to true , to show binding diagrams in the WSDL documentation. The property is
initialized with the value used during the last call to Docum ent.G enerateW SDL20Docum entation
. The default for the first run is true.
Errors
4300 The object is no longer valid.
4301 Invalid address for the return parameter was specified.
ShowEndpoint
See also
Description
Set this property to true , to show service endpoints in the WSDL documentation. The property is
initialized with the value used during the last call to Docum ent.G enerateW SDL20Docum entation
. The default for the first run is true.
Errors
4300 The object is no longer valid.
4301 Invalid address for the return parameter was specified.
ShowExtensibility
See also
Description
Set this property to t
rue , to show service and binding extensibilities in the WSDL
documentation. The property is initialized with the value used during the last call to
Docum ent.G enerateW SDL20Docum entation . The default for the first run is true.
Errors
4300 The object is no longer valid.
4301 Invalid address for the return parameter was specified.
ShowFault
See also
Description
Set this property to t rue , to show faults in the WSDL documentation. The property is initialized
with the value used during the last call to Docum ent.G enerateW SDL20Docum entation . The
default for the first run is true.
Errors
4300 The object is no longer valid.
4301 Invalid address for the return parameter was specified.
ShowInterfaceDiagram
See also
Description
Set this property to t rue , to show interface diagrams in the WSDL documentation. The property
is initialized with the value used during the last call to
Docum ent.G enerateW SDL20Docum entation . The default for the first run is true.
Errors
4300 The object is no longer valid.
4301 Invalid address for the return parameter was specified.
ShowOperation
See also
Description
Set this property to true , to show interface and binding operations in the WSDL documentation.
The property is initialized with the value used during the last call to
Docum ent.G enerateW SDL20Docum entation . The default for the first run is true.
Errors
4300 The object is no longer valid.
4301 Invalid address for the return parameter was specified.
ShowProgressBar
See also
Description
Set this property to t
rue , to make the window showing the document generation progress
visible. Use fse , to hide it. Default is f
al se .
al
Errors
4300 The object is no longer valid.
4301 Invalid address for the return parameter was specified.
ShowResult
See also
Description
Errors
4300 The object is no longer valid.
4301 Invalid address for the return parameter was specified.
ShowServiceDiagram
See also
Description
Set this property to true , to show service diagrams in the WSDL documentation. The property is
initialized with the value used during the last call to Docum ent.G enerateW SDL20Docum entation
. The default for the first run is true.
Errors
4300 The object is no longer valid.
4301 Invalid address for the return parameter was specified.
ShowSourceCode
See also
Description
Set this property to t rue , to show source code for the includes in the WSDL documentation. The
property is initialized with the value used during the last call to
Docum ent.G enerateW SDL20Docum entation . The default for the first run is true.
Errors
4300 The object is no longer valid.
4301 Invalid address for the return parameter was specified.
ShowTypesDiagram
See also
Description
Set this property to true , to show type diagrams in the WSDL documentation. The property is
initialized with the value used during the last call to Docum ent.G enerateW SDL20Docum entation
. The default for the first run is true.
Errors
4300 The object is no longer valid.
4301 Invalid address for the return parameter was specified.
ShowUsedBy
See also
Description
Set this property to t
rue , to show the used-by relation for types, bindings and messages
definitions in the WSDL documentation. The property is initialized with the value used during the
last call to Docum ent.G enerateW SDL20Docum entation . The default for the first run is true.
Errors
4300 The object is no longer valid.
4301 Invalid address for the return parameter was specified.
4.3.30 WSDLDocumentationDlg
See also
IncludeAll
IncludeBinding
IncludeImportedWSDLFiles
IncludeMessages
IncludeOverview
IncludePortType
IncludeService
IncludeTypes
AllDetails
ShowBindingDiagram
ShowExtensibility
ShowMessageParts
ShowPort
ShowPortTypeDiagram
ShowPortTypeOperations
ShowServiceDiagram
ShowSourceCode
ShowTypesDiagram
ShowUsedBy
Description
This object combines all options for WSDL document generation as they are available through
user interface dialog boxes in XMLSpy. The document generation options are initialized with the
values used during the last generation of WSDL documentation. However, before using the
object you have to set the OutputFile property to a valid file path. Use
OptionsDialogAction, OutputFileDialogAction and ShowProgressBar to specify
the level of user interaction desired. You can use I
ncl
udeAl
l and AllDetails to set whole
option groups at once or the individual properties to operate on a finer granularity.
AllDetails
See also
Description
Use this method to turn all details options on or off.
Errors
4300 The object is no longer valid.
Application
See also
Description
Access the XMLSpy application object.
Errors
3900 The object is no longer valid.
3901 Invalid address for the return parameter was specified.
CreateDiagramsFolder
See also
Description
Set this property to t
rue , to create a directory for the created images. Otherwise the diagrams
will be created next to the documentation. This property is only available when the diagrams are
not embedded. The property is initialized with the value used during the last call to
Docum ent.G enerateW SDLDocum entation . The default for the first run is false.
Errors
3900 The object is no longer valid.
3901 Invalid address for the return parameter was specified.
DiagramFormat
See also
Description
This property specifies the generated diagram image type. This property is not available for
HTML documentation. The property is initialized with the value used during the last call to
Docum ent.G enerateW SDLDocum entation . The default for the first run is PNG.
Errors
3900 The object is no longer valid.
3901 Invalid address for the return parameter was specified.
EmbedCSSInHTML
See also
Description
Set this property to true , to embed the CSS data in the generated HTML document. Otherwise a
separate file will be created and linked. This property is only available for HTML documentation.
The property is initialized with the value used during the last call to
Docum ent.G enerateW SDLDocum entation . The default for the first run is true.
Errors
3900 The object is no longer valid.
3901 Invalid address for the return parameter was specified.
EmbedDiagrams
See also
Description
Set this property to t
rue , to embed the diagrams in the generated document. This property is not
available for HTML documentation. The property is initialized with the value used during the last
call to Docum ent.G enerateW SDLDocum entation . The default for the first run is true.
Errors
3900 The object is no longer valid.
3901 Invalid address for the return parameter was specified.
IncludeAll
See also
Description
Use this method to mark or unmark all include options.
Errors
4300 The object is no longer valid.
IncludeBinding
See also
Description
Set this property to true , to include bindings in the WSDL documentation. The property is
initialized with the value used during the last call to Docum ent.G enerateW SDLDocum entation .
The default for the first run is true.
Errors
3900 The object is no longer valid.
3901 Invalid address for the return parameter was specified.
IncludeImportedWSDLFiles
See also
Description
Set this property to t rue , to include imported WSDL finles in the WSDL documentation. The
property is initialized with the value used during the last call to
Docum ent.G enerateW SDLDocum entation . The default for the first run is true.
Errors
3900 The object is no longer valid.
3901 Invalid address for the return parameter was specified.
IncludeMessages
See also
Description
Set this property to true , to include messages in the WSDL documentation. The property is
initialized with the value used during the last call to Docum ent.G enerateW SDLDocum entation .
The default for the first run is true.
Errors
3900 The object is no longer valid.
3901 Invalid address for the return parameter was specified.
IncludeOverview
See also
Description
Set this property to true , to include an overview in the WSDL documentation. The property is
initialized with the value used during the last call to Docum ent.G enerateW SDLDocum entation .
The default for the first run is true.
Errors
3900 The object is no longer valid.
3901 Invalid address for the return parameter was specified.
IncludePortType
See also
Description
Set this property to true , to include port types in the WSDL documentation. The property is
initialized with the value used during the last call to Docum ent.G enerateW SDLDocum entation .
The default for the first run is true.
Errors
3900 The object is no longer valid.
3901 Invalid address for the return parameter was specified.
IncludeService
See also
Description
Set this property to true , to include services in the WSDL documentation. The property is
initialized with the value used during the last call to Docum ent.G enerateW SDLDocum entation .
The default for the first run is true.
Errors
3900 The object is no longer valid.
3901 Invalid address for the return parameter was specified.
IncludeTypes
See also
Description
Set this property to t rue , to include types in the WSDL documentation. The property is initialized
with the value used during the last call to Docum ent.G enerateW SDLDocum entation . The
default for the first run is true.
Errors
3900 The object is no longer valid.
3901 Invalid address for the return parameter was specified.
MultipleOutputFiles
See also
Description
Set this property to t
rue , to split the documentation files. The property is initialized with the value
used during the last call to Docum ent.G enerateW SDLDocum entation . The default for the first
run is false.
Errors
3900 The object is no longer valid.
3901 Invalid value has been used to set the property.
Invalid address for the return parameter was specified.
OptionsDialogAction
See also
Description
To allow your script to fill in the default values and let the user see and react on the dialog, set
this property to the value spyDialogUserInput(2). If you want your script to define all the options
in the schema documentation dialog without any user interaction necessary, use
spyDialogOK(0). Default is spyDialogOK.
Errors
3900 The object is no longer valid.
3901 Invalid value has been used to set the property.
Invalid address for the return parameter was specified.
OutputFile
See also
Property: OutputFile as St
ri
ng
Description
Full path and name of the file that will contain the generated documentation. In case of HTML
output, additional '.png' files will be generated based on this filename. The default value for this
property is an empty string and needs to be replaced before using this object in a call to
Docum ent.G enerateW SDLDocum entation .
Errors
3900 The object is no longer valid.
OutputFileDialogAction
See also
Description
To allow the user to select the output file with a file selection dialog, set this property to
spyDialogUserInput(2). If the value stored in OutputFile should be taken and no user interaction
should occur, use spyDialogOK(0). Default is spyDialogOK.
Errors
3900 The object is no longer valid.
3901 Invalid value has been used to set the property.
Invalid address for the return parameter was specified.
OutputFormat
See also
Description
Defines the kind of documentation that will be generated: HTML (value=0), MS-Word (value=1),
or RTF (value=2). The property gets initialized with the value used during the last call to
Docum ent.G enerateW SDLDocum entation . The default for the first run is HTML.
Errors
3900 The object is no longer valid.
3901 Invalid value has been used to set the property.
Invalid address for the return parameter was specified.
Parent
See also
Description
Access the parent of the object.
Errors
3900 The object is no longer valid.
3901 Invalid address for the return parameter was specified.
ShowBindingDiagram
See also
Description
Set this property to true , to show binding diagrams in the WSDL documentation. The property is
initialized with the value used during the last call to Docum ent.G enerateW SDLDocum entation .
The default for the first run is true.
Errors
3900 The object is no longer valid.
3901 Invalid address for the return parameter was specified.
ShowExtensibility
See also
Description
Set this property to t
rue , to show service and binding extensibilities in the WSDL
documentation. The property is initialized with the value used during the last call to
Docum ent.G enerateW SDLDocum entation . The default for the first run is true.
Errors
3900 The object is no longer valid.
3901 Invalid address for the return parameter was specified.
ShowMessageParts
See also
Description
Set this property to t rue , to show message parts of messges in the WSDL documentation. The
property is initialized with the value used during the last call to
Docum ent.G enerateW SDLDocum entation . The default for the first run is true.
Errors
3900 The object is no longer valid.
3901 Invalid address for the return parameter was specified.
ShowPort
See also
Description
Set this property to true , to show service ports in the WSDL documentation. The property is
initialized with the value used during the last call to Docum ent.G enerateW SDLDocum entation .
The default for the first run is true.
Errors
3900 The object is no longer valid.
3901 Invalid address for the return parameter was specified.
ShowPortTypeDiagram
See also
Description
Set this property to t rue , to show port type diagrams in the WSDL documentation. The property
is initialized with the value used during the last call to Docum ent.G enerateW SDLDocum entation
. The default for the first run is true.
Errors
3900 The object is no longer valid.
3901 Invalid address for the return parameter was specified.
ShowPortTypeOperations
See also
Description
Set this property to t rue , to show port type operations in the WSDL documentation. The property
is initialized with the value used during the last call to Docum ent.G enerateW SDLDocum entation
. The default for the first run is true.
Errors
3900 The object is no longer valid.
3901 Invalid address for the return parameter was specified.
ShowProgressBar
See also
Description
Set this property to t
rue , to make the window showing the document generation progress
visible. Use fse , to hide it. Default is f
al se .
al
Errors
3900 The object is no longer valid.
3901 Invalid address for the return parameter was specified.
ShowResult
See also
Description
Set this property to t
rue , to automatically open the resulting document when generation was
successful. HTML documentation will be opened in XMLSpy. To show Word documentation,
MS-Word will be started. The property gets initialized with the value used during the last call to
Docum ent.G enerateW SDLDocum entation . The default for the first run is true.
Errors
3900 The object is no longer valid.
3901 Invalid address for the return parameter was specified.
ShowServiceDiagram
See also
Description
Set this property to true , to show service diagrams in the WSDL documentation. The property is
initialized with the value used during the last call to Docum ent.G enerateW SDLDocum entation .
The default for the first run is true.
Errors
3900 The object is no longer valid.
3901 Invalid address for the return parameter was specified.
ShowSourceCode
See also
Description
Set this property to t rue , to show source code for the includes in the WSDL documentation. The
property is initialized with the value used during the last call to
Docum ent.G enerateW SDLDocum entation . The default for the first run is true.
Errors
3900 The object is no longer valid.
3901 Invalid address for the return parameter was specified.
ShowTypesDiagram
See also
Description
Set this property to true , to show type diagrams in the WSDL documentation. The property is
initialized with the value used during the last call to Docum ent.G enerateW SDLDocum entation .
The default for the first run is true.
Errors
3900 The object is no longer valid.
3901 Invalid address for the return parameter was specified.
ShowUsedBy
See also
Description
Set this property to t
rue , to show the used-by relation for types, bindings and messages
definitions in the WSDL documentation. The property is initialized with the value used during the
last call to Docum ent.G enerateW SDLDocum entation . The default for the first run is true.
Errors
3900 The object is no longer valid.
3901 Invalid address for the return parameter was specified.
4.3.31 XBRLDocumentationDlg
See also
IncludeAll
IncludeOverview
IncludeNamespacePrefixes
IncludeGlobalElements
IncludeDefinitionLinkroles
IncludePresentationLinkroles
IncludeCalculationLinkroles
AllDetails
ShowDiagram
ShowSubstitutiongroup
ShowItemtype
ShowBalance
ShowPeriod
ShowAbstract
ShowNillable
ShowLabels
ShowReferences
ShowLinkbaseReferences
ShortQualifiedName
ShowImportedElements
Description
This object combines all options for XBRL document generation as they are available through
user interface dialog boxes in XMLSpy. The document generation options are initialized with the
values used during the last generation of XBRL documentation. However, before using the
object you have to set the OutputFile property to a valid file path. Use
OptionsDialogAction, OutputFileDialogAction and ShowProgressBar to specify
the level of user interaction desired. You can use I
ncl
udeAl
l and All
Det
ai
l
s to set whole option
groups at once or the individual properties to operate on a finer granularity.
AllDetails
See also
Description
Use this method to turn all details options on or off.
Errors
4400 The object is no longer valid.
Application
See also
Description
Access the XMLSpy application object.
Errors
4400 The object is no longer valid.
4401 Invalid address for the return parameter was specified.
CreateDiagramsFolder
See also
Description
Set this property to t
rue , to create a directory for the created images. Otherwise the diagrams
will be created next to the documentation. This property is only available when the diagrams are
not embedded. The property is initialized with the value used during the last call to
Docum ent.G enerateXBRLDocum entation . The default for the first run is false.
Errors
4400 The object is no longer valid.
4401 Invalid address for the return parameter was specified.
DiagramFormat
See also
Description
This property specifies the generated diagram image type. This property is not available for
HTML documentation. The property is initialized with the value used during the last call to
Docum ent.G enerateXBRLDocum entation . The default for the first run is PNG.
Errors
4400 The object is no longer valid.
4401 Invalid address for the return parameter was specified.
EmbedCSSInHTML
See also
Description
Set this property to true , to embed the CSS data in the generated HTML document. Otherwise a
separate file will be created and linked. This property is only available for HTML documentation.
The property is initialized with the value used during the last call to
Docum ent.G enerateXBRLDocum entation . The default for the first run is true.
Errors
4400 The object is no longer valid.
4401 Invalid address for the return parameter was specified.
EmbedDiagrams
See also
Description
Set this property to true , to embed the diagrams in the generated document. This property is not
available for HTML documentation. The property is initialized with the value used during the last
call to Docum ent.G enerateXBRLDocum entation . The default for the first run is true.
Errors
4400 The object is no longer valid.
4401 Invalid address for the return parameter was specified.
IncludeAll
See also
Description
Use this method to mark or unmark all include options.
Errors
4400 The object is no longer valid.
IncludeCalculationLinkroles
See also
Description
Set this property to t rue , to include calculation linkroles in the XBRL documentation. The
property is initialized with the value used during the last call to
Docum ent.G enerateXBRLDocum entation . The default for the first run is true.
Errors
4400 The object is no longer valid.
4401 Invalid address for the return parameter was specified.
IncludeDefinitionLinkroles
See also
Description
Set this property to t rue , to include definition linkroles in the XBRL documentation. The property
is initialized with the value used during the last call to Docum ent.G enerateXBRLDocum entation .
The default for the first run is true.
Errors
4400 The object is no longer valid.
4401 Invalid address for the return parameter was specified.
IncludeGlobalElements
See also
Description
Set this property to true , to include global elements in the XBRL documentation. The property is
initialized with the value used during the last call to Docum ent.G enerateXBRLDocum entation .
The default for the first run is true.
Errors
4400 The object is no longer valid.
4401 Invalid address for the return parameter was specified.
IncludeNamespacePrefixes
See also
Description
Set this property to t rue , to include namespace prefixes in the XBRL documentation. The
property is initialized with the value used during the last call to
Docum ent.G enerateXBRLDocum entation . The default for the first run is true.
Errors
4400 The object is no longer valid.
4401 Invalid address for the return parameter was specified.
IncludeOverview
See also
Description
Set this property to true , to include an overview in the XBRL documentation. The property is
initialized with the value used during the last call to Docum ent.G enerateXBRLDocum entation .
The default for the first run is true.
Errors
4400 The object is no longer valid.
4401 Invalid address for the return parameter was specified.
IncludePresentationLinkroles
See also
Description
Set this property to t rue , to include presentation linkroles in the XBRL documentation. The
property is initialized with the value used during the last call to
Docum ent.G enerateXBRLDocum entation . The default for the first run is true.
Errors
4400 The object is no longer valid.
4401 Invalid address for the return parameter was specified.
OptionsDialogAction
See also
Description
To allow your script to fill in the default values and let the user see and react on the dialog, set
this property to the value spyDialogUserInput(2). If you want your script to define all the options
in the schema documentation dialog without any user interaction necessary, use
spyDialogOK(0). Default is spyDialogOK.
Errors
4400 The object is no longer valid.
4401 Invalid value has been used to set the property.
Invalid address for the return parameter was specified.
OutputFile
See also
Property: OutputFile as St
ri
ng
Description
Full path and name of the file that will contain the generated documentation. In case of HTML
output, additional '.png' files will be generated based on this filename. The default value for this
property is an empty string and needs to be replaced before using this object in a call to
Docum ent.G enerateXBRLDocum entation .
Errors
4400 The object is no longer valid.
4401 Invalid address for the return parameter was specified.
OutputFileDialogAction
See also
Description
To allow the user to select the output file with a file selection dialog, set this property to
spyDialogUserInput(2). If the value stored in OutputFile should be taken and no user interaction
should occur, use spyDialogOK(0). Default is spyDialogOK.
Errors
4400 The object is no longer valid.
4401 Invalid value has been used to set the property.
Invalid address for the return parameter was specified.
OutputFormat
See also
Description
Defines the kind of documentation that will be generated: HTML (value=0), MS-Word (value=1),
or RTF (value=2). The property gets initialized with the value used during the last call to
Docum ent.G enerateXBRLDocum entation . The default for the first run is HTML.
Errors
Parent
See also
Description
Access the parent of the object.
Errors
4400 The object is no longer valid.
4401 Invalid address for the return parameter was specified.
ShortQualifiedName
See also
Description
Set this property to t rue , to use short qualified names in the XBRL documentation. The property
is initialized with the value used during the last call to Docum ent.G enerateXBRLDocum entation .
The default for the first run is true.
Errors
4400 The object is no longer valid.
4401 Invalid address for the return parameter was specified.
ShowAbstract
See also
Description
Set this property to true , to show abstracts in the XBRL documentation. The property is
initialized with the value used during the last call to Docum ent.G enerateXBRLDocum entation .
The default for the first run is true.
Errors
4400 The object is no longer valid.
4401 Invalid address for the return parameter was specified.
ShowBalance
See also
Description
Set this property to true , to show balances in the XBRL documentation. The property is
initialized with the value used during the last call to Docum ent.G enerateXBRLDocum entation .
The default for the first run is true.
Errors
4400 The object is no longer valid.
4401 Invalid address for the return parameter was specified.
ShowDiagram
See also
Description
Set this property to true , to show diagrams in the XBRL documentation. The property is
initialized with the value used during the last call to Docum ent.G enerateXBRLDocum entation .
The default for the first run is true.
Errors
4400 The object is no longer valid.
4401 Invalid address for the return parameter was specified.
ShowImportedElements
See also
Description
Set this property to t rue , to show imported elements in the XBRL documentation. The property
is initialized with the value used during the last call to Docum ent.G enerateXBRLDocum entation .
The default for the first run is true.
Errors
4400 The object is no longer valid.
4401 Invalid address for the return parameter was specified.
ShowItemtype
See also
Description
Set this property to true , to show item types in the XBRL documentation. The property is
initialized with the value used during the last call to Docum ent.G enerateXBRLDocum entation .
The default for the first run is true.
Errors
4400 The object is no longer valid.
4401 Invalid address for the return parameter was specified.
ShowLabels
See also
Description
Set this property to t rue , to show labels in the XBRL documentation. The property is initialized
with the value used during the last call to Docum ent.G enerateXBRLDocum entation . The default
for the first run is true.
Errors
4400 The object is no longer valid.
4401 Invalid address for the return parameter was specified.
ShowLinkbaseReferences
See also
Description
Set this property to t rue , to show linkbase references in the XBRL documentation. The property
is initialized with the value used during the last call to Docum ent.G enerateXBRLDocum entation .
The default for the first run is true.
Errors
4400 The object is no longer valid.
4401 Invalid address for the return parameter was specified.
ShowNillable
See also
Description
Set this property to true , to show nillable properties in the XBRL documentation. The property is
initialized with the value used during the last call to Docum ent.G enerateXBRLDocum entation .
The default for the first run is true.
Errors
4400 The object is no longer valid.
4401 Invalid address for the return parameter was specified.
ShowPeriod
See also
Description
Set this property to t rue , to show periods in the XBRL documentation. The property is initialized
with the value used during the last call to Docum ent.G enerateXBRLDocum entation . The default
for the first run is true.
Errors
4400 The object is no longer valid.
4401 Invalid address for the return parameter was specified.
ShowProgressBar
See also
Description
Set this property to t
rue , to make the window showing the document generation progress
visible. Use fse , to hide it. Default is f
al se .
al
Errors
4400 The object is no longer valid.
4401 Invalid address for the return parameter was specified.
ShowReferences
See also
Description
Set this property to true , to show references in the XBRL documentation. The property is
initialized with the value used during the last call to Docum ent.G enerateXBRLDocum entation .
The default for the first run is true.
Errors
4400 The object is no longer valid.
4401 Invalid address for the return parameter was specified.
ShowResult
See also
Description
Set this property to t
rue , to automatically open the resulting document when generation was
successful. HTML documentation will be opened in XMLSpy. To show Word documentation,
MS-Word will be started. The property gets initialized with the value used during the last call to
Docum ent.G enerateXBRLDocum entation . The default for the first run is true.
Errors
4400 The object is no longer valid.
ShowSubstitutiongroup
See also
Description
Set this property to t rue , to show substitution groups in the XBRL documentation. The property
is initialized with the value used during the last call to Docum ent.G enerateXBRLDocum entation .
The default for the first run is true.
Errors
4400 The object is no longer valid.
4401 Invalid address for the return parameter was specified.
4.3.32 XMLData
See also
Properties
Kind
Name
TextValue
HasChildren
MayHaveChildren
Parent
Methods
GetFirstChild
GetNextChild
GetCurrentChild
InsertChild
AppendChild
EraseAllChildren
EraseCurrentChild
IsSameNode
CountChildren
CountChildrenKind
GetChild
GetChildKind
HasChildrenKind
Description
The XMLData interface provides direct XML-level access to a document. You can read and
directly modify the XML representation of the document. However, please, note the following
restrictions:
The XMLData representation is only valid when the document is shown in grid view or
authentic view.
When in authentic view, additional XMLData elements are automatically inserted as
parents of each visible document element. Typically this is an XMLData of kind
spyXM LDataElem ent with the Name property set to 'Text'.
When you use the XMLData interface while in a different view mode you will not receive
errors, but changes are not reflected to the view and might get lost during the next view
switch.
Note also:
Setting a new text value for an XML element is possible if the element does not have
non-text children. A text value can be set even if the element has attributes.
When setting a new text value for an XML element which has more than one text child,
the latter will be deleted and replaced by one new text child.
When reading the text value of an XML element which has more than one text child,
only the value of the first text child will be returned.
Objects of this class represent the different atomic parts of an XML document. See the
enumeration type SPYXM LD ataKind for the available part types. Each part knows its children,
thus forming a XMLData tree with Docum ent.RootElem ent at its top. To get the top element of
the document content - ignoring the XML header - use Docum ent.DataRoot . For examples on
how to traverse the XMLData tree see Using XM LData to m odifydocum entstructure and
GetNextChild .
AppendChild
See also
Description
AppendChild appends pNewD ata as last child to the XM LD ata object. See also Using XMLData.
Errors
1500 The XMLData object is no longer valid.
1505 Invalid XMLData kind was specified.
1506 Invalid address for the return parameter was specified.
1507 Element cannot have Children
1512 Cyclic insertion - new data element is already part of document
1514 Invalid XMLData kind was specified for this position.
1900 Document must not be modified
Example
Dim objCurrentParent As XMLData
Dim objNewChild As XMLData
objCurrentParent.AppendChild objNewChild
CountChildren
See also
Description
CountChi
l
dren gets the number of children.
Errors
1500 The XMLData object is no longer valid.
CountChildrenKind
See also
Description
CountChildrenKind gets the number of children of the specific kind.
Errors
1500 The XMLData object is no longer valid.
EraseAllChildren
See also
Declaration: EraseAllChildren
Description
EraseAl
l
Chi
l
dren deletes all associated children of the XM LD ata object.
Errors
1500 The XMLData object is no longer valid.
1900 Document must not be modified
Example
The sample erases all elements of the active document.
EraseChild
Method: EraseChild (Child node and new node as XMLData)
Description
Deletes the given child node.
Errors
1500 Invalid object.
1506 Invalid input xml
1510 Invalid parameter.
EraseCurrentChild
See also
Declaration: EraseCurrentChild
Description
EraseCurrentChil
d deletes the current XM LD ata child object. Before you call EraseCurrentChi
l
d
you must initialize an internal iterator with XMLData.GetFirstChild. After deleting the
current child, EraseCurrentChil
d increments the internal iterator of the XMLData element. No
error is returned when the last child gets erased and the iterator is moved past the end of the
child list. The next call to EraseCurrentChi
l
d however, will return error 1503.
Errors
1500 The XMLData object is no longer valid.
1503 No iterator is initialized for this XMLData object, or the iterator points past
the last child.
1900 Document must not be modified
Examples
// ---------------------------------------
// XMLSpy scripting environment - JScript
// erase all children of XMLData
// ---------------------------------------
// let's get an XMLData element, we assume that the
// cursor selects the parent of a list in grid view
var objList = Application.ActiveDocument.GridView.CurrentFocus;
GetChild
See also
Return Value
Returns an XML element as XM LD ata object.
Description
d() returns a reference to the child at the given index (zero-based).
GetChi
l
Errors
1500 The XMLData object is no longer valid.
1510 Invalid address for the return parameter was specified.
GetChildAttribute
Method: GetChildAttribute (Name as string) as XMLData object (NULL on error)
Description
Retrieves the attribute having the given name.
Errors
1500 Invalid object.
1510 Invalid parameter.
GetChildElement
Method: GetChildElement (Name as string, position as integer) as XMLData object (NULL
on error)
Description
Retrieves the Nth child element with the given name.
Errors
1500 Invalid object.
1510 Invalid parameter.
GetChildKind
See also
Return Value
Returns an XML element as XM LD ata object.
Description
GetChil
dKi
nd() returns a reference to a child of this kind at the given index (zero-based). The
position parameter is relative to the number of children of the specified kind and not to all
children of the object.
Errors
1500 The XMLData object is no longer valid.
1510 Invalid address for the return parameter was specified.
GetCurrentChild
See also
Return Value
Returns an XML element as XM LD ata object.
Description
GetCurrentChil
d gets the current child. Before you call GetCurrentChi
l
d you must initialize an
internal iterator with XMLData.GetFirstChild.
Errors
1500 The XMLData object is no longer valid.
1503 No iterator is initialized for this XMLData object.
1510 Invalid address for the return parameter was specified.
GetFirstChild
See also
Return Value
Returns an XML element as XM LD ata object.
Description
GetFi
rstChi
l
d initializes a new iterator and returns the first child. Set nKind = -1 to get an iterator
for all kinds of children.
REMARK: The iterator is stored inside the XMLData object and gets destroyed when the
XMLData object gets destroyed. Be sure to keep a reference to this object as long as you want
to use GetCurrentChi ld , GetNextChild or EraseCurrentChi
l
d .
Errors
1500 The XMLData object is no longer valid.
1501 Invalid XMLData kind was specified.
1504 Element has no children of specified kind.
1510 Invalid address for the return parameter was specified.
Example
See the example at XMLData.GetNextChild.
GetNamespacePrefixForURI
Method: GetNamespacePrefixForURI (URI as string) Prefix as string
Description
Returns the namespace prefix of the supplied URI.
Errors
1500 Invalid object.
1510 Invalid parameter.
GetNextChild
See also
Return Value
Returns an XML element as XM LD ata object.
Description
GetNextChild steps to the next child of this element. Before you call GetNextChild you must
initialize an internal iterator with XMLData.GetFirstChild.
Check for the last child of the element as shown in the sample below.
Errors
1500 The XMLData object is no longer valid.
1503 No iterator is initialized for this XMLData object.
1510 Invalid address for the return parameter was specified.
Examples
' ----------------------------------------------
' VBA code snippet - iterate XMLData children
' ----------------------------------------------
On Error Resume Next
Set objParent = objSpy.ActiveDocument.RootElement
Do
'do something useful with the child
// ---------------------------------------
// XMLSpy scripting environment - JScript
// iterate through children of XMLData
// ---------------------------------------
try
{
var objXMLData = ... // initialize somehow
var objChild = objXMLData.GetFirstChild(-1);
while (true)
{
// do something usefull with objChild
objChild = objXMLData.GetNextChild();
}
}
catch (err)
{
if ((err.number & 0xffff) == 1504)
; // element has no children
else if ((err.number & 0xffff) == 1503)
;// last child reached
else
throw (err);
}
GetTextValueXMLDecoded
Method: GetTextValueXMLDecoded as string
Description
Gets the decoded text value of the XML.
Errors
1500 Invalid object.
1510 Invalid parameter.
HasChildren
See also
Description
The property is true if the object is the parent of other XM LD ata objects. This property is
read-only.
Errors
1500 The XMLData object is no longer valid.
1510 Invalid address for the return parameter was specified.
HasChildrenKind
See also
Description
The method returns true if the object is the parent of other XM LD ata objects of the specific kind.
Errors
InsertChild
See also
Description
I
nsert
Chi
l
d inserts the new child before the current child (see also XMLData.GetFirstChild,
XMLData.GetNextChild to set the current child).
Errors
1500 The XMLData object is no longer valid.
1503 No iterator is initialized for this XMLData object.
1505 Invalid XMLData kind was specified.
1506 Invalid address for the return parameter was specified.
1507 Element cannot have Children
1512 Cyclic insertion - new data element is already part of document
1514 Invalid XMLData kind was specified for this position.
1900 Document must not be modified
Examples
See Using XM LData to m odifydocum entstructure .
InsertChildAfter
Method: InsertChildAfter (Child node and new node as XMLData)
Description
Inserts a new XML node after the given node.
Errors
1500 Invalid object.
1506 Invalid input xml
1507 No children allowed
1510 Invalid parameter.
1512 Child is already added
1514 Invalid kind at position
InsertChildBefore
Method: InsertChildBefore (Child node and new node as XMLData)
Description
Inserts a new XML node before the given node.
Errors
1500 Invalid object.
1506 Invalid input xml
1507 No children allowed
1510 Invalid parameter.
IsSameNode
See also
Description
Returns true if pN odeToC om pare references the same node as the object itself.
Errors
1500 The XMLData object is no longer valid.
1506 Invalid address for the return parameter was specified.
Kind
See also
Description
Kind of this XM LD ata object. This property is read-only.
Errors
1500 The XMLData object is no longer valid.
1510 Invalid address for the return parameter was specified.
MayHaveChildren
See also
Description
Indicates whether it is allowed to add children to this XM LD ata object.
This property is read-only.
Errors
1500 The XMLData object is no longer valid.
1510 Invalid address for the return parameter was specified.
Name
See also
Description
Used to modify and to get the name of the XM LD ata object.
Errors
1500 The XMLData object is no longer valid.
1510 Invalid address for the return parameter was specified.
Parent
See also
Return value
Parent as XM LD ata object. Nothing (or NULL) if there is no parent element.
Description
Parent of this element. This property is read-only.
Errors
1500 The XMLData object is no longer valid.
1510 Invalid address for the return parameter was specified.
SetTextValueXMLDecoded
Method: SetTextValueXMLDecoded ( string value)
Description
Sets the encoded text value of the XML.
Errors
1500 Invalid object.
1513 Modification not allowed.
TextValue
See also
Description
Used to modify and to get the text value of this XM LD ata object.
Errors
1500 The XMLData object is no longer valid.
1510 Invalid address for the return parameter was specified.
Examples
See Using XM LData to m odifydocum entstructure .
For examples on migrating from DocEdit to Authentic see the description of the different
methods and properties of the different DocEdit objects.
See also
Properties
altKey
altLeft
ctrlKey
ctrlLeft
shiftKey
shiftLeft
keyCode
repeat
button
clientX
clientY
dataTransfer
srcElement
fromElement
propertyName
cancelBubble
returnValue
type
Description
DocEditEvent interface.
altKey (obsolete)
Superseded by parameters to
AuthenticView.OnKeyboardEvent (On_AuthenticView_KeyPressed)
AuthenticView.OnMouseEvent (On_AuthenticView_MouseEvent)
AuthenticView.OnDragOver (On_AuthenticView_DragOver)
The event object that holds the information of the last event is now replaced by parameters to
the different event handler functions to simplify data access. The event object will be
supported for a not yet defined period of time for compatibility reasons. No improvements are
planned. It is highly recommended to migrate to the new event handler functions.
See also
Description
True if the right ALT key is pressed.
altLeft (obsolete)
Superseded by parameters to
AuthenticView.OnKeyboardEvent (On_AuthenticView_KeyPressed)
AuthenticView.OnMouseEvent (On_AuthenticView_MouseEvent)
AuthenticView.OnDragOver (On_AuthenticView_DragOver)
The event object that holds the information of the last event is now replaced by parameters to
the different event handler functions to simplify data access. The event object will be
supported for a not yet defined period of time for compatibility reasons. No improvements are
planned. It is highly recommended to migrate to the new event handler functions.
See also
Description
True if the left ALT key is pressed.
button (obsolete)
Superseded by parameters to
AuthenticView.OnMouseEvent (On_AuthenticView_MouseEvent)
AuthenticView.OnDragOver (On_AuthenticView_DragOver)
The event object that holds the information of the last event is now replaced by parameters to
the different event handler functions to simplify data access. The event object will be
supported for a not yet defined period of time for compatibility reasons. No improvements are
planned. It is highly recommended to migrate to the new event handler functions.
See also
Description
Specifies which mouse button is pressed:
0 No button is pressed.
1 Left button is pressed.
2 Right button is pressed.
3 Left and right buttons are both pressed.
4 Middle button is pressed.
5 Left and middle buttons both are pressed.
6 Right and middle buttons are both pressed.
7 All three buttons are pressed.
cancelBubble (obsolete)
Returning true from an event handler function signals that the event has beend handled and
normal event handling should be aborted.
See also
Description
Set cancelBubble to TRUE if the default event handler should not be called.
clientX (obsolete)
Superseded by parameters to
AuthenticView.OnMouseEvent (On_AuthenticView_MouseEvent)
AuthenticView.OnBeforeDrop (On_AuthenticView_BeforeDrop)
AuthenticView.OnDragOver (On_AuthenticView_DragOver)
The event object that holds the information of the last event is now replaced by parameters to
the different event handler functions to simplify data access. The event object will be
supported for a not yet defined period of time for compatibility reasons. No improvements are
planned. It is highly recommended to migrate to the new event handler functions.
See also
Description
X value of the current mouse position in client coordinates.
clientY (obsolete)
Superseded by parameters to
AuthenticView.OnMouseEvent (On_AuthenticView_MouseEvent)
AuthenticView.OnBeforeDrop (On_AuthenticView_BeforeDrop)
AuthenticView.OnDragOver (On_AuthenticView_DragOver)
The event object that holds the information of the last event is now replaced by parameters to
the different event handler functions to simplify data access. The event object will be
supported for a not yet defined period of time for compatibility reasons. No improvements are
planned. It is highly recommended to migrate to the new event handler functions.
See also
Description
Y value of the current mouse position in client coordinates.
ctrlKey (obsolete)
Superseded by parameters to
AuthenticView.OnKeyboardEvent (On_AuthenticView_KeyPressed)
AuthenticView.OnMouseEvent (On_AuthenticView_MouseEvent)
AuthenticView.OnDragOver (On_AuthenticView_DragOver)
The event object that holds the information of the last event is now replaced by parameters to
the different event handler functions to simplify data access. The event object will be
supported for a not yet defined period of time for compatibility reasons. No improvements are
planned. It is highly recommended to migrate to the new event handler functions.
See also
Description
True if the right CTRL key is pressed.
ctrlLeft (obsolete)
Superseded by parameters to
AuthenticView.OnKeyboardEvent (On_AuthenticView_KeyPressed)
AuthenticView.OnMouseEvent (On_AuthenticView_MouseEvent)
AuthenticView.OnDragOver (On_AuthenticView_DragOver)
The event object that holds the information of the last event is now replaced by parameters to
the different event handler functions to simplify data access. The event object will be
supported for a not yet defined period of time for compatibility reasons. No improvements are
planned. It is highly recommended to migrate to the new event handler functions.
See also
Description
True if the left CTRL key is pressed.
dataTransfer (obsolete)
Superseded by parameters to
AuthenticView.OnBeforeDrop (On_AuthenticView_BeforeDrop)
AuthenticView.OnDragOver (On_AuthenticView_DragOver)
The event object that holds the information of the last event is now replaced by parameters to
the different event handler functions to simplify data access. The event object will be
supported for a not yet defined period of time for compatibility reasons. No improvements are
planned. It is highly recommended to migrate to the new event handler functions.
return false;
}
See also
Description
Property dataTransfer.
fromElement (obsolete)
Not supported
See also
Description
Currently no event sets this property.
keyCode (obsolete)
See also
Description
Keycode of the currently pressed key. This property is read-write.
propertyName (obsolete)
Not supported
See also
Description
Currently no event sets this property.
repeat (obsolete)
Not supported
See also
Description
True if the onkeydown event is repeated.
returnValue (obsolete)
No longer supported
See also
Description
Use returnVal
ue to set a return value for your event handler.
shiftKey (obsolete)
Superseded by parameters to
AuthenticView.OnKeyboardEvent (On_AuthenticView_KeyPressed)
AuthenticView.OnMouseEvent (On_AuthenticView_MouseEvent)
AuthenticView.OnDragOver (On_AuthenticView_DragOver)
The event object that holds the information of the last event is now replaced by parameters to
the different event handler functions to simplify data access. The event object will be
supported for a not yet defined period of time for compatibility reasons. No improvements are
planned. It is highly recommended to migrate to the new event handler functions.
See also
Description
True if the right SHIFT key is pressed.
shiftLeft (obsolete)
Superseded by parameters to
AuthenticView.OnKeyboardEvent (On_AuthenticView_KeyPressed)
AuthenticView.OnMouseEvent (On_AuthenticView_MouseEvent)
AuthenticView.OnDragOver (On_AuthenticView_DragOver)
The event object that holds the information of the last event is now replaced by parameters to
the different event handler functions to simplify data access. The event object will be
supported for a not yet defined period of time for compatibility reasons. No improvements are
planned. It is highly recommended to migrate to the new event handler functions.
See also
Description
True if the left SHIFT key is pressed.
srcElement (obsolete)
Superseded by parameters to
AuthenticView.OnMouseEvent (On_AuthenticView_MouseEvent)
AuthenticView.OnBeforeDrop (On_AuthenticView_BeforeDrop)
AuthenticView.OnDragOver (On_AuthenticView_DragOver)
The event object that holds the information of the last event is now replaced by parameters to
the different event handler functions to simplify data access. The event object will be
supported for a not yet defined period of time for compatibility reasons. No improvements are
planned. It is highly recommended to migrate to the new event handler functions.
With the new event handler function, a range object selecting this element is provided instead
of the XMLData element currently below the mouse cursor.
See also
Description
Element which fires the current event. This is usually an XMLData object.
type (obsolete)
Not supported
See also
Description
Currently no event sets this property.
For examples on migrating from DocEdit to Authentic see the description of the different
methods and properties of the different DocEdit objects.
See also
Properties
Start
StartTextPosition
End
EndTextPosition
End (obsolete)
Superseded by AuthenticRange.LastXMLData
// ----- javascript sample -----
// instead of:
// var objXMLData =
Application.ActiveDocument.DocEditView.CurrentSelection.End;
// use now:
var objXMLData =
Application.ActiveDocument.AuthenticView.Selection.LastXMLData;
See also
Description
XML element where the current selection ends.
EndTextPosition (obsolete)
Superseded by AuthenticRange.LastXMLDataOffset
// ----- javascript sample -----
// instead of:
// var nOffset =
Application.ActiveDocument.DocEditView.CurrentSelection.EndTextPosition;
// use now:
var nOffset =
Application.ActiveDocument.AuthenticView.Selection.LastXMLDataOffset;
See also
Description
Position in DocEditSelection.End.TextValue where the selection ends.
Start (obsolete)
Superseded by AuthenticRange.FirstXMLData
// ----- javascript sample -----
// instead of:
// var objXMLData =
Application.ActiveDocument.DocEditView.CurrentSelection.Start;
// use now:
var objXMLData =
Application.ActiveDocument.AuthenticView.Selection.FirstXMLData;
See also
Description
XML element where the current selection starts.
StartTextPosition (obsolete)
Superseded by AuthenticRange.FirstXMLDataOffset
// ----- javascript sample -----
// instead of:
// var nOffset =
Application.ActiveDocument.DocEditView.CurrentSelection.StartTextPosition;
// use now:
var nOffset =
Application.ActiveDocument.AuthenticView.Selection.FirstXMLDataOffset;
See also
Description
Position in DocEditSelection.Start.TextValue where the selection starts.
For examples on migrating from DocEdit to Authentic see the description of the different
methods and properties of the different DocEdit objects.
See also
Methods
LoadXML
SaveXML
EditClear
EditCopy
EditCut
EditPaste
EditRedo
EditSelectAll
EditUndo
RowAppend
RowDelete
RowDuplicate
RowInsert
RowMoveDown
RowMoveUp
ApplyTextState
IsTextStateApplied
IsTextStateEnabled
MarkUpView
SelectionSet
SelectionMoveTabOrder
GetNextVisible
GetPreviousVisible
GetAllowedElements
Properties
CurrentSelection
event
XMLRoot
IsEditClearEnabled
IsEditCopyEnabled
IsEditCutEnabled
IsEditPasteEnabled
IsEditRedoEnabled
IsEditUndoEnabled
IsRowAppendEnabled
IsRowDeleteEnabled
IsRowDuplicateEnabled
IsRowInsertEnabled
IsRowMoveDownEnabled
IsRowMoveUpEnabled
Description
Interface for Authentic View.
ApplyTextState (obsolete)
Superseded by AuthenticRange.PerformAction
Use spyAuthenticApply for the eAction parameter. The PerformAction method allows to apply
text state attributes to any range of the document, not only the current UI selection.
See also
Description
Applies or removes the text state defined by the parameter elementName. Common examples
for the parameter elementName would be strong and italic.
In an XML document there are segments of data, which may contain sub-elements. For
example consider the following HTML:
<b>fragment</b>
The HTML tag <b> will cause the word fragment to be bold. However, this only happens
because the HTML parser knows that the tag <b> is bold. With XML there is much more
flexibility. It is possible to define any XML tag to do anything you desire. The point is that it is
possible to apply a Text state using XML. But the Text state that is applied must be part of the
schema. For example in the OrgChart.xml, OrgChart.sps, OrgChart.xsd example
the tag <strong> is the same as bold. And to apply bold the method ApplyTextState() is
called. But like the row and edit operations it is necessary to test if it is possible to apply the text
state.
CurrentSelection (obsolete)
Superseded by AuthenticView.Selection
The returned AuthenticRange object supports navigation via XMLData elements as well as
navigation by document elements (e.g. characters, words, tags) or text cursor positions.
See also
Description
The property provides access to the current selection in the Authentic View.
EditClear (obsolete)
Superseded by AuthenticRange.Delete
The Delete method of AuthenticRange allows to delete any range of the document, not only
the current UI selection.
See also
Declaration: EditClear
Description
Deletes the current selection.
EditCopy (obsolete)
Superseded by AuthenticRange.Copy
The Copy method of AuthenticRange allows to delete any range of the document, not only the
current UI selection.
See also
Declaration: EditCopy
Description
Copies the current selection to the clipboard.
EditCut (obsolete)
Superseded by AuthenticRange.Cut
The Cut method of AuthenticRange allows to delete any range of the document, not only the
current UI selection.
See also
Declaration: EditCut
Description
Cuts the current selection from the document and copies it to the clipboard.
EditPaste (obsolete)
Superseded by AuthenticRange.Paste
The Paste method of AuthenticRange allows to delete any range of the document, not only
the current UI selection.
See also
Declaration: EditPaste
Description
Pastes the content from the clipboard into the document.
EditRedo (obsolete)
Superseded by AuthenticView.Redo
// ----- javascript sample -----
// instead of:
// Application.ActiveDocument.DocEditView.EditRedo();
// use now:
if (! Application.ActiveDocument.AuthenticView.Redo())
MsgBox ("Error: no redo step available");
See also
Declaration: EditRedo
Description
Redo the last undo step.
EditSelectAll (obsolete)
See also
Declaration: EditSelectAll
Description
The method selects the complete document.
EditUndo (obsolete)
Superseded by AuthenticView.Undo
// ----- javascript sample -----
// instead of:
// Application.ActiveDocument.DocEditView.EditUndo();
// use now:
if (! Application.ActiveDocument.AuthenticView.Undo())
MsgBox ("Error: no undo step available");
See also
Declaration: EditUndo
Description
Undo the last action.
event (obsolete)
See also
Description
The event property holds a DocEditEvent object which contains information about the current
event.
GetAllowedElements (obsolete)
Superseded by AuthenticRange.CanPerformActionWith
AuthenticRange now supports all functionality of the 'elements' entry helper. Besides querying
the elements that can be inserted, appended, etc., you can invoke the action as well. See
AuthenticRange.PerformAction for more information.
See also
Description
GetAllowedElements() returns the allowed elements for the various actions specified by
nAction.
JavaScript example:
Function GetAllowed()
{
var objView = Application.ActiveDocument.DocEditView;
var strText;
strText = "valid elements at current selection:\n\n";
Return strText;
}
Function ListArray(arrIn)
{
var strText = "";
If(TypeOf(arrIn) == "object") {
For(var i = 0;i <= (arrIn.length - 1);i++)
strText = strText + arrIn[i] + "\n";
}
Return strText;
}
VBScript example:
Sub DisplayAllowed
Dim objView
Set objView = Application.ActiveDocument.DocEditView
Dim arrElements()
Dim objStart
Dim objEnd
Set objStart = objView.CurrentSelection.Start
Set objEnd = objView.CurrentSelection.End
Dim strText
strText = "valid elements at current selection:" & chr(13) & chr(13)
Dim i
For i = 1 To 4
objView.GetAllowedElements i,objStart,objEnd,arrElements
strText = strText & ListArray(arrElements) & "---------------" & chr(13)
Next
msgbox strText
End Sub
Function ListArray(arrIn)
Dim strText
If IsArray(arrIn) Then
Dim i
For i = 0 To UBound(arrIn)
strText = strText & arrIn(i) & chr(13)
Next
End If
ListArray = strText
End Function
GetNextVisible (obsolete)
Superseded by AuthenticRange.SelectNext
AuthenticRange now supports a wide range of element navigation methods based on
document elements like characters, words, tags and many more. Selecting the text passage
that represents the content of the next XML element is just one of them.
See also
Description
The method gets the next visible XML element in the document.
GetPreviousVisible (obsolete)
Superseded by AuthenticRange.SelectPrevious
AuthenticRange now supports a wide range of element navigation methods based on
document elements like characters, words, tags and many more. Selecting the text passage
that represents the content of the previous XML element is just one of them.
See also
Description
The method gets the previous visible XML element in the document.
IsEditClearEnabled (obsolete)
Superseded by AuthenticRange.IsDeleteEnabled
The IsDeleteEnabled property is now supported for any range of the document, not only the
current UI selection.
See also
Description
True if EditClear is possible. See also Editing operations.
IsEditCopyEnabled (obsolete)
Superseded by AuthenticRange.IsCopyEnabled
The IsCopyEnabled property is now supported for any range of the document, not only the
current UI selection.
See also
Description
True if copy to clipboard is possible. See also EditCopy and Editing operations.
IsEditCutEnabled (obsolete)
Superseded by AuthenticRange.IsCutEnabled
The IsCutEnabled property is now supported for any range of the document, not only the
current UI selection.
See also
Description
True if EditCut is currently possible. See also Editing operations.
IsEditPasteEnabled (obsolete)
Superseded by AuthenticRange.IsPasteEnabled
The IsPasteEnabled property is now supported for any range of the document, not only the
current UI selection.
See also
Description
True if EditPaste is possible. See also Editing operations.
IsEditRedoEnabled (obsolete)
Superseded by AuthenticView.IsRedoEnabled
// ----- javascript sample -----
// instead of:
// if (Application.ActiveDocument.DocEditView.IsEditRedoEnabled)
// Application.ActiveDocument.DocEditView.EditRedo();
// use now:
if (Application.ActiveDocument.AuthenticView.IsRedoEnabled)
Application.ActiveDocument.AuthenticView.Redo();
See also
Description
True if EditRedo is currently possible. See also Editing operations.
IsEditUndoEnabled (obsolete)
Superseded by AuthenticView.IsUndoEnabled
// ----- javascript sample -----
// instead of:
// if (Application.ActiveDocument.DocEditView.IsEditUndoEnabled)
// Application.ActiveDocument.DocEditView.EditUndo();
// use now:
if (Application.ActiveDocument.AuthenticView.IsUndoEnabled)
Application.ActiveDocument.AuthenticView.Undo();
See also
Description
True if EditUndo is possible. See also Editing operations.
IsRowAppendEnabled (obsolete)
Superseded by AuthenticRange.IsInDynamicTable
The operations 'insert', 'append', 'delete' and 'duplicate' row are available whenever the
selection is inside a dynamic table.
See also
Description
True if RowAppend is possible. See also Row operations.
IsRowDeleteEnabled (obsolete)
Superseded by AuthenticRange.IsInDynamicTable
The operations 'insert', 'append', 'delete' and 'duplicate' row are available whenever the
selection is inside a dynamic table.
See also
Description
True if RowDelete is possible. See also Row operations.
IsRowDuplicateEnabled (obsolete)
Superseded by AuthenticRange.IsInDynamicTable
The operations 'insert', 'append', 'delete' and 'duplicate' row are available whenever the
selection is inside a dynamic table.
See also
Description
True if RowDuplicate is currently possible. See also Row operations.
IsRowInsertEnabled (obsolete)
Superseded by AuthenticRange.IsInDynamicTable
The operations 'insert', 'append', 'delete' and 'duplicate' row are available whenever the
selection is inside a dynamic table.
See also
Description
True if RowInsert is possible. See also Row operations.
IsRowMoveDownEnabled (obsolete)
Superseded by AuthenticRange.IsLastRow
See also
Description
True if RowMoveDown is currently possible. See also Row operations.
IsRowMoveUpEnabled (obsolete)
Superseded by AuthenticRange.IsFirstRow
See also
Description
True if RowMoveUp is possible. See also Row operations.
IsTextStateApplied (obsolete)
Superseded by AuthenticRange.IsTextStateApplied
// ----- javascript sample -----
// instead of:
// Application.ActiveDocument.DocEditView.IsTextStateApplied ("bold");
// use now:
if (Application.ActiveDocument.AuthenticView.Selection.IsTextStateApplied (
"bold"))
MsgBox ("bold on");
else
MsgBox ("bold off");
See also
Description
Checks to see if the it the text state has already been applied. Common examples for the
parameter elementName would be strong and italic.
IsTextStateEnabled (obsolete)
Superseded by AuthenticRange.CanPerformAction
Use spyAuthenticApply for the eAction parameter. The CanPerformAction method allows to
operate on any range of the document, not only the current UI selection.
See also
Description
Checks to see if it is possible to apply a text state. Common examples for the parameter
elementName would be strong and italic.
LoadXML (obsolete)
Superseded by AuthenticView.AsXMLString
AuthenticView now supports the property AsXMLString that can be used to directly access
and replace the document content as an XMLString.
See also
Description
Loads the current XML document with the XML string applied. The new content is displayed
immediately.
The xmlString parameter must begin with the XML declaration, e.g.,
objPlugIn.LoadXML("<?xml version='1.0' encoding='UTF-8'?><root></root>");
MarkUpView (obsolete)
Superseded by AuthenticView.MarkupVisibility
// ----- javascript sample -----
// instead of:
// Application.ActiveDocument.DocEditView.MarkuUpView = 2;
// use now:
Application.ActiveDocument.AuthenticView.MarkupVisibility =
spyAuthenticMarkupLarge;
See also
Description
By default the document displayed is using HTML techniques. But sometimes it is desirable to
show the editing tags. Using this method it is possible to display three different types of markup
tags:
RowAppend (obsolete)
Superseded by AuthenticRange.AppendRow
The table operations of AuthenticRange now allow to manipulate any table in the current
document independent of the current UI selection.
See also
Declaration: RowAppend
Description
Appends a row at the current position.
RowDelete (obsolete)
Superseded by AuthenticRange.DeleteRow
The table operations of AuthenticRange now allow to manipulate any table in the current
document independent of the current UI selection.
See also
Declaration: RowDelete
Description
Deletes the currently selected row(s).
RowDuplicate (obsolete)
Superseded by AuthenticRange.DuplicateRow
The table operations of AuthenticRange now allow to manipulate any table in the current
document independent of the current UI selection.
See also
Declaration: RowDuplicate
Description
The method duplicates the currently selected rows.
RowInsert (obsolete)
Superseded by AuthenticRange.InsertRow
The table operations of AuthenticRange now allow to manipulate any table in the current
document independent of the current UI selection.
See also
Declaration: RowInsert
Description
Inserts a new row immediately above the current selection.
RowMoveDown (obsolete)
Superseded by AuthenticRange.MoveRowDown
The table operations of AuthenticRange now allow to manipulate any table in the current
document independent of the current UI selection.
See also
Declaration: RowMoveDown
Description
Moves the current row one position down.
RowMoveUp (obsolete)
Superseded by AuthenticRange.MoveRowUp
The table operations of AuthenticRange now allow to manipulate any table in the current
document independent of the current UI selection.
See also
Declaration: RowMoveUp
Description
Moves the current row one position up.
SaveXML (obsolete)
Superseded by AuthenticView.AsXMLString
AuthenticView now supports the property XMLString that can be used to directly access and
replace the document content as an XMLString.
See also
Return Value
XML structure as string
Description
Saves the current XML data to a string that is returned to the caller.
SelectionMoveTabOrder (obsolete)
Superseded by AuthenticRange.SelectNext
AuthenticRange now supports a wide range of element navigation methods based on
document elements like characters, words, tags and many more. Selecting the next
paragraph is just one of them, and navigation is not necessarily bound to the current UI
selection.
See also
Description
SelectionMoveTabOrder() moves the current selection forwards or backwards.
If bTag is false and the current selection is at the last cell of a table a new line will be added.
SelectionSet (obsolete)
See also
Description
Use SelectionSet() to set a new selection in the Authentic View. Its possible to set
pEndElement to null (nothing) if the selection should be just over one (pStartElement) XML
element.
XMLRoot (obsolete)
Superseded by AuthenticView.XMLDataRoot
// ----- javascript sample -----
// instead of:
// var objXMLData = Application.ActiveDocument.DocEditView.XMLRoot;
// use now:
var objXMLData = Application.ActiveDocument.AuthenticView.XMLDataRoot;
See also
Description
XMLRoot is the parent element of the currently displayed XML structure. Using the XMLData
interface you have full access to the complete content of the file.
4.5 Enumerations
This is a list of all enumerations used by the XMLSpy API. If your scripting environment does
not support enumerations use the number-values instead.
4.5.1 ENUMApplicationStatus
Description
Enumeration to specify the current Application status.
Possible values:
eApplicationRunning =0
eApplicationAfterLicenseCheck =1
eApplicationBeforeLicenseCheck =2
eApplicationConcurrentLicenseCheckFailed =3
eApplicationProcessingCommandLine =4
4.5.2 SPYAttributeTypeDefinition
Description
Attribute type definition that can be selected for generation of Sample XML.
This type is used with the method GenerateDTDOrSchema and GenerateDTDOrSchemaEx.
Possible values:
spyMergedGlobal =0
spyDistinctGlobal =1
spyLocal =2
4.5.3 SPYAuthenticActions
Description
Actions that can be performed on AuthenticRange objects.
Possible values:
spyAuthenticInsertAt =0
spyAuthenticApply =1
spyAuthenticClearSurr =2
spyAuthenticAppend =3
spyAuthenticInsertBefore =4
spyAuthenticRemove =5
4.5.4 SPYAuthenticDocumentPosition
Description
Relative and absolute positions used for navigating with AuthenticRange objects.
Possible values:
spyAuthenticDocumentBegin = 0
spyAuthenticDocumentEnd = 1
spyAuthenticRangeBegin =2
spyAuthenticRangeEnd =3
4.5.5 SPYAuthenticElementActions
Description
Actions that can be used with GetAllowedElements (superseded by
AuthenticRange.CanPerformActionWith).
Possible values:
k_ActionInsertAt =0
k_ActionApply =1
k_ActionClearSurr =2
k_ActionAppend =3
k_ActionInsertBefore =4
k_ActionRemove =5
4.5.6 SPYAuthenticElementKind
Description
Enumeration of the different kinds of elements used for navigation and selection within the
AuthenticRange and AuthenticView objects.
Possible values:
spyAuthenticChar =0
spyAuthenticWord =1
spyAuthenticLine =3
spyAuthenticParagraph =4
spyAuthenticTag =6
spyAuthenticDocument =8
spyAuthenticTable =9
spyAuthenticTableRow = 10
spyAuthenticTableColumn = 11
4.5.7 SPYAuthenticMarkupVisibility
Description
Enumeration values to customize the visibility of markup with MarkupVisibility.
Possible values:
spyAuthenticMarkupHidden =0
spyAuthenticMarkupSmall =1
spyAuthenticMarkupLarge =2
spyAuthenticMarkupMixed =3
4.5.8 SPYAuthenticToolbarButtonState
Description
Authentic toolbar button states are given by the following enumeration:
Possible values:
authenticToolbarButtonDefault =0
authenticToolbarButtonEnabled =1
authenticToolbarButtonDisabled =2
4.5.9 SPYDatabaseKind
Description
Values to select different kinds of databases for import. See
DatabaseConnection.DatabaseKind for its use.
Possible values:
spyDB_Access =0
spyDB_SQLServer =1
spyDB_Oracle =2
spyDB_Sybase =3
spyDB_MySQL =4
spyDB_DB2 =5
spyDB_Other =6
spyDB_Unspecified =7
4.5.10 SPYDialogAction
Description
Values to simulate different interactions on dialogs. See Dialogs for all dialogs available.
Possible values:
spyDialogOK =0 //si
m ul
atecl
i
ckonOK button
spyDialogCancel =1 //si
m ul
atecl
i
ckonCancelbutton
spyDialogUserInput =2 / show dial
ogandal
l
ow useri nteracti
on
4.5.11 SPYDOMType
Description
Enumeration values to parameterize generation of C++ code from schema definitions.
Possible values:
spyDOMType_msxml4 =0 Obsolete
spyDOMType_xerces =1
spyDOMType_xerces3 =2
spyDOMType_msxml6 =3
4.5.12 SPYDTDSchemaFormat
Description
Enumeration to identify the different schema formats.
Possible values:
spyDTD =0
spyW3C =1
4.5.13 SPYEncodingByteOrder
Description
Enumeration values to specify encoding byte ordering for text import and export.
Possible values:
spyNONE =0
spyLITTLE_ENDIAN =1
spyBIG_ENDIAN =2
4.5.14 SPYExportNamespace
Description
Enumeration type to configure handling of namespace identifiers during export.
Possible values:
spyNoNamespace =0
spyReplaceColonWithUnderscore = 1
4.5.15 SPYFindInFilesSearchLocation
Description
The different locations where a search can be performed. This type is used with the
FindInFilesDlg dialog.
Possible values:
spyFindInFiles_Documents =0
spyFindInFiles_Project =1
spyFindInFiles_Folder =2
4.5.16 SPYFrequentElements
Description
Enumeration value to parameterize schema generation.
Possible values:
spyGlobalElements =0
spyGlobalComplexType =1
4.5.17 SPYImageKind
Description
Enumeration values to parameterize image type of the generated documentation. These values
are used in Schem aDocum entationDialog.Diagram Form at and
W SDLDocum entationDlg.Diagram Form at .
Possible values:
spyImageType_PNG =0
spyImageType_EMF =1
4.5.18 SPYImportColumnsType
Description
Enumeration to specify different Import columns types.
Possible values:
spyImportColumns_Element =0
spyImportColumns_Attribute =1
4.5.19 SPYKeyEvent
Description
Enumeration type to identify the different key events. These events correspond with the equally
named windows messages.
Possible values:
spyKeyDown =0
spyKeyUp =1
spyKeyPressed =2
4.5.20 SPYKeyStatus
Description
Enumeration type to identify the key status.
Possible values:
spyLeftShiftKeyMask =1
spyRightShiftKeyMask =2
spyLeftCtrlKeyMask =4
spyRightCtrlKeyMask =8
spyLeftAltKeyMask = 16
spyRightAltKeyMask = 32
4.5.21 SPYLibType
Description
Enumeration values to parameterize generation of C++ code from schema definitions.
Possible values:
spyLibType_static =0
spyLibType_dll =1
4.5.22 SPYLoading
Description
Enumeration values to define loading behaviour of URL files.
Possible values:
spyUseCacheProxy =0
spyReload =1
4.5.23 SPYMouseEvent
Description
Enumeration type that defines the mouse status during a mouse event. Use the enumeration
values as bitmasks rather then directly comparing with them.
Examples
Possible values:
spyNoButtonMask =0
spyMouseMoveMask =1
spyLeftButtonMask =2
spyMiddleButtonMask =4
spyRightButtonMask =8
spyButtonUpMask = 16
spyButtonDownMask = 32
spyDoubleClickMask = 64
spyShiftKeyDownMask = 128
spyCtrlKeyDownMask = 256
spyLeftButtonDownMask = 34 // spyLeftButtonMask | spyButtonDownMask
spyMiddleButtonDownMask = 36 // spyMiddleButtonMask | spyButtonDownMask
spyRightButtonDownMask = 40 // spyRightButtonMask | spyButtonDownMask
spyLeftButtonUpMask = 18 // spyLeftButtonMask | spyButtonUpMask
spyMiddleButtonUpMask = 20 // spyMiddleButtonMask | spyButtonUpMask
spyRightButtonUpMask = 24 // spyRightButtonMask | spyButtonUpMask
spyLeftDoubleClickMask = 66 // spyRightButtonMask | spyButtonUpMask
spyMiddleDoubleClickMask = 68 // spyMiddleButtonMask | spyDoubleClickMask
spyRightDoubleClickMask = 72 // spyRightButtonMask | spyDoubleClickMask
4.5.24 SPYNumberDateTimeFormat
Description
Enumeration value to configure database connections.
Possible values:
spySystemLocale =0
spySchemaCompatible = 1
4.5.25 SPYProgrammingLanguage
Description
Enumeration values to select the programming language for code generation from schema
definitions.
Only available/enabled in the Enterprise edition. An error is returned, if accessed by any other
version.
Possible values:
spyUndefinedLanguage = -1
spyJava =0
spyCpp =1
spyCSharp =2
4.5.26 SPYProjectItemTypes
Description
Enumeration values to identify the different elements in project item lists. See
SpyProjectItem.ItemType.
Possible values:
spyUnknownItem =0
spyFileItem =1
spyFolderItem =2
spyURLItem =3
4.5.27 SPYProjectType
Description
Enumeration values to parameterize generation of C# from schema definitions.
Possible values:
spyVisualStudioProject =0 Obsolete
spyVisualStudio2003Project =1 Obsolete
spyBorlandProject =2 Obsolete
spyMonoMakefile =3
spyVisualStudio2005Project =4 For C++ code also
spyVisualStudio2008Project =5 For C++ code also
spyVisualStudio2010Project =6 For C++ code also
4.5.28 SPYSampleXMLGenerationOptimization
Description
Specify the elements that will be generated in the Sample XML.
This enumeration is used in GenerateSampleXMLDlg.
Possible values:
spySampleXMLGen_Optimized =0
spySampleXMLGen_NonMandatoryElements = 1
spySampleXMLGen_Everything =2
4.5.29 SPYSampleXMLGenerationSchemaOrDTDAssignment
Description
Specifies what kind of reference to the schema/DTD should be added to the generated Sample
XML.
This enumeration is used in GenerateSampleXMLDlg.
Possible values:
spySampleXMLGen_AssignRelatively =0
spySampleXMLGen_AssignAbsolutely =1
spySampleXMLGen_DoNotAssign =2
4.5.30 SPYSchemaDefKind
Description
Enumeration type to select schema diagram types.
Possible values:
spyKindElement =0
spyKindComplexType =1
spyKindSimpleType =2
spyKindGroup =3
spyKindModel =4
spyKindAny =5
spyKindAttr =6
spyKindAttrGroup =7
spyKindAttrAny =8
spyKindIdentityUnique =9
spyKindIdentityKey = 10
spyKindIdentityKeyRef = 11
spyKindIdentitySelector = 12
spyKindIdentityField = 13
spyKindNotation = 14
spyKindInclude = 15
spyKindImport = 16
spyKindRedefine = 17
spyKindFacet = 18
spyKindSchema = 19
spyKindCount = 20
4.5.31 SPYSchemaDocumentationFormat
Description
Enumeration values to parameterize generation of schema documentation. These values are
used in Schem aDocum entationDialog.OutputForm at and
W SDLDocum entationDlg.O utputForm at .
Possible values:
spySchemaDoc_HTML =0
spySchemaDoc_MSWord =1
spySchemaDoc_RTF =2
4.5.32 SPYSchemaExtensionType
Description
Enumeration to specify different Schema Extension types.
Possible values:
spySchemaExtension_None =0
spySchemaExtension_SQL_XML =1
spySchemaExtension_MS_SQL_Server =2
spySchemaExtension_Oracle =3
4.5.33 SPYSchemaFormat
Description
Enumeration to specify different Schema Format types.
Possible values:
spySchemaFormat_Hierarchical =0
spySchemaFormat_Flat =1
4.5.34 SPYTextDelimiters
Description
Enumeration values to specify text delimiters for text export.
Possible values:
spyTabulator =0
spySemicolon =1
spyComma =2
spySpace =3
4.5.35 SPYTextEnclosing
Description
Enumeration value to specify text enclosing characters for text import and export.
Possible values:
spyNoEnclosing =0
spySingleQuote =1
spyDoubleQuote =2
4.5.36 SPYTypeDetection
Description
Enumeration to select how type detection works during GenerateDTDOrSchema and
GenerateDTDOrSchemaEx.
Possible values:
spyBestPossible =0
spyNumbersOnly =1
spyNoDetection =2
4.5.37 SPYURLTypes
Description
Enumeration to specify different URL types.
Possible values:
spyURLTypeAuto = -1
spyURLTypeXML = 0
spyURLTypeDTD = 1
4.5.38 SPYViewModes
Description
Enumeration values that define the different view modes for XML documents. The mode
spyViewAuthentic(4) identifies the mode that was intermediately called DocEdit mode and is
now called Authentic mode. The mode spyViewWSDL identifies a mode which is mapped to the
schema view on the GUI but distinguished internally.
Possible values:
spyViewGrid =0
spyViewText =1
spyViewBrowser =2
spyViewSchema =3
spyViewContent =4 // obsolete
spyViewAuthentic =4
spyViewWSDL =5
spyViewZIP =6
spyViewEditionInfo =7
spyViewXBRL =8
4.5.39 SPYVirtualKeyMask
Description
Enumeration type for the most frequently used key masks that identify the status of the virtual
keys. Use these values as bitmasks rather then directly comparing with them. When necessary,
you can create further masks by using the 'logical or' operator.
Examples
Possible values:
spyNoVirtualKeyMask =0
spyLeftShiftKeyMask =1
spyRightShiftKeyMask =2
spyLeftCtrlKeyMask =4
spyRightCtrlKeyMask =8
spyLeftAltKeyMask = 16
spyRightAltKeyMask = 32
spyShiftKeyMask =3 // spyLeftShiftKeyMask | spyRightShiftKeyMask
spyCtrlKeyMask = 12 // spyLeftCtrlKeyMask | spyRightCtrlKeyMask
spyAltKeyMask = 48 // spyLeftAltKeyMask | spyRightAltKeyMask
4.5.40 SPYXMLDataKind
Description
The different types of XMLData elements available for XML documents.
Possible values:
spyXMLDataXMLDocStruct =0
spyXMLDataXMLEntityDocStruct =1
spyXMLDataDTDDocStruct =2
spyXMLDataXML =3
spyXMLDataElement =4
spyXMLDataAttr =5
spyXMLDataText =6
spyXMLDataCData =7
spyXMLDataComment =8
spyXMLDataPI =9
spyXMLDataDefDoctype = 10
spyXMLDataDefExternalID = 11
spyXMLDataDefElement = 12
spyXMLDataDefAttlist = 13
spyXMLDataDefEntity = 14
spyXMLDataDefNotation = 15
spyXMLDataKindsCount = 16
Java classes
SpyApplication
SpyProject
SpyProjectItems
SpyProjectItem
SpyDocuments
SpyDoc
SpyAuthenticView
SpyAuthenticRange
SpyDocEditView
SpyDocEditSelection
SpyGridView
SpyTextView
SpyXMLData
SpyDialogs
SpyCodeGeneratorDlg
SpyDTDSchemaGeneratorDlg
SpyFileSelectionDlg
SpyFindInFilesDlg
SpyGenerateSampleXMLDlg
SpySchemaDocumentationDlg
SpyWSDL20DocumentationDlg
SpyWSDLDocumentationDlg
SpyXBRLDocumentationDlg
SpyDatabaseConnection
SpyElementList
SpyElementListItem
SpyExportSettings
SpyFindInFilesResults
SpyFindInFilesResult
SpyFindInFilesMatch
SpyTextImportExportSettings
If a ClassPath entry does not exist in the System variables group, click the New
button. The New System Variable dialog pops up. Enter CLASSPATH as the variable
name, and "C:\Program Files\Altova\xmlspy\XMLSpyInterface.jar" as
the ClassPath variable (alter the path to match your installation, if necessary).
import XMLSpyInterface.*;
try
{
app = new SpyApplication();
app.ShowApplication( true );
oDoc = app.GetDocuments().OpenFile("C:\\FilePath\\OrgChart.xml",
true );
if ( oDoc != null )
{
oDoc.SwitchViewMode(SPYViewModes.spyViewGrid);
oData = oDoc.GetRootElement();
oNewChild = oDoc.CreateChild(SPYXMLDataKind.spyXMLDataElement);
oNewChild.SetName( "NewChild" );
oNewChild.SetTextValue("newVaLuE");
oData.AppendChild(oNewChild);
if ( oDoc.IsValid() == false )
{
// is to be expected after above insertion
System.out.println( "!!!!!!validation error: " +
oDoc.GetErrorString() );
System.out.println( "!!!!!!validation error: " +
oDoc.GetErrorPos() );
System.out.println( "!!!!!!validation error: " +
oDoc.GetBadData() );
}
app.Quit();
}
finally
{
// Free any allocated resources by calling ReleaseInstance().
if ( oNewChild != null )
oNewChild.ReleaseInstance();
if ( oData != null )
oData.ReleaseInstance();
if ( oDoc != null )
oDoc.ReleaseInstance();
if ( app != null )
app.ReleaseInstance();
}
}
}
If you have difficulties compiling this sample, please try the following commands on the (Start |
Run | cmd) command line. Please make sure you are currently in the folder that contains the
sample java file.
compilation
javac -classpath c:\yourpathhere\XMLSpyInterface.jar testspyinterface.java
Execution
java -classpath c:\yourpathhere\XMLSpyInterface.jar testspyinterface
5.2 SpyApplication
public class SpyApplication
{
public void ReleaseInstance();
public void ShowApplication( boolean bShow );
public void Quit();
public void AddMacroMenuItem( String sMacro, String sDisplayText );
public void ClearMacroMenu();
public SpyDoc GetActiveDocument();
public SpyProject GetCurrentProject();
public SpyDocuments GetDocuments();
public SpyElementList GetDatabaseImportElementList( SpyDatabaseConnection
oImportSettings );
public SpyDatabaseConnection GetDatabaseSettings();
public SpyElementList GetDatabaseTables( SpyDatabaseConnection
oImportSettings );
public SpyExportSettings GetExportSettings();
public SpyElementList GetTextImportElementList( SpyTextImportExportSettings
oImportSettings );
public SpyTextImportExportSettings GetTextImportExportSettings();
public SpyDoc ImportFromDatabase( SpyDatabaseConnection oImportSettings,
SpyElementList oElementList );
public SpyDoc ImportFromSchema( SpyDatabaseConnection oImportSettings,
String strTable, SpyDoc oSchemaDoc );
public SpyDoc ImportFromText( SpyTextImportExportSettings oImportSettings,
SpyElementList oElementList );
public SpyDoc ImportFromWord( String sFile );
public void NewProject( String sPath, boolean bDiscardCurrent );
public void OpenProject(String sPath , boolean bDiscardCurrent, boolean
bDialog );
public long ShowForm( String sName );
public void URLDelete( String sURL, String sUser, String sPassword );
public void URLMakeDirectory( String sURL, String sUser, String sPassword );
5.3 SpyCodeGeneratorDlg
Only available/enabled in the Enterprise edition. An error is returned, if accessed by any other
version.
// since version 2004R4
public class SpyCodeGeneratorDlg
{
public void ReleaseInstance();
public SpyApplication GetApplication();
public SpyDialogs GetParent();
public long GetProgrammingLanguage();
public void SetProgrammingLanguage( long i_eVal );
public String GetTemplateFileName();
public void SetTemplateFileName( String i_strVal );
public String GetOutputPath();
public void SetOutputPath( String i_strVal );
public long GetOutputPathDialogAction();
public void SetOutputPathDialogAction( long i_eVal );
public long GetPropertySheetDialogAction();
public void SetPropertySheetDialogAction( long i_eVal );
public long GetOutputResultDialogAction();
public void SetOutputResultDialogAction( long i_eVal );
public long GetCPPSettings_DOMType();
public void SetCPPSettings_DOMType( long i_eVal );
public long GetCPPSettings_LibraryType();
public void SetCPPSettings_LibraryType( long i_eVal );
public boolean GetCPPSettings_UseMFC();
public void SetCPPSettings_UseMFC( boolean i_bVal );
public long GetCSharpSettings_ProjectType();
public void SetCSharpSettings_ProjectType( long i_eVal );
}
5.4 SpyDatabaseConnection
public class SpyDatabaseConnection
{
public void ReleaseInstance();
public String GetADOConnection();
public void SetADOConnection( String sValue );
public boolean GetAsAttributes();
public void SetAsAttributes( boolean bValue );
public boolean GetCreateMissingTables();
public void SetCreateMissingTables( boolean bValue );
public boolean GetCreateNew();
public void SetCreateNew( boolean bValue );
public boolean GetExcludeKeys();
public void SetExcludeKeys( boolean bValue );
public String GetFile();
public void SetFile( String sValue );
public boolean GetIncludeEmptyElements();
public void SetIncludeEmptyElements( boolean bValue );
public long GetNumberDateTimeFormat();
public void SetNumberDateTimeFormat( long nValue );
public String GetODBCConnection();
public void SetODBCConnection( String sValue );
public String GetSQLSelect();
public void SetSQLSelect( String sValue );
public long GetTextFieldLen();
public void SetTextFieldLen( long nValue );
5.5 SpyDialogs
// Since version 2004R4
public class SpyDialogs
{
public SpyApplication GetApplication();
public SpyApplication GetParent();
public SpyCodeGeneratorDlg GetCodeGeneratorDlg();
public SpyFileSelectionDlg GetFileSelectionDlg();
public SpySchemaDocumentationDlg GetSchemaDocumentationDlg();
public SpyGenerateSampleXMLDlg GetGenerateSampleXMLDlg();
public SpyDTDSchemaGeneratorDlg GetDTDSchemaGeneratorDlg();
public SpyFindInFilesDlg GetFindInFilesDlg();
public SpyWSDLDocumentationDlg GetWSDLDocumentationDlg();
5.6 SpyDoc
public class SpyDoc
{
public void ReleaseInstance();
public void SetEncoding( String strEncoding );
public void SetPathName( String strPath );
public String GetPathName();
public String GetTitle();
public boolean IsModified();
public void Save();
public void Close( boolean bDiscardChanges );
public void UpdateViews();
public long GetCurrentViewMode();
public boolean SwitchViewMode( long nMode );
public SpyGridView GetGridView();
public void SetActiveDocument();
public void StartChanges();
public void EndChanges();
public void TransformXSL();
public void AssignDTD( String sDTDFile, boolean bDialog );
public void AssignSchema( String sSchemaFile, boolean bDialog );
public void AssignXSL( String sXSLFile, boolean bDialog );
public void ConvertDTDOrSchema( long nFormat, long nFrequentElements );
public SpyXMLData CreateChild( long nKind );
public void CreateSchemaDiagram( long nKind, String sName, String sFile );
public SpyDocEditView GetDocEditView();
public void ExportToDatabase( SpyXMLData oFromChild, SpyExportSettings
oExportSettings, SpyDatabaseConnection oDatabaseConnection );
public void ExportToText( SpyXMLData oFromChild, SpyExportSettings
oExportSettings, SpyTextImportExportSettings oTextSettings );
public void GenerateDTDOrSchema( long nFormat, int nValuesList, long
nDetection, long nFrequentElements );
public SpyElementList GetExportElementList( SpyXMLData oFromChild,
SpyExportSettings oExportSettings );
public SpyXMLData GetRootElement();
public String SaveInString( SpyXMLData oData, boolean bMarked );
public void SaveToURL( String sUrl, String sUser, String sPassword );
public String GetErrorString(); // See IsValid() or IsWellFormed()
public int GetErrorPos(); // See IsValid() or IsWellFormed()
public SpyXMLData GetBadData(); // See IsValid() or IsWellFormed()
public boolean IsValid();
public boolean IsWellFormed( SpyXMLData oData, boolean bWithChildren );
5.7 SpyDocuments
public class SpyDocuments
{
public void ReleaseInstance();
public long Count();
public SpyDoc GetItem( long nNo );
public SpyDoc NewFile( String strFile, String strType );
public SpyDoc NewFileFromText( String nSource, String strType );
public SpyDoc OpenFile( String sPath, boolean bDialog );
public SpyDoc OpenURL( String sUrl, long nURLType, long nLoading, String
sUser, String sPassword );
public SpyDoc OpenURLDialog(String sURL, long nURLType, long nLoading,
String sUser, String sPassword )
}
5.8 SpyDTDSchemaGeneratorDlg
public class SpyDTDSchemaGeneratorDlg
{
public void ReleaseInstance();
public SpyApplication GetApplication();
public long GetDTDSchemaFormat();
public void SetDTDSchemaFormat( long newVal );
public short GetValueList();
public void SetValueList( short newVal );
public long GetTypeDetection();
public void SetTypeDetection( long newVal );
public long GetFrequentElements();
public void SetFrequentElements( long newVal );
public boolean GetMergeAllEqualNamed();
public void SetMergeAllEqualNamed( boolean newVal );
public boolean GetResolveEntities();
public void SetResolveEntities( boolean newVal );
public long GetAttributeTypeDefinition();
public void SetAttributeTypeDefinition( long newVal );
public boolean GetGlobalAttributes();
public void SetGlobalAttributes( boolean newVal );
public boolean GetOnlyStringEnums();
public void SetOnlyStringEnums( boolean newVal );
public long GetMaxEnumLength();
public void SetMaxEnumLength( long newVal );
public String GetOutputPath();
public void SetOutputPath( String newVal );
public long GetOutputPathDialogAction();
public void SetOutputPathDialogAction( long newVal );
}
5.9 SpyElementList
public class SpyElementList
{
public void ReleaseInstance();
public long GetCount();
public SpyElementListItem GetItem( long nIndex );
public void RemoveElement( long nIndex );
}
5.10 SpyElementListItem
public class SpyElementListItem
{
public void ReleaseInstance();
public long GetElementKind();
public void SetElementKind( long nKind );
public long GetFieldCount();
public String GetName();
public long GetRecordCount();
}
5.11 SpyExportSettings
public class SpyExportSettings
{
public void ReleaseInstance();
public boolean GetCreateKeys();
public void SetCreateKeys( boolean bValue );
public SpyElementList GetElementList();
public void SetElementList( SpyElementList obj );
public boolean GetEntitiesToText ();
public void SetEntitiesToText( boolean bValue );
public boolean GetExportAllElements();
public void SetExportAllElements( boolean bValue );
public boolean GetFromAttributes();
public void SetFromAttributes( boolean bValue );
public boolean GetFromSingleSubElements();
public void SetFromSingleSubElements( boolean bValue );
public boolean GetFromTextValues();
public void SetFromTextValues( boolean bValue );
public boolean GetIndependentPrimaryKey();
public void SetIndependentPrimaryKey( boolean bValue );
public long GetNamespace();
public void SetNamespace( long nValue );
public int GetSubLevelLimit();
public void SetSubLevelLimit( int nValue );
}
5.12 SpyFileSelectionDlg
// Since version 2004R4
public class SpyFileSelectionDlg
{
public void ReleaseInstance();
public SpyApplication GetApplication();
public SpyDialogs GetParent();
public String GetFullName();
public void SetFullName( String i_strName );
public long GetDialogAction();
public void SetDialogAction( long i_eAction );
}
5.13 SpyFindInFilesDlg
public class SpyFindInFilesDlg
{
public void ReleaseInstance();
public SpyApplication GetApplication();
public String GetFind();
public void SetFind( String sNewVal );
public boolean GetRegularExpression();
public void SetRegularExpression( boolean bNewVal );
public String GetReplace();
public void SetReplace( String sNewVal );
public boolean GetReplaceOnDisk();
public void SetReplaceOnDisk( boolean bNewVal );
public boolean GetDoReplace();
public void SetDoReplace( boolean bNewVal );
public boolean GetMatchWholeWord();
public void SetMatchWholeWord( boolean bNewVal );
public boolean GetMatchCase();
public void SetMatchCase( boolean bNewVal );
public long GetSearchLocation();
public void SetSearchLocation( long nPosition );
public String GetStartFolder();
public void SetStartFolder( String sNewVal );
public boolean GetIncludeSubfolders();
public void SetIncludeSubfolders( boolean bNewVal );
public boolean GetSearchInProjectFilesDoExternal();
public void SetSearchInProjectFilesDoExternal( boolean bNewVal );
public String GetFileExtension();
public void SetFileExtension( String sNewVal );
public boolean GetAdvancedXMLSearch();
public void SetAdvancedXMLSearch( boolean bNewVal );
public boolean GetXMLElementNames();
public void SetXMLElementNames( boolean bNewVal );
public boolean GetXMLElementContents();
public void SetXMLElementContents( boolean bNewVal );
public boolean GetXMLAttributeNames();
public void SetXMLAttributeNames( boolean bNewVal );
public boolean GetXMLAttributeContents();
public void SetXMLAttributeContents( boolean bNewVal );
public boolean GetXMLComments();
public void SetXMLComments( boolean bNewVal );
public boolean GetXMLCData();
public void SetXMLCData( boolean bNewVal );
public boolean GetXMLPI();
public void SetXMLPI( boolean bNewVal );
public boolean GetXMLRest();
public void SetXMLRest( boolean bNewVal );
public boolean GetShowResult();
public void SetShowResult( boolean bNewVal );
}
5.14 SpyFindInFilesMatch
public class SpyFindInFilesMatch
{
public void ReleaseInstance();
public long Line();
public long Position();
public long Length();
public String LineText();
public boolean Replaced();
}
5.15 SpyFindInFilesResult
public class SpyFindInFilesResult
{
public void ReleaseInstance();
public long Count();
public SpyFindInFilesMatch GetItem( long nNo );
public String GetPath();
public SpyDoc GetDocument();
}
5.16 SpyFindInFilesResults
public class SpyFindInFilesResults
{
public void ReleaseInstance();
public long Count();
public SpyFindInFilesResult GetItem( long nNo );
}
5.17 SpyGenerateSampleXMLDlg
public class SpyGenerateSampleXMLDlg
{
public void ReleaseInstance();
public SpyApplication GetApplication();
public boolean GetNonMandatoryAttributes();
public void SetNonMandatoryAttributes( boolean newVal );
public boolean GetNonMandatoryElements();
public void SetNonMandatoryElements( boolean newVal );
public boolean GetTakeFirstChoice();
public void SetTakeFirstChoice( boolean newVal );
public long GetRepeatCount();
public void SetRepeatCount( long newVal );
public boolean GetFillWithSampleData();
public void SetFillWithSampleData( boolean newVal );
public boolean GetFillElementsWithSampleData();
public void SetFillElementsWithSampleData( boolean newVal );
public boolean GetFillAttributesWithSampleData();
public void SetFillAttributesWithSampleData( boolean newVal );
public boolean GetContentOfNillableElementsIsNonMandatory();
public void SetContentOfNillableElementsIsNonMandatory( boolean newVal );
public boolean GetTryToUseNonAbstractTypes();
public void SetTryToUseNonAbstractTypes( boolean newVal );
public long GetOptimization();
public void SetOptimization( long newVal );
public long GetSchemaOrDTDAssignment();
public void SetSchemaOrDTDAssignment( long newVal );
public String GetLocalNameOfRootElement();
public void SetLocalNameOfRootElement( String newVal );
public String GetNamespaceURIOfRootElement();
public void SetNamespaceURIOfRootElement( String newVal );
public long GetOptionsDialogAction();
public void SetOptionsDialogAction( long newVal );
}
5.18 SpyGridView
public class SpyGridView
{
public void ReleaseInstance();
public SpyXMLData GetCurrentFocus();
public void Deselect( SpyXMLData oData );
public boolean GetIsVisible();
public void Select( SpyXMLData oData );
public void SetFocus( SpyXMLData oData );
}
5.19 SpyProject
public class SpyProject
{
public void ReleaseInstance();
public void CloseProject( boolean bDiscardChanges, boolean bCloseFiles,
boolean bDialog );
public String GetProjectFile();
public void SetProjectFile( String sFile );
public SpyProjectItems GetRootItems();
public void SaveProject();
public void SaveProjectAs( String sPath, boolean bDialog );
}
5.20 SpyProjectItem
public class SpyProjectItem
{
public void ReleaseInstance();
public SpyProjectItems GetChildItems();
public String GetFileExtensions();
public void SetFileExtensions( String sExtensions );
public long GetItemType();
public String GetName();
public SpyDoc Open();
public SpyProjectItem GetParentItem();
public String GetPath();
public String GetValidateWith();
public void SetValidateWith( String sVal );
public String GetXMLForXSLTransformation();
public void SetXMLForXSLTransformation( String sVal );
public String GetXSLForXMLTransformation();
public void SetXSLForXMLTransformation( String sVal );
public String GetXSLTransformationFileExtension();
public void SetXSLTransformationFileExtension( String sVal );
public String GetXSLTransformationFolder();
public void SetXSLTransformationFolder( String sVal );
}
5.21 SpyProjectItems
public class SpyProjectItems
{
public void ReleaseInstance();
public void AddFile( String sPath );
public void AddFolder( String sName );
public void AddURL( String sURL, long nURLType, String sUser, String
sPassword, boolean bSave );
public long Count();
public SpyProjectItem GetItem( long nNumber );
public void RemoveItem( SpyProjectItem oItemToRemove );
}
5.22 SpySchemaDocumentationDlg
// Since version 2004R4
public class SpySchemaDocumentationDlg
{
public void ReleaseInstance();
public SpyApplication GetApplication();
public SpyDialogs GetParent();
5.23 SpyTextImportExportSettings
public class SpyTextImportExportSettings
{
public void ReleaseInstance();
public String GetDestinationFolder();
public void SetDestinationFolder( String sVal );
public long GetEnclosingCharacter();
public void SetEnclosingCharacter( long nEnclosing );
public String GetEncoding();
public void SetEncoding( String sVal );
public long GetEncodingByteOrder();
public void SetEncodingByteOrder( long nByteOrder );
public long GetFieldDelimiter();
public void SetFieldDelimiter( long nDelimiter );
public String GetFileExtension ();
public void SetFileExtension( String sVal );
public boolean GetHeaderRow();
public void SetHeaderRow( boolean bVal );
public String GetImportFile();
public void SetImportFile( String sVal );
}
5.24 SpyTextView
public class SpyTextView
{
public void ReleaseInstance();
public SpyApplication GetApplication();
public SpyDoc GetParent();
public long LineFromPosition( long nCharPos );
public long PositionFromLine( long nLine );
public long LineLength( long nLine );
public String GetSelText();
public void SetSelText( String sText );
public String GetRangeText( long nPosFrom, long nPosTill );
public void ReplaceText( long nPosFrom, long nPosTill, String sText );
public void MoveCaret( long nDiff );
public void GoToLineChar( long nLine, long nChar );
public void SelectText( long nPosFrom, long nPosTill );
public long GetSelectionStart();
public void SetSelectionStart( long nNewVal );
public long GetSelectionEnd();
public void SetSelectionEnd( long nNewVal );
public String GetText();
public void SetText( String sText );
public long LineCount();
public long Length();
}
5.25 SpyWSDL20DocumentationDlg
5.26 SpyWSDLDocumentationDlg
// Since version 2008r2sp1
public class SpyWSDLDocumentationDlg
{
public void ReleaseInstance();
public SpyApplication GetApplication();
5.27 SpyXBRLDocumentationDlg
5.28 SpyXMLData
public class SpyXMLData
{
public void ReleaseInstance();
public void AppendChild( SpyXMLData oNewData );
public void EraseAllChildren();
public void EraseCurrentChild();
public SpyXMLData GetCurrentChild();
public SpyXMLData GetFirstChild( long nKind );
public SpyXMLData GetNextChild();
public boolean GetHasChildren();
public void InsertChild( SpyXMLData oNewData );
public boolean IsSameNode( SpyXMLData oToComp);
public long GetKind();
public boolean GetMayHaveChildren();
public String GetName();
public void SetName( String sValue );
public SpyXMLData GetParent();
public String GetTextValue();
public void SetTextValue( String sValue );
}
5.29 Authentic
5.29.1 SpyAuthenticRange
5.29.2 SpyAuthenticView
5.29.3 SpyDocEditSelection
5.29.4 SpyDocEditView
5.30.1 SPYApplicationStatus
public class SPYApplicationStatus
{
public final static long spyApplicationStatus_Running = 0;
public final static long = 1;
spyApplicationStatus_AfterLicenseCheck
public final static long = 2;
spyApplicationStatus_BeforeLicenseCheck
public final static long = 3;
spyApplicationStatus_ConcurrentLicenseCheckFailed
public final static long = 4;
spyApplicationStatus_ProcessingCommandLine
}
5.30.2 SPYAttributeTypeDefinition
5.30.3 SPYAuthenticActions
5.30.4 SPYAuthenticDocumentPosition
5.30.5 SPYAuthenticElementKind
5.30.6 SPYAuthenticMarkupVisibility
5.30.7 SPYDatabaseKind
public class SPYLoading
{
public final static long = 0;
spyDB_Access
public final static long = 1;
spyDB_SQLServer
5.30.8 SPYDialogAction
public class SPYDialogAction
{
public final static long = 0;
spyDialogOK
public final static long = 1;
spyDialogCancel
public final static long = 2;
spyDialogUserInput
}
5.30.9 SPYDOMType
public class SPYDOMType
{
public final static long = 0;
spyDOMType_msxml4
public final static long = 1;
spyDOMType_xerces
}
5.30.10 SPYDTDSchemaFormat
5.30.11 SPYEncodingByteOrder
5.30.12 SPYExportNamespace
5.30.13 SPYFindInFilesSearchLocation
5.30.14 SPYFrequentElements
5.30.15 SPYImageKind
public class SPYImageKind
{
public final static long = 0;
spyImageType_PNG
public final static long = 1;
spyImageType_EMF
}
5.30.16 SPYImportColumnsType
Enter topic text here.
5.30.17 SPYLibType
public class SPYLibType
{
public final static long = 0;
spyLibType_static
5.30.18 SPYLoading
5.30.19 SPYNumberDateTimeFormat
5.30.20 SPYProgrammingLanguage
public class SPYLoading
{
public final static long spyUndefinedLanguage = -1;
public final static long spyJava = 0;
public final static long spyCpp = 1;
public final static long spyCSharp = 2;
}
5.30.21 SPYProjectItemTypes
5.30.22 SPYProjectType
public class SPYProjectType
{
public final static long = 0;
spyVisualStudioProject
5.30.23 SPYSampleXMLGenerationOptimization
5.30.24 SPYSampleXMLGenerationSchemaOrDTDAssignment
5.30.25 SPYSchemaDefKind
5.30.26 SPYSchemaDocumentationFormat
public class SPYSchemaDocumentationFormat
{
public final static long = 0;
spySchemaDoc_HTML
public final static long = 1;
spySchemaDoc_MSWord
public final static long = 2;
spySchemaDoc_RTF
}
5.30.27 SPYSchemaExtensionType
public class SPYSchemaExtensionType
{
public final static long = 0;
spySchemaExtension_None
public final static long = 1;
spySchemaExtension_SQL_XML
public final static long = 2;
spySchemaExtension_MS_SQL_Server
public final static long = 3;
spySchemaExtension_Oracle
}
5.30.28 SPYSchemaFormat
public class SPYSchemaFormat
{
public final static long = 0;
spySchemaFormat_Hierarchical
public final static long = 1;
spySchemaFormat_Flat
}
5.30.29 SPYTextDelimiters
5.30.30 SPYTextEnclosing
5.30.31 SPYTypeDetection
5.30.32 SPYURLTypes
5.30.33 SpyViewModes
5.30.34 SPYWhitespaceComparison
public class SPYWhitespaceComparison
{
public final static long = 0;
spyCompareAsIs
public final static long = 1;
spyCompareNormalized
public final static long = 2;
spyStripAll
}
5.30.35 SPYXMLDataKind
6 XMLSpy Integration
XMLSpyControl is a control that provides a means of integration of the XMLSpy user interface
and the functionality described in this section into most kinds of applications. ActiveX technology
was chosen so as to allow integration using any of a wide variety of languages; this enables
C++, C#, VisualBasic, or HTML to be used for integration. ActiveX components officially only
work with Microsoft Internet Explorer. All components are full OLE Controls, which makes
integration as simple as possible. Two different levels of integration are provided, thus enabling
the integration to be adapted to a wide range of needs.
To integrate XMLSpy you must install the XMLSpy Integration Package. Ensure that you install
XMLSpy first, and then the XMLSpy Integration Package.
For a successful integration you have to consider the following main design factors:
What technology or programming language can the hosting application use to integrate
the XMLSpyControl?
Should the integrated UI look exactly like XMLSpy with all its menus, toolbars, and
windows, or will a subset of these elements—like allowing only one document and a
restricted set of commands—be more effective?
How deep will the integration be? Should the XMLSpy user interface be used as is? Are
user interface extensions and/or restrictions required? Can some frequently used tasks
be automated?
The sections, Integration at the Application Level and Integration at Document Level, both of
which have examples in various programming languages, will help you to make the right
decisions quickly. The section, Object Reference, describes all COM objects that can be used
for integration, together with their properties and methods.
For automation tasks, the XMLSpy Automation Interface is accessible from the XMLSpyControl
as well.
For information about how to integrate XMLSpy into Microsoft Visual Studio see the section,
XMLSpy in Visual Studio.
The only ActiveX control you need to integrate is XMLSpyControl. Its property
IntegrationLevel defaults to application-level. You may use Appearance and
BorderStyle to configure the appearance of the control's wrapper window. Do not instantiate
or access XMLSpyControlDocument or XMLSpyControlPlaceHolder ActiveX controls
when integrating at application-level.
If you have any initialization to do or if you want to automate some behaviour of XMLSpy, use
the properties, methods, and events described for XMLSpyControl. Consider using
XMLSpyControl.Application for more complex access to XMLSpy functionality.
In this section is an example (Example: HTML) showing how the XMLSpy application can be
embedded in an HTML page. For usage with other programming languages, or more
sophisticated access, see the Examples of integration at document-level.
The code for this example is available at the following location in your XMLSpy installation:
Examples\ActiveX\HTML\XMLSpyActiveX_ApplicationLevel.htm.
<OBJECT id="objXMLSpyControl"
Classid="clsid:a258bba2-3835-4c16-8590-72b44f52c471"
width="1000"
height="700"
VIEWASTEXT>
</OBJECT>
onclick="BtnOpenMEFile()">
When clicked, a predefined document will be opened in the XMLSpyControl. We use a method
to locate the file relative to the XMLSpyControl so the example can run on different installations.
}
</SCRIPT>
Then we provide the script that will validate the current document.
if ( objDocument == null )
alert( "no active document found" );
else
{
// define as arrays to support their usage as return parameters
var errorText = new Array(1);
var errorPos = new Array(1);
var badData = new Array(1);
if (! valid)
{
// compose the error description
var text = errorText;
}
else
alert("Docuent is valid"); }
}
</SCRIPT>
If necessary, a replacement for the menus and toolbars of XMLSpy must be provided by your
application.
You will need to instantiate and access multiple ActiveX controls, depending on which user
interface parts you want to re-use. All these controls are contained in the XMLSpyControl OCX.
Use XMLSpyControl to set the integration level and access application wide
functionality.
Use XMLSpyControlDocument to create any number of editor windows. It may be
sufficient to create only one window and re-use it, depending on your needs.
Optionally Use XMLSpyControlPlaceholder to embed XMLSpy entry helper windows,
validator output or other windows mentioned above.
Access run-time information about commands, menus, and toolbars available in
XMLSpyControl to seamlessly integrate these commands into your application's menus
and toolbars. See Query XMLSpy Commands for more information.
If you want to automate some behaviour of XMLSpy use the properties, methods, and events
described for the XMLSpyControl, XMLSpyControlDocument and XMLSpyControlPlaceHolder.
Consider using XMLSpyControl.Application, XMLSpyControlDocument.Document and
XMLSpyControlPlaceHolder.Project for more complex access to XMLSpy functionality.
However, to open a document always use XMLSpyControlDocument.Open or
XMLSpyControlDocument.New on the appropriate document control. To open a project always
use XMLSpyControlPlaceHolder.OpenProject on a placeholder control embedding a XMLSpy
project window.
See Examples on how to instantiate and access the necessary controls in different
programming environments.
Avoid using the method Open since this might lead to unexpected results. Use the
corresponding open methods of XMLSpyControlDocument and
XMLSpyControlPlaceHolder, instead.
See Query XMLSpy Commands for a description of how to integrate XMLSpy commands into
your application. Send commands to XMLSpy via the method Exec. Query if a command is
currently enabled or disabled using the method QueryStatus.
The control does not supports a read-only mode. The value of the property ReadOnly is
ignored.
Use Path and Save or methods and properties accessible via the property Document to
access document functionality.
For placeholder controls that select the XMLSpy project window, additional methods are
available. Use OpenProject to load a XMLSpy project. Use the property Project and the
methods and properties from the XMLSpy automation interface to perform any other project
related operations.
6.2.5 Examples
This section contains examples of XMLSpy document-level integration using different container
environments and programming languages. Source code for all examples is available in the
folder Examples\ActiveX of your XMLSpy installation.
C#
The C# example shows how to integrate the XMLSpyControl in a common desktop application
created with C# using Visual Studio 2008. The following topics are covered:
Integration of a XMLSpyControl Document control to embed a XMLSpy document editing
window.
Usage of a XMLSpyControlPlaceholder controls to embed the XMLSpy XPath dialog
window.
Introduction
Adding the XMLSpy components to the Toolbox
Before you take a look at the sample project please add the assemblies to the .NET IDE
Toolbox. The XMLSpy Installer will have already installed the assemblies in the .NET Global
Assembly Cache (GAC). If you open the Toolbox dialog under Tools | Add/Remove Toolbox
Items the controls will appear as AxXMLSpyControl, AxXMLSpyControlDocument and
AxXMLSpyControlPlaceholder on the .NET Framework Components tab. Check all to
make them available to the IDE.
Now you can open the XPathDialog.sln file in the ActiveX\C#\XPathDialog folder to
load the project.
The example project adds this instance to the main MdiContainer MDIMain. If you open
MDIMain in the Design View from the Solution Explorer you will see a light blue rectangle at the
top-left side in the client area of the Frame window. Selecting this rectangle will show you the
properties of the XMLSpyControl. It is important to set the IntegrationLevel property to
ICActiveXIntegrationOnDocumentLevel in order to turn on the Document and
Placeholder support of the XMLSpy library. You can set the Visible flag to False to avoid any
confusion about the control for the user.
window.
The code to add the commands will be placed in the MDIMain method of the
XMLSpyApplication class in the file MDIMain.cs:
public MDIMain()
{
.
.
.
XMLSpyControlLib.XMLSpyCommands objCommands;
objCommands = axXMLSpyControl.CommandsStructure;
// We are looking for the Menu with the name IDR_XMLSPY. This menu
contains
// the complete main menu of XMLSpy.
if(objCommand.Label == "IDR_XMLSPY")
{
InsertMenuStructure(mainMenu.MenuItems, 1, objCommand, 0, 0,
false);
}
}
.
.
.
}
mainMenu is the name of the menu object of the MDI Frame window created in the Visual
Studio IDE. InsertMenuStructure takes the XMLSpy menu from the IDR_XMLSPY command
object and adds the XMLSpy menu structure to the already existing menu of the sample project.
No commands from the File, Project, or Window menu are added.
The new commands are instances of the class CustomMenuItem, which is defined in
CustomMenuItem.cs. This class has an additional member to save the XMLSpy command
ID, which is taken to execute the command using Exec on selecting the menu item. This code
from InsertMenuStructure creates the new command:
if(objCommand.IsSeparator)
newMenuItem.Text = "-";
else
{
newMenuItem.Text = strLabel;
newMenuItem.m_XMLSpyCmdID = (int)objCommand.ID;
newMenuItem.Click += new EventHandler(AltovaMenuItem_Click);
You can see that all commands get the same event handler AltovaMenuItem_Click which
does the processing of the command:
ProcessCommand(customItem.m_XMLSpyCmdID);
}
}
if(docXMLSpy != null)
docXMLSpy.axXMLSpyControlDoc.Exec(nID);
else
axXMLSpyControl.Exec(nID);
}
ProcessCommand delegates the execution either to the XMLSpyControl itself or to any active
XMLSpy document loaded in a XMLSpyControlDocument control. This is necessary because
the XMLSpyControl has no way to know which document is currently active in the hosting
application.
Handling Events
Because all events in the XMLSpy library are based on connection points, you can use the C#
delegate mechanism to provide the custom event handlers. You will always find a complete list
of events on the property page of each control of the XMLSpy library. The picture below shows
the events of the main XMLSpyControl:
As you can see, the example project only overrides the OnFileExternalChange event. The
creation of the C# delegate is done for you by the C# Framework. All you need to do is to fill the
empty event handler. The handler implementation turns off any file reloading and displays a
message box to inform the user that a file loaded by the XMLSpyControl has been changed
from outside:
After you load the document, you can try using the XPath dialog.
HTML
This example shows an integration of the XMLSpy control at document-level into a HTML page.
The following topics are covered:
Instantiate a XMLSpyControl ActiveX control object in HTML code
Instantiate a XMLSpyControlDocument ActiveX control to allow editing a XMLSpy file
Instantiate one XMLSpyControlPlaceHolder for a XMLSpyControl project window
Instantiate one XMLSpyControlPlaceHolder to alternatively host one of the XMLSpy
helper windows
Instantiate one XMLSpyControlPlaceHolder ActiveX control to show the XMLSpy
validation output window
Create a simple customer toolbar for some heavy-used XMLSpy commands
Add some more buttons that use the COM automation interface of XMLSpy
Use event handlers to update command buttons
<OBJECT id="objXMLSpyXXMLSpyControl"
Classid="clsid:a258bba2-3835-4c16-8590-72b44f52c471"
width="0"
height="0"
VIEWASTEXT>
<PARAM NAME="IntegrationLevel" VALUE="1">
</OBJECT>
<OBJECT id="objDoc1"
Classid="clsid:DFBB0871-DAFE-4502-BB66-08CEB7DF5255"
width="600"
height="500"
VIEWASTEXT>
</OBJECT>
<OBJECT id="objProjectWindow"
Classid="clsid:FDEC3B04-05F2-427d-988C-F03A85DE53C2"
width="200"
height="200"
VIEWASTEXT>
<PARAM name="PlaceholderWindowID" value="3">
<PARAM name="FileName" value="Examples/Examples.spp">
</OBJECT>
<OBJECT id="objEHWindow"
Classid="clsid:135DEEF4-6DF0-47c2-8F8C-F145F5F3F672"
width="200"
height="200"
VIEWASTEXT>
<PARAM name="PlaceholderWindowID" value="0">
</OBJECT>
Three buttons allow us to switch the actual window that will be shown. The JavaScript execute
on-button-click sets the property PlaceHolderWindowID to the corresponding value defined in
XMLSpyControlPlaceholderWindow.
On clicking one of these buttons the corresponding command ID is sent to the manager control.
// -------------------------------------------------------------------
// open a new empty document in the specified document control window.
function BtnNewFile(objDocCtrl)
{
objDocCtrl.Open("");
objDocCtrl.setActive();
}
// -------------------------------------------------------------------
// Saves the current file in the specified document control window.
function BtnSaveFile(objDocCtrl)
{
if(objDocCtrl.Path.length > 0)
objDocCtrl.SaveDocument();
else
{
if(strPath.value.length > 0)
{
objDocCtrl.Path = strPath.value;
objDocCtrl.Save();
}
else
{
alert("Please set path for the document first!");
strPath.focus();
}
}
objDocCtrl.setActive();
}
// ----------------------------------------------------------------------
// check validity of current document.
// if validation fails, show validation result in alert box .
function BtnValidate()
{
// get top-level object of automation interface
var objApp = objXMLSpyControl.Application;
if ( objDocument == null )
alert( "no active document found" );
else
{
// define as arrays to support their usage as return parameters
var errorText = new Array(1);
var errorPos = new Array(1);
var badData = new Array(1);
if (! valid)
{
// compose the error description
var text = errorText;
Depending on the edition of XMLSpy you have installed, some of these commands might not be
supported. See Query XMLSpy Commands on how to query the current resource structure and
command availability.
File Menu
Edit Menu
Project Menu
XML menu
DTD/Schema Menu
Schema Design Menu
XSL/XQuery Menu
Authentic Menu
Convert Menu
View Menu
Browser Menu
WSDL Menu
SOAPMenu
Tools Menu
Window Menu
Help Menu
6.3.13 SOAPMenu
Commands from the SOAP menu:
Some restrictions apply to the usage of the XMLSpy automation interface when integrating
XMLSpyControl at document-level. See Integration at document level for details.
To give access to standard XMLSpy functionality, objects of the XMLSpy automation interface
can be accessed as well. See XMLSpyControl.Application,
XMLSpyControlDocument.Document and XMLSpyControlPlaceHolder.Project for more
information.
6.5.1 XMLSpyCommand
Properties:
ID
Label
IsSeparator
ToolTip
StatusText
Accelerator
SubCommands
Description:
Each Command object can be one of three possible types:
Command: ID is set to a value greater 0 and Label is set to the command name.
IsSeparator is false and the SubCommands collection is empty.
Separator: IsSeparator is true. ID is 0 and Label is not set. The SubCommands
collection is empty.
(Sub) Menu: The SubCommands collection contains Command objects and Label is
the name of the menu. ID is set to 0 and IsSeparator is false.
Accelerator
Property: Label as string
Description:
For command objects that are children of the ALL_COMMANDS collection, this is the
accelerator key defined for the command. If the command has no accelerator key assigned, this
property returns the empty string.
The string representation of the accelerator key has the following format:
[ALT+][CTRL+][SHIFT+]key
Where key is converted using the Windows Platform SDK function GetKeyNameText.
ID
Property: ID as long
Description:
ID is 0 for separators and menus.
For commands, this is the ID which can be used with Exec and QueryStatus.
IsSeparator
Property: IsSeparator as boolean
Description:
True if the command is a separator.
Label
Property: Label as string
Description:
Label is empty for separators.
For command objects that are children of the ALL_COMMANDS collection, this is a unique
name. Command icons are stored in files with this name. See Query Commands for more
information.
For command objects that are children of menus, the label property holds the command's menu
text.
For sub-menus, this property holds the menu text.
StatusText
Property: Label as string
Description:
For command objects that are children of the ALL_COMMANDS collection, this is the text
shown in the status bar when the command is selected.
SubCommands
Property: SubCommands as Commands
Description:
The SubCommands collection holds any sub-commands if this command is actually a menu or
submenu.
ToolTip
Property: ToolTip as string
Description:
For command objects that are children of the ALL_COMMANDS collection, this is the text
shown as tool-tip.
6.5.2 XMLSpyCommands
Properties:
Count
Item
Description:
Collection of Command objects to get access to command labels and IDs of the XMLSpyControl.
Those commands can be executed with the Exec method and their status can be queried with
QueryStatus.
Count
Property: Count as long
Description:
Number of Command objects on this level of the collection.
Item
Property: Item (n as long) as Command
Description:
Gets the command with the index n in this collection. Index is 1-based.
6.5.3 XMLSpyControl
Properties:
IntegrationLevel
Appearance
Application
BorderStyle
CommandsList
CommandsStructure (deprecated)
EnableUserPrompts
MainMenu
Toolbars
Methods:
Open
Exec
QueryStatus
Events:
OnUpdateCmdUI
OnOpenedOrFocused
OnCloseEditingWindow
OnFileChangedAlert
OnContextChanged
OnDocumentOpened
OnValidationWindowUpdated
This object is a complete ActiveX control and should only be visible if the XMLSpy library is
used in the Application Level mode.
CLSID: a258bba2-3835-4c16-8590-72b44f52c471
ProgID: Altova.XMLSpyControl
Properties
The following properties are defined:
IntegrationLevel
EnableUserPrompts
Appearance
BorderStyle
Access to XMLSpyAPI:
Application
Appearance
Property: Appearance as short
Description:
A value not equal to 0 displays a client edge around the control. Default value is 0.
Application
Property: Application as Application
Dispatch Id: 1
Description:
The Application property gives access to the Application object of the complete XMLSpy
automation server API. The property is read-only.
BorderStyle
Property: BorderStyle as short
Description:
A value of 1 displays the control with a thin border. Default value is 0.
CommandsList
Property: CommandList as Commands (read-only)
Description:
This property returns a flat list of all commands defined available with XMLSpyControl. For more
information see C# Sample.
EnableUserPrompts
Property: EnableUserPrompts as boolean
Description:
Setting this property to false, disables user prompts in the control. The default value is true.
IntegrationLevel
Property: IntegrationLevel as ICActiveXIntegrationLevel
Description:
The IntegrationLevel property determines the operation mode of the control. See also
Integration at the application level and Integration at document level for more information.
Note: It is important to set this property immediately after the creation of the XMLSpyControl
object.
MainMenu
Property: MainMenu as C om m and(read-only)
Description:
This property gives access to the description of the XMLSpyControl main menu. For more
information see C# Sample.
Toolbars
Property: Toolbars as C om m ands(read-only)
Description:
This property returns a list of all toolbar descriptions that describe all toolbars available with
XMLSpyControl. For more information see C# Sample.
Methods
The following methods are defined:
Open
Exec
QueryStatus
Exec
Method: Exec (nCmdID as long) as boolean
Dispatch Id: 6
Description:
Exec calls the XMLSpy command with the ID nCmdID. If the command can be executed, the
method returns true. See also CommandsStructure to get a list of all available commands
and QueryStatus to retrieve the status of any command.
Open
Method: Open (strFilePath as string) as boolean
Dispatch Id: 5
Description:
The result of the method depends on the extension passed in the argument strFilePath. If
the file extension is .sps, a new document is opened. If the file extension is .svp, the
corresponding project is opened. If a different file extension is passed into the method, the
control tries to load the file as a new component into the active document.
Do not use this method to load documents or projects when using the control in document-level
integration mode. Instead, use XMLSpyControlDocument.Open and
XMLSpyControlPlaceHolder.OpenProject.
QueryStatus
Method: QueryStatus (nCmdID as long) as long
Dispatch Id: 7
Description:
QueryStatus returns the enabled/disabled and checked/unchecked status of the command
specified by nCmdID. The status is returned as a bit mask.
-----------------------------------------------------------------------------------------------------------------------
0 1 Supported Set if the command is supported.
1 2 Enabled Set if the command is enabled (can be
executed).
2 4 Checked Set if the command is checked.
This means that if QueryStatus returns 0 the command ID is not recognized as a valid
XMLSpy command. If QueryStatus returns a value of 1 or 5, the command is disabled.
Events
The XMLSpyControl ActiveX control provides the following connection point events:
OnUpdateCmdUI
OnOpenedOrFocused
OnCloseEditingWindow
OnFileChangedAlert
OnContextChanged
OnDocumentOpened
OnValidationWindowUpdated
OnCloseEditingWindow
Event: OnCloseEditingWindow (i_strFilePath as String) as boolean
Description:
This event is triggered when XMLSpy needs to close an already open document. As an answer
to this event, clients should close the editor window associated with i_strFilePath. Returning true
from this event indicates that the client has closed the document. Clients can return false if no
specific handling is required and XMLSpyControl should try to close the editor and destroy the
associated document control.
OnContextChanged
Event: OnContextChanged (i_strContextName as String, i_bActive as bool) as bool
Description:
This event is triggered when XMLSpy activates or de-actives one of the following operational
contexts:
XSLT Profiling - "XSLTProfiling" is passed as the context name
XSLT / XQuery debugging - "DebuggingXSLT" is passed as the context name
SOAP debugging - "DebuggingSOAP" is passed as the context name
OnDocumentOpened
Event: OnDocumentOpened (objDocument as Document)
Dispatch Id: 1
Description:
This event is triggered whenever a document is opened. The argument objDocument is a
Document object from the XMLSpy automation interface and can be used to query for more
details about the document, or perform additional operations. When integrating on
document-level, it is often better to use the event
XMLSpyControlDocument.OnDocumentOpened instead.
OnFileChangedAlert
Event: OnFileChangedAlert (i_strFilePath as String) as bool
Description:
This event is triggered when a file loaded with XMLSpyControl, is changed on the harddisk by
another application. Clients should return true, if they handled the event, or false, if XMLSpy
should handle it in its customary way, i.e. prompting the user for reload.
OnLicenseProblem
Event: OnLicenseProblem (i_strLicenseProblemText as String)
Description:
This event is triggered when XMLSpyControl detects that no valid license is available for this
control. In case of restricted user licenses this can happen some time after the control has been
initialized. Integrators should use this event to disable access to this control's functionality. After
returning from this event, the control will block access to its functionality (e.g. show empty
windows in its controls and return errors on requests).
OnOpenedOrFocused
Event: OnOpenedOrFocused (i_strFilePath as String, i_bOpenWithThisControl as
bool)
Description:
When integrating at application level, this event informs clients that a document has been
opened, or made active by XMLSpy.
When integrating at document level, this event instructs the client to open the file
i_strFilePath in a document window. If the file is already open, the corresponding
document window should be made the active window.
OnToolWindowUpdated
Event: OnToolWindowUpdated(pToolWnd as long )
Description:
This event is triggered when the tool window is updated.
OnUpdateCmdUI
Event: OnUpdateCmdUI ()
Description:
Called frequently to give integrators a good opportunity to check status of XMLSpy commands
using XMLSpyControl.QueryStatus. Do not perform long operations in this callback.
OnValidationWindowUpdated
Event: OnValidationWindowUpdated ()
Dispatch Id: 3
Description:
This event is triggered whenever the validation output window, is updated with new information.
6.5.4 XMLSpyControlDocument
Properties:
Appearance
BorderStyle
Document
IsModified
Path
ReadOnly
Methods:
Exec
New
Open
QueryStatus
Reload
Save
SaveAs
Events:
OnDocumentOpened
OnDocumentClosed
OnModifiedFlagChanged
OnContextChanged
OnFileChangedAlert
OnActivate
If the XMLSpyControl is integrated in the Document Level mode each document is displayed in
an own object of type XMLSpyControlDocument. The XMLSpyControlDocument contains
only one document at the time but can be reused to display different files one after another.
CLSID: 52A552E6-2AB8-4e3e-B545-BE998233DDA0
ProgID: Altova.XMLSpyControlDocument
Properties
The following properties are defined:
ReadOnly
IsModified
Path
Appearance
BorderStyle
Access to XMLSpyAPI:
Document
Appearance
Property: Appearance as short
Description:
A value not equal to 0 displays a client edge around the document control. Default value is 0.
BorderStyle
Property: BorderStyle as short
Description:
A value of 1 displays the control with a thin border. Default value is 0.
Document
Property: Document as Document
Dispatch Id: 1
Description:
The Document property gives access to the Document object of the XMLSpy automation
server API. This interface provides additional functionalities which can be used with the
document loaded in the control. The property is read-only.
IsModified
Property: IsModified as boolean (read-only)
Description:
IsModified is true if the document content has changed since the last open, reload or save
operation. It is false, otherwise.
Path
Property: Path as string
Description:
Sets or gets the full path name of the document loaded into the control.
ReadOnly
Property: ReadOnly as boolean
Description:
Using this property you can turn on and off the read-only mode of the document. If ReadOnly
is true it is not possible to do any modifications.
Methods
The following methods are defined:
Document handling:
New
Open
Reload
Save
SaveAs
Command Handling:
Exec
QueryStatus
Exec
Method: Exec (nCmdID as long) as boolean
Dispatch Id: 8
Description:
Exec calls the XMLSpy command with the ID nCmdID. If the command can be executed, the
method returns true. The client should call the Exec method of the document control if there is
currently an active document available in the application.
See also CommandsStructure to get a list of all available commands and QueryStatus to
retrieve the status of any command.
New
Method: New () as boolean
Description:
This method initializes a new document inside the control..
Open
Method: Open (strFileName as string) as boolean
Description:
Open loads the file strFileName as the new document into the control.
QueryStatus
Method: QueryStatus (nCmdID as long) as long
Dispatch Id: 9
Description:
QueryStatus returns the enabled/disabled and checked/unchecked status of the command
specified by nCmdID. The status is returned as a bit mask.
-----------------------------------------------------------------------------------------------------------------------
0 1 Supported Set if the command is supported.
1 2 Enabled Set if the command is enabled (can be
executed).
2 4 Checked Set if the command is checked.
This means that if QueryStatus returns 0 the command ID is not recognized as a valid
XMLSpy command. If QueryStatus returns a value of 1 or 5 the command is disabled. The
client should call the QueryStatus method of the document control if there is currently an
active document available in the application.
Reload
Method: Reload () as boolean
Description:
Reload updates the document content from the file system.
Save
Method: Save () as boolean
Description:
Save saves the current document at the location Path.
SaveAs
Method: OpenDocument (strFileName as string) as boolean
Description:
SaveAs sets Path to strFileName and then saves the document to this location.
Events
The XMLSpyControlDocument ActiveX control provides following connection point events:
OnDocumentOpened
OnDocumentClosed
OnModifiedFlagChanged
OnContextChanged
OnFileChangedAlert
OnActivate
OnSetEditorTitle
OnActivate
Event: OnActivate ()
Description:
This event is triggered when the document control is activated, has the focus, and is ready for
user input.
OnContextChanged
Event: OnContextChanged (i_strContextName as String, i_bActive as bool) as bool
Description:
This event is triggered when this document is shown in a different XMLSpy view. The following
values are passed:
Grid view - "View_0" is passed as the context name
Text view - "View_1" is passed as the context name
Browser view - "View_2" is passed as the context name
Schema view - "View_3" is passed as the context name
Authentic view - "View_4" is passed as the context name
WSDL view - "View_5" is passed as the context name
OnDocumentClosed
Event: OnDocumentClosed (objDocument as Document)
Description:
This event is triggered whenever the document loaded into this control is closed. The argument
objDocument is a Document object from the XMLSpy automation interface and should be
used with care.
OnDocumentOpened
Event: OnDocumentOpened (objDocument as Document)
Description:
This event is triggered whenever a document is opened in this control. The argument
objDocument is a Document object from the XMLSpy automation interface, and can be used
to query for more details about the document, or perform additional operations.
OnDocumentSaveAs
Event: OnContextDocumentSaveAs (i_strFileName as String)
Description:
This event is triggered when this document gets internally saved under a new name.
OnFileChangedAlert
Event: OnFileChangedAlert () as bool
Description:
This event is triggered when the file loaded into this document control, is changed on the
harddisk by another application. Clients should return true, if they handled the event, or false, if
XMLSpy should handle it in its customary way, i.e. prompting the user for reload.
OnModifiedFlagChanged
Event: OnModifiedFlagChanged (i_bIsModified as boolean)
Description:
This event gets triggered whenever the document changes between modified and unmodified
state. The parameter i_bIsModifed is true if the document contents differs from the original
content, and false, otherwise.
OnSetEditorTitle
Event: OnSetEditorTitle ()
Description:
This event is being raised when the contained document is being internally renamed.
6.5.5 XMLSpyControlPlaceHolder
Properties available for all kinds of placeholder windows:
PlaceholderWindowID
CLSID: 135DEEF4-6DF0-47c2-8F8C-F145F5F3F672
ProgID: Altova.XMLSpyControlPlaceHolder
Properties
The following properties are defined:
PlaceholderWindowID
Access to XMLSpyAPI:
Project
Label
Property: Label as String (read-only)
Description:
This property gives access to the title of the placeholder. The property is read-only.
PlaceholderWindowID
Property: PlaceholderWindowID as XMLSpyControlPlaceholderWindow
Dispatch Id: 1
Description:
Using this property the object knows which XMLSpy window should be displayed in the client
area of the control. The PlaceholderWindowID can be set at any time to any valid value of
the XMLSpyControlPlaceholderWindow enumeration. The control changes its state
immediately and shows the new XMLSpy window.
Project
Property: Project as Project (read-only)
Dispatch Id: 2
Description:
The Project property gives access to the Project object of the XMLSpy automation server
API. This interface provides additional functionalities which can be used with the project loaded
into the control. The property will return a valid project interface only if the placeholder window
has PlaceholderWindowID with a value of XMLSpyXProjectWindow (=3). The property
is read-only.
Methods
The following method is defined:
OpenProject
CloseProject
OpenProject
Method: OpenProject (strFileName as string) as boolean
Dispatch Id: 3
Description:
OpenProject loads the file strFileName as the new project into the control. The method will
fail if the placeholder window has a PlaceholderWindowID different to
XMLSpyXProjectWindow (=3).
CloseProject
Method: CloseProject ()
Dispatch Id: 4
Description:
CloseProject closes the project loaded the control. The method will fail if the placeholder
window has a PlaceholderWindowID different to XMLSpyXProjectWindow (=3).
Events
The XMLSpyControlPlaceholder ActiveX control provides following connection point events:
OnModifiedFlagChanged
OnModifiedFlagChanged
Event: OnModifiedFlagChanged (i_bIsModified as boolean)
Dispatch Id: 1
Description:
This event gets triggered only for placeholder controls with a PlaceholderWindowID of
XMLSpyXProjectWindow (=3). The event is fired whenever the project content changes
between modified and unmodified state. The parameter i_bIsModifed is true if the project
contents differs from the original content, and false, otherwise.
OnSetLabel
Event: OnSetLabel(i_strNewLabel as string)
Description:
Raised when the title of the placeholder window is changed.
6.5.6 Enumerations
The following enumerations are defined:
ICActiveXIntegrationLevel
XMLSpyControlPlaceholderWindow
ICActiveXIntegrationLevel
Possible values for the IntegrationLevel property of the XMLSpyControl.
ICActiveXIntegrationOnApplicationLevel = 0
ICActiveXIntegrationOnDocumentLevel = 1
XMLSpyControlPlaceholderWindow
This enumeration contains the list of the supported additional XMLSpy windows.
XMLSpyControlNoToolWnd = -1
XMLSpyControlEntryHelperTopToolWnd = 0
XMLSpyControlEntryHelperMiddleToolWnd = 1
XMLSpyControlEntryHelperBottomToolWnd = 2
XMLSpyControlValidatorOutputToolWnd = 3
XMLSpyControlProjectWindowToolWnd = 4
XMLSpyControlXSLTDebuggerContextToolWnd = 5
XMLSpyControlXSLTDebuggerCallstackToolWnd = 6
XMLSpyControlXSLTDebuggerVariableToolWnd = 7
XMLSpyControlXSLTDebuggerWatchToolWnd = 8
XMLSpyControlXSLTDebuggerTemplateToolWnd = 9
XMLSpyControlXSLTDebuggerInfoToolWnd = 10
XMLSpyControlXSLTDebuggerMessageToolWnd = 11
XMLSpyControlXSLTDebuggerTraceToolWnd = 12
XMLSpyControlSOAPDebuggerToolWnd = 13
XMLSpyControlXPathProfilerListToolWnd = 14
XMLSpyControlXPathProfilerTreeToolWnd = 15
XMLSpyControlXPathDialogToolWnd = 16
XMLSpyControlDBQueryManagerToolWnd = 17
XMLSpyControlInfoToolWnd = 18
XMLSpyControlXSLOutlineToolWnd = 19
XMLSpyControlSchemaFindToolWnd = 20
Appendices
1282
Appendices
These appendices contain technical information about XMLSpy and important licensing
information. Each appendix contains sub-sections as given below:
Engine Information
Altova XSLT 1.0 Engine
Altova XSLT 2.0 Engine
Altova XQuery 1.0 Engine
XPath 2.0 and XQuery 1.0 Functions
Extensions
Technical Data
OS and memory requirements
Altova XML Parser
Altova XSLT and XQuery Engines
Unicode support
Internet usage
License Information
Electronic software distribution
Software activation and license metering
Copyrights
End User License Agreement
1 Engine Information
This section contains information about implementation-specific features of the Altova XSLT 1.0
Engine, Altova XSLT 2.0 Engine, and Altova XQuery 1.0 Engine.
Limitations
The xsl:preserve-space and xsl:strip-space elements are not supported.
When the method attribute of xsl:output is set to HTML, or if HTML output is
selected by default, then special characters in the XML or XSLT file are inserted in the
HTML document directly as special characters; they are not inserted as HTML
character references in the output. For instance, the character   (the decimal
character reference for a non-breaking space) is not inserted as in the HTML
code, but directly as a non-breaking space.
For any node selection that selects text nodes also, boundary-whitespace-only text nodes would
typically also be included in the selection. However, since the XML Infoset used by the Altova
engines has boundary-whitespace-only text nodes stripped from it, these nodes are not present
in the XML Infoset. As a result, the size of the selection and the numbering of nodes in the
selection will be different than that for a selection which included these text nodes. The
fn:position(), fn:last(), and fn:count() functions, therefore, could produce results
that are different from those produced by some other processors.
Note: If a boundary-whitespace-only text node is required in the output, then insert the required
whitespace within one of the two adjoining child elements. For example, the XML fragment:
<para>This is <b>bold</b> <i>italic</>.</para>
will produce:
This is bolditalic.
To get a space between bold and italic in the output, insert a space character within either
the <b> or <i> elements in the XML source. For example:
<para>This is <b>bold</b> <i> italic</i>.</para> or
<para>This is <b>bold </b> <i>italic</i>.</para> or
<para>This is <b>bold</b><i> italic</i>.</para>
When any of the para elements above is processed with the same XSLT template given
above, it will produce:
This is bold italic.
For information about implementation-specific behavior of XPath 2.0 functions, see the section,
XPath 2.0 and XQuery 1.0 Functions.
Backwards Compatibility
The Altova XSLT 2.0 Engine is backwards compatible. The only time the backwards
compatibility of the XSLT 2.0 Engine comes into play is when using the XSLT 2.0 Engine of
Altova XML to process an XSLT 1.0 stylesheet. Note that there could be differences in the
outputs produced by the XSLT 1.0 Engine and the backwards-compatible XSLT 2.0 Engine.
In all other Altova products, the backwards-compatibility issue never arises. This is because
these products automatically select the appropriate engine for the transformation. For example,
consider that in XMLSpy you specify that a certain XML document be processed with an XSLT
1.0 stylesheet. When the transformation command is invoked, XMLSpy automatically selects
the XSLT 1.0 Engine of XMLSpy to carry out the transformation.
Note: The stylesheet version is specified in the version attribute of the stylesheet or
transform element of the stylesheet.
Namespaces
Your XSLT 2.0 stylesheet should declare the following namespaces in order for you to be able
to use the type constructors and functions available in XSLT 2.0. The prefixes given below are
conventionally used; you could use alternative prefixes if you wish.
The Altova XSLT 2.0 Engine uses the XPath 2.0 and XQuery 1.0 Functions namespace
(listed in the table above) as its default functions namespace. So you can use XPath
2.0 and XSLT 2.0 functions in your stylesheet without any prefix. If you declare the
XPath 2.0 Functions namespace in your stylesheet with a prefix, then you can
additionally use the prefix assigned in the declaration.
When using type constructors and types from the XML Schema namespace, the prefix
used in the namespace declaration must be used when calling the type constructor (for
example, xs:date).
With the CRs of 23 January 2007, the untypedAtomic and duration datatypes (
dayTimeDuration and yearMonthDuration), which were formerly in the XPath
Datatypes namespace (typically prefixed xdt:) have been moved to the XML Schema
namespace.
Some XPath 2.0 functions have the same name as XML Schema datatypes. For
example, for the XPath functions fn:string and fn:boolean there exist XML
Schema datatypes with the same local names: xs:string and xs:boolean. So if
you were to use the XPath expression string('Hello'), the expression evaluates
as fn:string('Hello')—not as xs:string('Hello').
Schema-awareness
The Altova XSLT 2.0 Engine is schema-aware.
Note: If a boundary-whitespace-only text node is required in the output, then insert the required
whitespace within one of the two adjoining child elements. For example, the XML fragment:
<para>This is <b>bold</b> <i>italic</>.</para>
will produce:
This is bolditalic.
To get a space between bold and italic in the output, insert a space character within either
the <b> or <i> elements in the XML source. For example:
<para>This is <b>bold</b> <i> italic</>.</para> or
<para>This is <b>bold </b> <i>italic</>.</para> or
<para>This is <b>bold</b><i> italic</>.</para>
When such an XML fragment is processed with the same XSLT template given above, it will
produce:
This is bold italic.
Limitations and implementation-specific behavior of XSLT 2.0 elements and functions are listed
in the section XSLT 2.0 Elements and Functions.
Implementation-specific behavior
Given below is a description of how the Altova XSLT 2.0 Engine handles
implementation-specific aspects of the behavior of certain XSLT 2.0 functions.
xsl:result-document
Additionally supported encodings are: base16tobinary and base64tobinary.
function-available
The function tests for the availability of in-scope functions (XSLT 2.0, XPath 2.0, and extension
functions).
unparsed-text
The href attribute accepts (i) relative paths for files in the base-uri folder, and (ii) absolute
paths with or without the file:// protocol. Additionally supported encodings are:
binarytobase16 and binarytobase64.
Standards conformance
The Altova XQuery 1.0 Engine conforms to the World Wide Web Consortium's (W3C's) XQuery
1.0 Recommendation of 23 January 2007. The XQuery standard gives implementations
discretion about how to implement many features. Given below is a list explaining how the
Altova XQuery 1.0 Engine implements these features.
Schema awareness
The Altova XQuery 1.0 Engine is schema-aware.
Encoding
The UTF-8 and UTF-16 character encodings are supported.
Namespaces
The following namespace URIs and their associated bindings are pre-defined.
If namespaces for functions, type constructors, node tests, etc are wrongly assigned, an error is
reported. Note, however, that some functions have the same name as schema datatypes, e.g.
fn:string and fn:boolean. (Both xs:string and xs:boolean are defined.) The
namespace prefix determines whether the function or type constructor is used.
Dynamic type checking is carried out at run-time, when the query is actually executed. If a type
is incompatible with the requirement of an operation, an error is reported. For example, the
expression xs:string("1") + 1 returns an error because the addition operation cannot be
carried out on an operand of type xs:string.
Library Modules
Library modules store functions and variables so they can be reused. The Altova XQuery 1.0
Engine supports modules that are stored in a single external XQuery file. Such a module file
must contain a module declaration in its prolog, which associates a target namespace. Here is
an example module:
module namespace libns="urn:module-library";
declare variable $libns:company := "Altova";
declare function libns:webaddress() { "http://www.altova.com" };
All functions and variables declared in the module belong to the namespace associated with the
module. The module is used by importing it into an XQuery file with the import module
statement in the query prolog. The import module statement only imports functions and
variables declared directly in the library module file. As follows:
import module namespace modlib = "urn:module-library" at
"modulefilename.xq";
if ($modlib:company = "Altova")
then modlib:webaddress()
else error("No match found.")
External functions
External functions are not supported, i.e. in those expressions using the external keyword, as
in:
declare function hoo($param as xs:integer) as xs:string external;
Collations
The default collation is the Unicode codepoint collation. No other collation is currently
supported. Comparisons, including the fn:max function, are based on this collation.
Character normalization
No character normalization form is supported.
This section describes how XPath 2.0 and XQuery 1.0 functions are handled by the Altova
XPath 2.0 Engine and Altova XQuery 1.0 Engine. Only those functions are listed, for which the
behavior is implementation-specific, or where the behavior of an individual function is different in
any of the three environments in which these functions are used (that is, in XSLT 2.0, in XQuery
1.0, and in the XPath Evaluator of XMLSpy). Note that this section does not describe how to use
these functions. For more information about the usage of functions, see the World Wide Web
Consortium's (W3C's) XQuery 1.0 and XPath 2.0 Functions and Operators Recommendation
of 23 January 2007.
For any node selection that selects text nodes also, boundary-whitespace-only text nodes would
typically also be included in the selection. However, since the XML Infoset used by the Altova
engines has boundary-whitespace-only text nodes stripped from it, these nodes are not present
in the XML Infoset. As a result, the size of the selection and the numbering of nodes in the
selection will be different than that for a selection which included these text nodes. The
fn:position(), fn:last(), fn:count(), and fn:deep-equal() functions, therefore,
could produce results that are different from those produced by some other processors.
Numeric notation
On output, when an xs:double is converted to a string, scientific notation (for example,
1.0E12) is used when the absolute value is less than 0.000001 or greater than 1,000,000.
Otherwise decimal or integer notation is used.
Precision of xs:decimal
The precision refers to the number of digits in the number, and a minimum of 18 digits is
required by the specification. For division operations that produce a result of type xs:decimal,
the precision is 19 digits after the decimal point with no rounding.
Implicit timezone
When two date, time, or dateTime values need to be compared, the timezone of the values
being compared need to be known. When the timezone is not explicitly given in such a value,
the implicit timezone is used. The implicit timezone is taken from the system clock, and its value
can be checked with the fn:implicit-timezone() function.
Collations
Only the Unicode codepoint collation is supported. No other collations can be used. String
comparisons, including for the fn:max and fn:min functions, are based on this collation.
Namespace axis
The namespace axis is deprecated in XPath 2.0. Use of the namespace axis is, however,
supported. To access namespace information with XPath 2.0 mechanisms, use the
fn:in-scope-prefixes(), fn:namespace-uri() and
fn:namespace-uri-for-prefix() functions.
base-uri If external entities are used in the source XML document and if
a node in the external entity is specified as the input node
argument of the base-uri() function, it is still the base URI of
the including XML document that is used—not the base URI of
the external entity.
The base URI of a node in the XML document can be modified
using the xml:base attribute.
current-date, The current date and time is taken from the system clock.
current-dateTi The timezone is taken from the implicit timezone provided by
me, the evaluation context; the implicit timezone is taken from the
current-time system clock.
The timezone is always specified in the result.
normalize-unic The normalization forms NFC, NFD, NFKC, and NFKD are
ode supported.
static-base-ur The base URI from the static context is the base URI of the
i XSLT stylesheet or the base URI specified in the prolog of the
XQuery document.
When using XPath Evaluator in the XMLSpy IDE, the base URI
from the static context is the URI of the active XML document.
1.5 Extensions
There are several ready-made functions in programming languages such as Java and C# that
are not available as XPath 2.0 / XQuery 1.0 functions or as XSLT 2.0 functions. A good
example of such functions are the math functions available in Java, such as sin() and cos().
If these functions were available to the designers of XSLT stylesheets and XQuery queries, it
would increase the application area of stylesheets and queries and greatly simplify the tasks of
stylesheet creators.
Altova Engines (XSLT 1.0, XSLT 2.0, and XQuery 1.0), which are used in a number of Altova
products, support the use of extension functions in Java and .NET. The Altova XSLT Engines
additionally support MSXSL scripts for XSLT 1.0 and 2.0 and Altova's own extension functions.
You should note that extension functions are always called from XPath expressions. This
section describes how to use extension functions and MSXSL scripts in your XSLT stylesheets
and XQuery queries. These descriptions are organized into the following sections:
Java Extension Functions
.NET Extension Functions
MSXSL Scripts for XSLT
Altova Extension Functions
The two main issues considered in the descriptions are: (i) how functions in the respective
libraries are called; and (ii) what rules are followed for converting arguments in a function call to
the required input format of the function, and what rules are followed for the return conversion
(function result to XSLT/XQuery data object).
Requirements
For extension functions support, a Java Runtime Environment (for access to Java functions)
and .NET Framework 2.0 (minimum, for access to .NET functions) must be installed on the
machine running the XSLT transformation or XQuery execution, or must be accessible for the
transformations.
A field in a Java class is considered to be a method without any argument. A field can be static
or instance. How to access fields is described in the respective sub-sections, static and
instance.
associating the extension function with an in-scope namespace declaration, the URI of
which must begin with java: (see below for examples). The namespace declaration
should identify a Java class, for example: xmlns:myns="java:java.lang.Math".
However, it could also simply be: xmlns:myns="java" (without a colon), with the
identification of the Java class being left to the fname() part of the extension function.
The fname() part identifies the Java method being called, and supplies the arguments
for the method (see below for examples). However, if the namespace URI identified by
the prefix: part does not identify a Java class (see preceding point), then the Java
class should be identified in the fname() part, before the class and separated from the
class by a period (see the second XSLT example below).
Note: The class being called must be on the classpath of the machine.
XSLT example
Here are two examples of how a static method can be called. In the first example, the class
name (java.lang.Math) is included in the namespace URI and, therefore, must not be in the
fname() part. In the second example, the prefix: part supplies the prefix java: while the
fname() part identifies the class as well as the method.
<xsl:value-of xmlns:jMath="java:java.lang.Math"
select="jMath:cos(3.14)" />
<xsl:value-of xmlns:jmath="java"
select="jmath:java.lang.Math.cos(3.14)" />
The method named in the extension function (cos() in the example above) must match the
name of a public static method in the named Java class (java.lang.Math in the example
above).
XQuery example
Here is an XQuery example similar to the XSLT example above:
<cosine xmlns:jMath="java:java.lang.Math">
{jMath:cos(3.14)}
</cosine>
The class file is in a package. The XSLT or XQuery file is in the same folder as the
Java package.
The class file is not packaged. The XSLT or XQuery file is in the same folder as the
class file.
The class file is in a package. The XSLT or XQuery file is at some random location.
The class file is not packaged. The XSLT or XQuery file is at some random location.
Consider the case where the class file is not packaged and is in the same folder as the XSLT or
XQuery document. In this case, since all classes in the folder are found, the file location does
not need to be specified. The syntax to identify a class is:
java:classname
where
java: indicates that a user-defined Java function is being called; (Java classes in the
current directory will be loaded by default)
classname is the name of the required method's class
The class is identified in a namespace URI, and the namespace is used to prefix a
method call.
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:fn="http://www.w3.org/2005/xpath-functions"
xmlns:car="java:com.altova.extfunc.Car" >
<xsl:output exclude-result-prefixes="fn car xsl fo xs"/>
<xsl:template match="/">
<a>
<xsl:value-of select="car:getVehicleType()"/>
</a>
</xsl:template>
</xsl:stylesheet>
Class file not packaged, XSLT/XQuery file in same folder as class file
The example below calls the getVehicleType()method of the Car class of the
com.altova.extfunc package. The Car class file is in the following folder location:
JavaProject/com/altova/extfunc. The XSLT file is also in the folder
JavaProject/com/altova/extfunc.
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:fn="http://www.w3.org/2005/xpath-functions"
xmlns:car="java:Car" >
<xsl:output exclude-result-prefixes="fn car xsl fo xs"/>
<xsl:template match="/">
<a>
<xsl:value-of select="car:getVehicleType()"/>
</a>
</xsl:template>
</xsl:stylesheet>
java:classname[?path=uri-of-package]
where
The class is identified in a namespace URI, and the namespace is used to prefix a
method call. The example below shows how to access a class file that is located in
another directory than the current directory.
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:fn="http://www.w3.org/2005/xpath-functions"
xmlns:car="
java:com.altova.extfunc.Car?path=file:///C:/JavaProject/" >
<xsl:template match="/">
<xsl:variable name="myCar" select="car:new('red')" />
<a><xsl:value-of select="car:getCarColor($myCar)"/></a>
</xsl:template>
</xsl:stylesheet>
java:classname[?path=uri-of-classfile]
where
The class is identified in a namespace URI, and the namespace is used to prefix a
method call. The example below shows how to access a class file that is located in
another directory than the current directory.
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:fn="http://www.w3.org/2005/xpath-functions"
xmlns:car="
java:Car?path=file:///C:/JavaProject/com/altova/extfunc/" >
<xsl:template match="/">
<xsl:variable name="myCar" select="car:new('red')" />
<a><xsl:value-of select="car:getCarColor($myCar)"/></a>
</xsl:template>
</xsl:stylesheet>
Note: When a path is supplied via the extension function, the path is added to the
ClassLoader.
xmlns:classNS="java:classname?path=jar:uri-of-jarfile!/"
The method is then called by using the prefix of the namespace URI that identifies the
class: classNS:method()
In the above:
Alternatively, the classname can be given with the method call. Here are two examples of the
syntax:
xmlns:ns1="java:docx.layout.pages?path=jar:file:///c:/projects/docs/docx.jar!/
"
ns1:main()
xmlns:ns2="java?path=jar:file:///c:/projects/docs/docx.jar!/"
ns2:docx.layout.pages.main()
Here is a complete XSLT example that uses a JAR file to call a Java extension function:
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:fn="http://www.w3.org/2005/xpath-functions"
xmlns:car="java?path=jar:file:///C:/test/Car1.jar!/" >
<xsl:output exclude-result-prefixes="fn car xsl xs"/>
<xsl:template match="/">
<xsl:variable name="myCar" select="car:Car1.new('red')" />
<a><xsl:value-of select="car:Car1.getCarColor($myCar)"/></a>
</xsl:template>
<xsl:template match="car"/>
</xsl:stylesheet>
Note: When a path is supplied via the extension function, the path is added to the
ClassLoader.
Java: Constructors
An extension function can be used to call a Java constructor. All constructors are called with the
pseudo-function new().
If the result of a Java constructor call can be implicitly converted to XPath/XQuery datatypes,
then the Java extension function will return a sequence that is an XPath/XQuery datatype. If the
result of a Java constructor call cannot be converted to a suitable XPath/XQuery datatype, then
the constructor creates a wrapped Java object with a type that is the name of the class returning
that Java object. For example, if a constructor for the class java.util.Date is called (
java.util.Date.new()), then an object having a type java.util.Date is returned. The lexical
format of the returned object may not match the lexical format of an XPath datatype and the
value would therefore need to be converted to the lexical format of the required XPath datatype
and then to the required XPath datatype.
There are two things that can be done with a Java object created by a constructor:
It can be assigned to a variable:
<xsl:variable name="currentdate" select="date:new()" xmlns:date="
java:java.util.Date" />
It can be passed to an extension function (see Instance Method and Instance Fields):
<xsl:value-of select="date:toString(date:new())" xmlns:date="
java:java.util.Date" />
XSLT examples
Here are some examples of how static methods and fields can be called:
<xsl:value-of xmlns:jMath="java:java.lang.Math"
select="jMath:cos(3.14)" />
<xsl:value-of xmlns:jMath="java:java.lang.Math"
select="jMath:cos( jMath:PI() )" />
<xsl:value-of xmlns:jMath="java:java.lang.Math"
select="jMath:E() * jMath:cos(3.14)" />
Notice that the extension functions above have the form prefix:fname(). The prefix in all three
cases is jMath:, which is associated with the namespace URI java:java.lang.Math. (The
namespace URI must begin with java:. In the examples above it is extended to contain the
class name (java.lang.Math).) The fname() part of the extension functions must match the
name of a public class (e.g. java.lang.Math) followed by the name of a public static method
with its argument/s (such as cos(3.14)) or a public static field (such as PI()).
In the examples above, the class name has been included in the namespace URI. If it were not
contained in the namespace URI, then it would have to be included in the fname() part of the
extension function. For example:
<xsl:value-of xmlns:java="java:"
select="java:java.lang.Math.cos(3.14)" />
XQuery example
A similar example in XQuery would be:
<cosine xmlns:jMath="java:java.lang.Math">
{jMath:cos(3.14)}
</cosine>
In the example above, the value of the node enrollment/@type is created as follows:
1. An object is created with a constructor for the class java.util.Date (with the
date:new() constructor).
2. This Java object is passed as the argument of the jlang.Object.getClass method.
3. The object obtained by the getClass method is passed as the argument to the
jlang.Object.toString method.
The result (the value of @type) will be a string having the value: java.util.Date.
An instance field is theoretically different from an instance method in that it is not a Java object
per se that is passed as an argument to the instance field. Instead, a parameter or variable is
passed as the argument. However, the parameter/variable may itself contain the value returned
by a Java object. For example, the parameter CurrentDate takes the value returned by a
constructor for the class java.util.Date. This value is then passed as an argument to the
instance method date:toString in order to supply the value of /enrollment/@date.
If there is more than one Java method with the same name, but each has a different
number of arguments than the other/s, then the Java method that best matches the
number of arguments in the function call is selected.
The XPath/XQuery string, number, and boolean datatypes (see list below) are implicitly
converted to a corresponding Java datatype. If the supplied XPath/XQuery type can be
converted to more than one Java type (for example, xs:integer), then that Java type
is selected which is declared for the selected method. For example, if the Java method
being called is fx(decimal) and the supplied XPath/XQuery datatype is xs:integer,
then xs:integer will be converted to Java's decimal datatype.
The table below lists the implicit conversions of XPath/XQuery string, number, and boolean
types to Java datatypes.
xs:string java.lang.String
xs:boolean boolean (primitive), java.lang.Boolean
Subtypes of the XML Schema datatypes listed above (and which are used in XPath and
XQuery) will also be converted to the Java type/s corresponding to that subtype's ancestor type.
In some cases, it might not be possible to select the correct Java method based on the supplied
information. For example, consider the following case.
The supplied argument is an xs:untypedAtomic value of 10 and it is intended for the
method mymethod(float).
However, there is another method in the class which takes an argument of another
datatype: mymethod(double).
Since the method names are the same and the supplied type (xs:untypedAtomic)
could be converted correctly to either float or double, it is possible that xs:
untypedAtomic is converted to double instead of float.
Consequently the method selected will not be the required method and might not
produce the expected result. To work around this, you can create a user-defined
method with a different name and use this method.
Types that are not covered in the list above (for example xs:date) will not be converted and will
generate an error. However, note that in some cases, it might be possible to create the required
Java type by using a Java constructor.
When a wrapped Java object or a datatype other than string, numeric or boolean is returned,
you can ensure conversion to the required XPath/XQuery type by first using a Java method (e.g
toString) to convert the Java object to a string. In XPath/XQuery, the string can be modified to
fit the lexical representation of the required type and then converted to the required type (for
example, by using the cast as expression).
Parameters
To load an assembly, the following parameters are used:
If the assembly is to be loaded from a DLL, use the from parameter and omit the sn parameter.
If the assembly is to be loaded from the Global Assembly Cache (GAC), use the sn parameter
and omit the from parameter.
A question mark must be inserted before the first parameter, and parameters must be
separated by a semi-colon. The parameter name gives its value with an equals sign (see
example below).
2. When the assembly is loaded from the DLL (complete and partial references below):
declare namespace
cs="clitype:MyManagedDLL.testClass?from=file:///C:/Altova
Projects/extFunctions/MyManagedDLL.dll;
declare namespace
cs="clitype:MyManagedDLL.testClass?from=MyManagedDLL.dll;
XSLT example
Here is a complete XSLT example that calls functions in system class System.Math:
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:fn="http://www.w3.org/2005/xpath-functions">
<xsl:output method="xml" omit-xml-declaration="yes" />
<xsl:template match="/">
<math xmlns:math="clitype:System.Math">
<sqrt><xsl:value-of select="math:Sqrt(9)"/></sqrt>
<pi><xsl:value-of select="math:PI()"/></pi>
<e><xsl:value-of select="math:E()"/></e>
<pow><xsl:value-of select="math:Pow(math:PI(), math:E())"/></pow>
</math>
</xsl:template>
</xsl:stylesheet>
The namespace declaration on the element math associates the prefix math: with the URI
clitype:System.Math. The clitype: beginning of the URI indicates that what follows
identifies either a system class or a loaded class. The math: prefix in the XPath expressions
associates the extension functions with the URI (and, by extension, the class) System.Math.
The extension functions identify methods in the class System.Math and supply arguments
where required.
XQuery example
Here is an XQuery example fragment similar to the XSLT example above:
<math xmlns:math="clitype:System.Math">
{math:Sqrt(9)}
</math>
As with the XSLT example above, the namespace declaration identifies the .NET class, in this
case a system class. The XQuery expression identifies the method to be called and supplies
the argument.
.NET: Constructors
An extension function can be used to call a .NET constructor. All constructors are called with
the pseudo-function new(). If there is more than one constructor for a class, then the
constructor that most closely matches the number of arguments supplied is selected. If no
constructor is deemed to match the supplied argument/s, then a 'No constructor found'
error is returned.
The lexical format of the returned object may not match the lexical format of a required XPath
datatype. In such cases, the returned value would need to be: (i) converted to the lexical format
of the required XPath datatype; and (ii) cast to the required XPath datatype.
There are three things that can be done with a .NET object created by a constructor:
It can be used within a variable:
<xsl:variable name="currentdate" select="date:new(2008, 4, 29)"
xmlns:date="clitype:System.DateTime" />
It can be passed to an extension function (see Instance Method and Instance Fields):
<xsl:value-of select="date:ToString(date:new(2008, 4, 29))" xmlns:date
="clitype:System.DateTime" />
It can be converted to a string, number, or boolean:
<xsl:value-of select="xs:integer(data:get_Month(date:new(2008, 4, 29)))
" xmlns:date="clitype:System.DateTime" />
the method name and the number of arguments that were given in the function call matches
more than one method in a class, then the types of the supplied arguments are evaluated for
the best match. If a match cannot be found unambiguously, an error is reported.
Note: A field in a .NET class is considered to be a method without any argument. A property
is called using the syntax get_PropertyName().
Examples
An XSLT example showing a call to a method with one argument (System.Math.Sin(arg)):
<xsl:value-of select="math:Sin(30)" xmlns:math="clitype:System.Math"/>
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:fn="http://www.w3.org/2005/xpath-functions">
<xsl:output method="xml" omit-xml-declaration="yes"/>
<xsl:template match="/">
<xsl:variable name="releasedate"
select="date:new(2008, 4, 29)"
xmlns:date="clitype:System.DateTime"/>
<doc>
<date>
<xsl:value-of select="date:ToString(date:new(2008, 4, 29))"
xmlns:date="clitype:System.DateTime"/>
</date>
<date>
<xsl:value-of select="date:ToString($releasedate)"
xmlns:date="clitype:System.DateTime"/>
</date>
</doc>
</xsl:template>
</xsl:stylesheet>
The table below lists the implicit conversions of XPath/XQuery string, number, and boolean
types to .NET datatypes.
Subtypes of the XML Schema datatypes listed above (and which are used in XPath and
XQuery) will also be converted to the .NET type/s corresponding to that subtype's ancestor type.
In some cases, it might not be possible to select the correct .NET method based on the
supplied information. For example, consider the following case.
The supplied argument is an xs:untypedAtomic value of 10 and it is intended for the
method mymethod(float).
However, there is another method in the class which takes an argument of another
datatype: mymethod(double).
Since the method names are the same and the supplied type (xs:untypedAtomic)
could be converted correctly to either float or double, it is possible that xs:
untypedAtomic is converted to double instead of float.
Consequently the method selected will not be the required method and might not
produce the expected result. To work around this, you can create a user-defined
method with a different name and use this method.
Types that are not covered in the list above (for example xs:date) will not be converted and will
generate an error.
When a .NET object or a datatype other than string, numeric or boolean is returned, you can
ensure conversion to the required XPath/XQuery type by first using a .NET method (for
example System.DateTime.ToString()) to convert the .NET object to a string. In XPath/
XQuery, the string can be modified to fit the lexical representation of the required type and then
converted to the required type (for example, by using the cast as expression).
function-1 or variable-1
...
function-n or variable-n
</msxsl:script>
The <msxsl:script> element interacts with the Windows Scripting Runtime, so only languages
that are installed on your machine may be used within the <msxsl:script> element. The .NET
Framework 2.0 platform or higher must be installed for MSXSL scripts to be used.
Consequently, the .NET scripting languages can be used within the <msxsl:script> element.
The language attribute accepts the same values as the language attribute on the HTML
<script> element. If the language attribute is not specified, then Microsoft JScript is assumed
as the default.
The implements-prefix attribute takes a value that is a prefix of a declared in-scope namespace.
This namespace typically will be a user namespace that has been reserved for a function
library. All functions and variables defined within the <msxsl:script> element will be in the
namespace identified by the prefix specified in the implements-prefix attribute. When a
function is called from within an XPath expression, the fully qualified function name must be in
the same namespace as the function definition.
Example
Here is an example of a complete XSLT stylesheet that uses a function defined within a
<msxsl:script> element.
<xsl:template match="/">
<html>
<body>
<p>
<b>Total Retail Price =
$<xsl:value-of select="user:AddMargin(50)"/>
</b>
<br/>
<b>Total Wholesale Price =
$<xsl:value-of select="50"/>
</b>
</p>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
Datatypes
The values of parameters passed into and out of the script block are limited to XPath datatypes.
This restriction does not apply to data passed among functions and variables within the script
block.
Assemblies
An assembly can be imported into the script by using the msxsl:assembly element. The
assembly is identified via a name or a URI. The assembly is imported when the stylesheet is
compiled. Here is a simple representation of how the msxsl:assembly element is to be used.
<msxsl:script>
<msxsl:assembly name="myAssembly.assemblyName" />
<msxsl:assembly href="pathToAssembly" />
...
</msxsl:script>
Namespaces
Namespaces can be declared with the msxsl:using element. This enables assembly classes
to be written in the script without their namespaces, thus saving you some tedious typing. Here
is how the msxsl:using element is used so as to declare namespaces.
<msxsl:script>
<msxsl:using namespace="myAssemblyNS.NamespaceName" />
...
</msxsl:script>
The following extension functions are supported in the current version of your Altova product in
the manner described below. However, note that in future versions of your product, support for
one or more of these functions might be discontinued or the behavior of individual functions
might change. Consult the documentation of future releases for information about support for
Altova extension functions in that release.
General functions
altova:evaluate()
altova:distinct-nodes()
altova:encode-for-rtf()
altova:xbrl-labels()
altova:xbrl-footnotes()
altova:generate-auto-number()
altova:reset-auto-number()
altova:get-temp-folder()
A third section gives a listing of the chart data XML structure, from which charts can be
generated. Finally, an example XSLT document shows how chart functions can be used to
generate charts from XML data.
General Functions
The following extension functions are supported in the current version of your Altova product in
the manner described below. However, note that in future versions of your product, support for
one or more of these functions might be discontinued or the behavior of individual functions
might change. Consult the documentation of future releases for information about support for
Altova extension functions in that release.
altova:evaluate()
altova:distinct-nodes()
altova:encode-for-rtf()
altova:xbrl-labels()
altova:xbrl-footnotes()
altova:generate-auto-number()
altova:reset-auto-number()
altova:get-temp-folder()
altova:evaluate()
The altova:evaluate() function takes an XPath expression, passed as a string, as its
mandatory argument. It returns the output of the evaluated expression.
altova:evaluate(XPathExp as xs:string)
For example:
altova:evaluate('//Name[1]')
In the example above, note that the expression //Name[1] is passed as a string by enclosing it
in single quotes. The altova:evaluate function returns the contents of the first Name element
in the document.
The altova:evaluate function can take additional (optional) arguments. These arguments are,
respectively, the values of variables with the names p1, p2, p3... pN that can be used in the
XPath expression.
where
For example:
<xsl:variable name="xpath" select="'$p3, $p2, $p1'" />
<xsl:value-of select="altova:evaluate( $xpath, 10, 20, 'hi' )" />
Outputs "hi 20 10"
If this sort instruction occurs within the context of an element called Order, then the Order
elements will be sorted according to the values of their Price children. Alternatively, if the value
of @sortkey were, say, Date, then the Order elements would be sorted according to the values
of their Date children. So the sort criterion for Order is selected from the sortkey attribute at
runtime. This could not have been achieved with an expression like:
<xsl:sort select="../UserReq/@sortkey" order="ascending"/>
In the case shown above, the sort criterion would be the sortkey attribute itself, not Price or
Date (or any other current content of sortkey).
Variables can be used in the altova:evaluate() extension function as shown in the examples
below:
Note: The static context includes namespaces, types, and functions—but not variables—from
the calling environment. The base URI and default namespace are inherited.
altova:distinct-nodes()
The altova:distinct-nodes() function takes a set of one or more nodes as its input and
returns the same set minus nodes with duplicate values. The comparison is done using the
XPath/XQuery function fn:deep-equal.
altova:distinct-nodes( $arg as node()* ) as node()*
altova:encode-for-rtf()
The altova:encode-for-rtf() function converts the input string into code for RTF.
altova:encode-for-rtf( $inputstr as xs:string?,
$preserveallwhitespace as xs:boolean,
$preservenewlines as xs:boolean) as xs:string
Whitespace and new lines will be preserved according to the boolean value specified for their
respective parameters.
altova:xbrl-labels()
The altova:xbrl-labels() function takes two input arguments: a node name and the
taxonomy file location containing the node. The function returns the XBRL labels associated
with the input node.
altova:xbrl-labels( $name as xs:QName, $file as xs:string ) as node()*
altova:xbrl-footnotes()
The altova:footnotes() function takes a node as its input argument and returns the set of
XBRL footnote nodes referenced by the input node.
altova:footnotes( $arg as node() ) as node()*
Generates a series of numbers having the specified ID. The start integer and the increment is
specified.
altova:reset-auto-number(id as xs:string)
This function resets the auto-numbering of the auto-numbering series specified with the ID
argument. The series is reset to the start integer of the series (see
altova:generate-auto-number above).
altova:get-temp-folder as xs:string
Gets the temporary folder.
Chart Functions
The chart functions listed below enable you to create, generate, and save charts as images.
They are supported in the current version of your Altova product in the manner described below.
However, note that in future versions of your product, support for one or more of these functions
might be discontinued or the behavior of individual functions might change. Consult the
documentation of future releases for information about support for Altova extension functions in
that release.
Note: Chart functions are supported only in the Enterprise and Reporting Editions of Altova
products.
where
$chart is the chart extension item obtained with the altova:create-chart function
$width and $height must be specified with a length unit
$encoding may be binarytobase64 or binarytobase16
where
$chart is the chart extension item obtained with the altova:create-chart function
$width and $height must be specified with a length unit
$encoding may be base64Binary or hexBinary
$imagetype may be one of the following image formats: png, gif, bmp, jpg, jpeg
The function returns the chart image in the specified encoding and image format.
where
$chart is the chart extension item obtained with the altova:create-chart function
$filename is the path to and name of the file to which the chart image is to be saved
$width and $height must be specified with a length unit
The function saves the chart image to the file specified in $filename.
where
$chart is the chart extension item obtained with the altova:create-chart function
$filename is the path to and name of the file to which the chart image is to be saved
$width and $height must be specified with a length unit
$imagetype may be one of the following image formats: png, gif, bmp, jpg, jpeg
The function saves the chart image to the file specified in $filename in the image format
specified.
where
$chart-config is the chart-config extension item obtained with the
altova:create-chart-config function or or via the
altova:create-chart-config-from-xml function
$chart-data-series is the chart-data-series extension item obtained with the
altova:create-chart-data-series function or
altova:create-chart-data-series-from-rows function
The function returns a chart extension item, which is created from the data supplied via the
arguments.
where
$type-name specifies the type of chart to be created: Pie, Pie3d, BarChart,
BarChart3d, BarChart3dGrouped, LineChart, ValueLineChart, RoundGauge,
BarGauge
$title is the name of the chart
The function returns a chart-config extension item containing the configuration information
of the chart.
where
$xml-struct is the XML structure containing the configuration information of the
chart
The function returns a chart-config extension item containing the configuration information
of the chart. This information is supplied in an XML data fragment.
where
$series-name specifies the name of the series
$x-values gives the list of X-Axis values
$y-values gives the list of Y-Axis values
The function returns a chart-data-series extension item containing the data for building the
chart: that is, the names of the series and the Axes data.
where
x is the value of the X-Axis column of the chart data row
yN are the values of the Y-Axis columns
The function returns a chart-data-x-Ny-row extension item, which contains the data for the
X-Axis column and Y-Axis columns of a single series.
where
$series-name is the name of the series to be created
$row is the chart-data-x-Ny-row extension item that is to be created as a series
The function returns a chart-data-series extension item, which contains the data for the
X-Axis and Y-Axes of the series.
Note: Chart functions are supported only in the Enterprise and Reporting
Editions of Altova products.
<General
SettingsVersion="1" must be provided
ChartKind="BarChart" Pie, Pie3d, BarChart, BarChart3d, BarChart3dGrouped,
LineChart, ValueLineChart, RoundGauge, BarGauge
BKColor="#ffffff" Color
ShowBorder="1" Bool
PlotBorderColor="#000000" Color
PlotBKColor="#ffffff" Color
Title="" String
ShowLegend="1" Bool
OutsideMargin="3.%" PercentOrPixel
TitleToPlotMargin="3.%" PercentOrPixel
LegendToPlotMargin="3.%" PercentOrPixel
Orientation="vert" Enumeration: possible values are: vert, horz
>
<TitleFont
Color="#000000" Color
Name="Tahoma" String
Bold="1" Bool
Italic="0" Bool
Underline="0" Bool
MinFontHeight="10.pt" FontSize (only pt values)
Size="8.%" FontSize />
<LegendFont
Color="#000000"
Name="Tahoma"
Bold="0"
Italic="0"
Underline="0"
MinFontHeight="10.pt"
Size="3.5%" />
<AxisLabelFont
Color="#000000"
Name="Tahoma"
Bold="1"
Italic="0"
Underline="0"
MinFontHeight="10.pt"
Size="5.%" />
</General>
<Line
ConnectionShapeSize="1.%" PercentOrPixel
DrawFilledConnectionShapes="1" Bool
DrawOutlineConnectionShapes="0" Bool
DrawSlashConnectionShapes="0" Bool
DrawBackslashConnectionShapes="0" Bool
/>
<Bar
ShowShadow="1" Bool
ShadowColor="#a0a0a0" Color
OutlineColor="#000000" Color
ShowOutline="1" Bool
/>
<Colors User-defined color scheme: By default this element is empty except for the style
and has no Color attributes
Style="User" Possible values are: "Default", "Grayscale", "Colorful", "Pastel", "User"
Colors="#52aca0" Color: only added for user defined color set
Colors1="#d3c15d" Color: only added for user defined color set
Colors2="#8971d8" Color: only added for user defined color set
...
ColorsN="" Up to ten colors are allowed in a set: from Colors to Colors9
</Colors>
<Pie
ShowLabels="1" Bool
OutlineColor="#404040" Color
ShowOutline="1" Bool
StartAngle="0." Double
Clockwise="1" Bool
Draw2dHighlights="1" Bool
Transparency="0" Int (0 to 255: 0 is opaque, 255 is fully transparent)
DropShadowColor="#c0c0c0" Color
DropShadowSize="5.%" PercentOrPixel
PieHeight="10.%" PercentOrPixel. Pixel values might be different in the result
because of 3d tilting
Tilt="40.0" Double (10 to 90: The 3d tilt in degrees of a 3d pie)
ShowDropShadow="1" Bool
ChartToLabelMargin="10.%" PercentOrPixel
AddValueToLabel="0" Bool
AddPercentToLabel="0" Bool
AddPercentToLabels_DecimalDigits="0" UINT ( 0 – 2 )
>
<LabelFont
Color="#000000"
Name="Arial"
Bold="0"
Italic="0"
Underline="0"
MinFontHeight="10.pt"
Size="4.%" />
</Pie>
<XY>
<XAxis Axis
AutoRange="1" Bool
AutoRangeIncludesZero="1" Bool
RangeFrom="0." Double: manual range
RangeTill="1." Double : manual range
LabelToAxisMargin="3.%" PercentOrPixel
AxisLabel="" String
AxisColor="#000000" Color
AxisGridColor="#e6e6e6" Color
ShowGrid="1" Bool
UseAutoTick="1" Bool
ManualTickInterval="1." Double
AxisToChartMargin="0.px" PercentOrPixel
TickSize="3.px" PercentOrPixel
>
<ValueFont
Color="#000000"
Name="Tahoma"
Bold="0"
Italic="0"
Underline="0"
MinFontHeight="10.pt"
Size="3.%" />
</XAxis>
<YAxis Axis (same as for XAxis)
AutoRange="1"
AutoRangeIncludesZero="1"
RangeFrom="0."
RangeTill="1."
LabelToAxisMargin="3.%"
AxisLabel=""
AxisColor="#000000"
AxisGridColor="#e6e6e6"
ShowGrid="1"
UseAutoTick="1"
ManualTickInterval="1."
AxisToChartMargin="0.px"
TickSize="3.px">
<ValueFont
Color="#000000"
Name="Tahoma"
Bold="0"
Italic="0"
Underline="0"
MinFontHeight="10.pt"
Size="3.%"/>
</YAxis>
</XY>
<XY3d
AxisAutoSize="1" Bool: If false, XSize and YSize define the aspect ration of x and y
axis. If true, aspect ratio is equal to chart window
XSize="100.%" PercentOrPixel. Pixel values might be different in the result because
of 3d tilting and zooming to fit chart
YSize="100.%" PercentOrPixel. Pixel values might be different in the result because
of 3d tilting and zooming to fit chart
SeriesMargin="30.%" PercentOrPixel. Pixel values might be different in the result
because of 3d tilting and zooming to fit chart
Tilt="20." Double. -90 to +90 degrees
Rot="20." Double. -359 to +359 degrees
FoV="50."> Double. Field of view: 1-120 degree
>
<ZAxis
AutoRange="1"
AutoRangeIncludesZero="1"
RangeFrom="0."
RangeTill="1."
LabelToAxisMargin="3.%"
AxisLabel=""
AxisColor="#000000"
AxisGridColor="#e6e6e6"
ShowGrid="1"
UseAutoTick="1"
ManualTickInterval="1."
AxisToChartMargin="0.px"
TickSize="3.px" >
<ValueFont
Color="#000000"
Name="Tahoma"
Bold="0"
Italic="0"
Underline="0"
MinFontHeight="10.pt"
Size="3.%"/>
</ZAxis>
</XY3d>
<Gauge
MinVal="0." Double
MaxVal="100." Double
MinAngle="225" UINT: -359-359
SweepAngle="270" UINT: 1-359
BorderToTick="1.%" PercentOrPixel
MajorTickWidth="3.px" PercentOrPixel
MajorTickLength="4.%" PercentOrPixel
MinorTickWidth="1.px" PercentOrPixel
MinorTickLength="3.%" PercentOrPixel
BorderColor="#a0a0a0" Color
FillColor="#303535" Color
MajorTickColor="#a0c0b0" Color
MinorTickColor="#a0c0b0" Color
BorderWidth="2.%" PercentOrPixel
NeedleBaseWidth="1.5%" PercentOrPixel
NeedleBaseRadius="5.%" PercentOrPixel
NeedleColor="#f00000" Color
NeedleBaseColor="#141414" Color
TickToTickValueMargin="5.%" PercentOrPixel
MajorTickStep="10." Double
MinorTickStep="5." Double
RoundGaugeBorderToColorRange="0.%" PercentOrPixel
RoundGaugeColorRangeWidth ="6.%" PercentOrPixel
BarGaugeRadius="5.%" PercentOrPixel
BarGaugeMaxHeight="20.%" PercentOrPixel
RoundGaugeNeedleLength="45.%" PercentOrPixel
BarGaugeNeedleLength="3.%" PercentOrPixel
>
<TicksFont
Color="#a0c0b0"
Name="Tahoma"
Bold="0"
Italic="0"
Underline="0"
MinFontHeight="10.pt"
Size="4.%"
/>
<ColorRanges> User-defined color ranges. By default empty with no child element
entries
<Entry
From="50. " Double
FillWithColor="1" Bool
Color="#00ff00" Color
/>
<Entry
From="50.0"
FillWithColor="1"
Color="#ff0000"
/>
...
</ColorRanges>
</Gauge>
</ChartSettings>
Note: Chart functions are supported only in the Enterprise and Reporting Editions of Altova
products.
Note: For more information about how chart data tables are created, see the documentation
of Altova's XMLSpy and StyleVision products.
XSLT document
This XSLT document (listing below) uses Altova chart extension functions to generate a pie
chart. It can be used to process the XML document listed further below.
</General>
</chart-config>
</xsl:variable>
<xsl:sequence select="
altovaext:create-chart-config-from-xml( $ext-chart-settings )"/>
</xsl:variable>
<xsl:variable name="chartDataSeries" as="item()*">
<xsl:variable name="chartDataRows" as="item()*">
<xsl:for-each select="(Year)">
<xsl:sequence select="
altovaext:create-chart-data-row( (@id), ( .) )"/>
</xsl:for-each>
</xsl:variable>
<xsl:variable name="chartDataSeriesNames" as="xs:string*"
select=" ( ("Series 1"), '' )[1]"/>
<xsl:sequence
select="altovaext:create-chart-data-series-from-rows(
$chartDataSeriesNames, $chartDataRows)"/>
</xsl:variable>
<xsl:variable name="ChartObj" select="altovaext:create-chart(
$extChartConfig, ( $chartDataSeries), false() )"/>
<xsl:variable name="sChartFileName" select="'mychart1.png'"/>
<img src="{$sChartFileName, altovaext:save-chart-image(
$ChartObj, $sChartFileName, 400, 400 ) }"/>
</xsl:for-each>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
XML document
This XML document can be processed with the XSLT document above. Data in the XML
document is used to generate the pie chart shown in the screenshot below.
Output image
The pie chart show below is generated when the XML document listed above is processed with
the XSLT document.
2.1 MS Access
When an XML Schema is generated from an MS Access database (DB), the MS Access DB
datatypes are converted to XML Schema datatypes as listed in the table below.
2.3 MySQL
When an XML Schema is generated from a MySQL database (DB), the MySQL DB datatypes
are converted to XML Schema datatypes as listed in the table below.
2.4 Oracle
When an XML Schema is generated from an Oracle database (DB), the Oracle DB datatypes
are converted to XML Schema datatypes as listed in the table below.
2.5 ODBC
When an XML Schema is generated from an ODBC database (DB), the ODBC DB datatypes
are converted to XML Schema datatypes as listed in the table below.
2.6 ADO
When an XML Schema is generated from an ADO database (DB), the ADO DB datatypes are
converted to XML Schema datatypes as listed in the table below.
2.7 Sybase
When an XML Schema is generated from a Sybase database (DB), the Sybase DB datatypes
are converted to XML Schema datatypes as listed in the table below.
3.1 MS Access
When an MS Access database (DB) is created from an XML Schema, the XML Schema
datatypes are converted to MS Access datatypes as listed in the table below.
xs:deci
m al deci
m al
xs:durati
on dateti
me
xs:dateTim e dateti
me
xs:ti
me dateti
me
xs:date dateti
me
xs:gYearM onth dateti
me
xs:gYear dateti
me
xs:gM onthDay dateti
me
xs:gDay dateti
me
xs:gM onth dateti
me
xs:hexBi
nary Ifnofacetsvarbi
nary(255)
(Si
ze=ei
therl
engthorm axLength
IfSize<= 8000
i
fFacetLengthIsSetthenbi
nary
el
sevarbi
nary
ifSize <= 2147483647 then im age
xs:base64Binary Same as xs:hexBi
nary
xs:
i
nt
eger i
nt
xs:
i
nt i
nt
xs:negati
veInteger I
nt(const
rai
nedt
o{..
,
-2,
-1})
xs:
posi
t
i
veI
nt
eger I
nt(const
rai
nedt
o{1,
2,
..
})
xs:nonNegati
veInteger i
nt(const
rai
nedt
o{0,
1,
2,
..
})
xs:nonPosi
ti
veInteger i
nt(const
rai
nedt
o{..
,
-2,
-1,
0})
xs:unsi
gnedInt i
nt(addi
t
i
onalconst
rai
nt
s)
xs:
short smal
i
nt
xs:unsi
gnedShort smal
i
nt(addi
ti
onalconstrai
nts)
xs:l
ong bi
gi
nt
xs:unsignedLong bi
gi
nt(addi
t
i
onalconst
rai
nt
s)
xs:
byte t
i
nyi
nt
xs:unsi
gnedByte t
i
nyi
nt(addi
t
i
onalconst
rai
nt
s)
3.3 MySQL
When an XML Schema is generated from a MySQL database (DB), the MySQL DB datatypes
are converted to XML Schema datatypes as listed in the table below.
xs:gDay ti
m estam p(8);constrai
ntstocheckday
xs:gM onth ti
m estam p(8);constrai
ntstocheckm onth
xs:hexBi
nary Ifnofacetsthenbl
ob(255)
elsei
ffacetl
engthi
ssetand<=255
thenbl ob
elseiffacetm axLengthi
ssetand<=255
thenti
nyblob
elsei
fm axl
engthi
ssetand<=65545
thenbl
ob
elseifm axlengthissetand<= 16777215
then m edium blob
elseifm axlengthissetand<= 429496295
thenlongblob
xs:base64Binary Same as xs:hexBi
nary
xs:
i
nt
eger Integer
xs:
i
nt i
nt
xs:negati
veInteger I
nt
eger(const
rai
nedt
o{..
,
-2,
-1})
xs:
posi
t
i
veI
nt
eger I
nt
eger(const
rai
nedt
o{1,
2,
..
})
xs:nonNegati
veInteger I
nt
eger(const
rai
nedt
o{0,
1,
2,
..
})
xs:nonPosi
ti
veInteger I
nt
eger(const
rai
nedt
o{..
,
-2,
-1,
0})
xs:unsi
gnedInt I
nt(addi
t
i
onalconst
rai
nt
s)
xs:
short Smal
i
nt
xs:unsi
gnedShort Smal
i
nt(addi
ti
onalconstrai
nts)
xs:l
ong Bi
gi
nt
xs:unsignedLong Bi
gi
nt(addi
t
i
onalconst
rai
nt
s)
xs:
byte Ti
nyi
nt
xs:unsi
gnedByte Ti
nyi
nt(addi
t
i
onalconst
rai
nt
s)
3.4 Oracle
When an XML Schema is generated from an Oracle database (DB), the Oracle DB datatypes
are converted to XML Schema datatypes as listed in the table below.
xs:date D A TE
xs:gYearM onth IN TER VAL YEAR TO M O N TH
xs:gYear D A TE
xs:gM onthDay D A TE
xs:gDay D A TE
xs:gM onth D A TE
xs:hexBi
nary ifnofacetsthenRAW (255)
(Si
ze=ei
therl
engthorm axLength)
IfSize <= 2000 then RAW (X)
else Size <= 2 G igabytes then LO NG RAW (X)
ifSize<= 4GigabytesthenBLOB (X)
xs:base64Binary B LO B
xs:
i
nt
eger N U M BER
xs:
i
nt N U M BER
xs:negati
veInteger NUMBER (constrai
nedto{...,-2,-1})
xs:
posi
t
i
veI
nt
eger NUM BER (constrai
nedto{1,2,...})
xs:nonNegati
veInteger NUMBER (constrai
nedto{0,1,2,...})
xs:nonPosi
ti
veInteger NUMBER (constrai
nedto{...,-2,-1,0})
xs:unsi
gnedInt NUM BER (additionalconstraints)
xs:
short N U M BER
xs:unsi
gnedShort NUM BER (additionalconstraints)
xs:l
ong N U M BER
xs:unsignedLong NUM BER (additionalconstraints)
xs:
byte B LO B
xs:unsi
gnedByte BLOB (addi
ti
onalconstrai
nts)
4 Technical Data
This section contains useful background information on the technical aspects of your software.
It is organized into the following sections:
OS and Memory Requirements
Altova XML Parser
Altova XSLT and XQuery Engines
Unicode Support
Internet Usage
Memory
Since the software is written in C++ it does not require the overhead of a Java Runtime
Environment and typically requires less memory than comparable Java-based applications.
However, each document is loaded fully into memory so as to parse it completely and to
improve viewing and editing speed. The memory requirement increases with the size of the
document.
Memory requirements are also influenced by the unlimited Undo history. When repeatedly
cutting and pasting large selections in large documents, available memory can rapidly be
depleted.
The built-in Altova XML Parser implements the Final Recommendation of the W3C's XML
Schema specification. New developments recommended by the W3C's XML Schema Working
Group are continuously being incorporated in the Altova Parser, so that Altova products give
you a state-of-the-art development environment.
These three engines are also available in the AltovaXML package, which can be downloaded
from the Altova website free of charge. Documentation for using the engines is available with
the AltovaXML package.
Fundamentally, computers just deal with numbers. They store letters and other characters by
assigning a number for each one. Before Unicode was invented, there were hundreds of
different encoding systems for assigning these numbers. No single encoding could contain
enough characters: for example, the European Union alone requires several different encodings
to cover all its languages. Even for a single language like English, no single encoding was
adequate for all the letters, punctuation, and technical symbols in common use.
These encoding systems used to conflict with one another. That is, two encodings used the
same number for two different characters, or different numbers for the same character. Any
given computer (especially servers) needs to support many different encodings; yet whenever
data is passed between different encodings or platforms, that data always runs the risk of
corruption.
Unicode is required by modern standards such as XML, Java, ECMAScript (JavaScript), LDAP,
CORBA 3.0, WML, etc., and is the official way to implement ISO/IEC 10646. It is supported in
many operating systems, all modern browsers, and many other products. The emergence of the
Unicode Standard, and the availability of tools supporting it, are among the most significant
recent global software technology trends.
Incorporating Unicode into client-server or multi-tiered applications and web sites offers
significant cost savings over the use of legacy character sets. Unicode enables a single
software product or a single web site to be targeted across multiple platforms, languages and
countries without re-engineering. It allows data to be transported through many different
systems without corruption.
4.4.1 Windows XP
Altova's XML products provide full Unicode support. To edit an XML document, you will also
need a font that supports the Unicode characters being used by that document.
Please note that most fonts only contain a very specific subset of the entire Unicode range and
are therefore typically targeted at the corresponding writing system. Consequently you may
encounter XML documents that contain "unprintable" characters, because the font you have
selected does not contain the required glyphs. Therefore it can sometimes be very useful to
have a font that covers the entire Unicode range - especially when editing XML documents from
all over the world.
The most universal font we have encountered is a typeface called Arial Unicode MS that has
been created by Agfa Monotype for Microsoft. This font contains over 50,000 glyphs and covers
the entire set of characters specified by the Unicode 2.1 standard. It needs 23MB and is
included with Microsoft Office 2000.
We highly recommend that you install this font on your system and use it with the application if
you are often editing documents in different writing systems. This font is not installed with the
"Typical" setting of the Microsoft Office setup program, but you can choose the Custom Setup
option to install this font.
In the /Examples folder in your application folder you will also find a new XHTML file called
Unicode-UTF8.html that contains the sentence "When the world wants to talk, it speaks
Unicode" in many different languages ("Wenn die Welt miteinander spricht, spricht sie
Unicode") and writing-systems ( ) - this line has been
adopted from the 10th Unicode conference in 1997 and is a beautiful illustration of the
importance of Unicode for the XML standard. Opening this file will give you a quick impression
on what is possible with Unicode and what writing systems are supported by the fonts available
on your PC installation.
If you click the "Request evaluation key-code" in the Registration dialog (Help |
Software Activation), the three fields in the registration dialog box are transferred to
our web server by means of a regular http (port 80) connection and the free evaluation
key-code is sent back to the customer via regular SMTP e-mail.
If you use the URL mode of the Open dialog box to open a document directly from a
URL (File | Open | Switch to URL), that document is retrieved through a http (port 80)
connection. (This functionality is available in XMLSpy and Authentic Desktop.)
If you open an XML document that refers to an XML Schema or DTD and the document
is specified through a URL, it is also retrieved through a http (port 80) connection once
you validate the XML document. This may also happen automatically upon opening a
document if you have instructed the application to automatically validate files upon
opening in the File tab of the Options dialog (Tools | Options). (This functionality is
available in XMLSpy and Authentic Desktop.)
If you are using the Send by Mail... command (File | Send by Mail) in XMLSpy, the
current selection or file is sent by means of any MAPI-compliant mail program installed
on the user's PC.
As part of Software Activation and LiveUpdate as further described in this manual and
the Altova Software License Agreement.
5 License Information
This section contains:
Information about the distribution of this software product
Information about the intellectual property rights related to this software product
The End User License Agreement governing the use of this software product
Please read this information carefully. It is binding upon you since you agreed to these terms
when you installed this software product.
For further details, please refer to the Altova Software License Agreement at the end of this
section.
Your Altova product has a built-in license metering module that further helps you avoid any
unintentional violation of the End User License Agreement. Your product is licensed either as a
single-user or multi-user installation, and the license-metering module makes sure that no more
than the licensed number of users use the application concurrently.
This license-metering technology uses your local area network (LAN) to communicate between
instances of the application running on different computers.
Single license
When the application starts up, as part of the license metering process, the software sends a
short broadcast datagram to find any other instance of the product running on another computer
in the same network segment. If it doesn't get any response, it will open a port for listening to
other instances of the application.
Multi license
If more than one instance of the application is used within the same LAN, these instances will
briefly communicate with each other on startup. These instances exchange key-codes in order
to help you to better determine that the number of concurrent licenses purchased is not
accidentally violated. This is the same kind of license metering technology that is common in the
Unix world and with a number of database development tools. It allows Altova customers to
purchase reasonably-priced concurrent-use multi-user licenses.
We have also designed the applications so that they send few and small network packets so as
to not put a burden on your network. The TCP/IP ports (2799) used by your Altova product are
officially registered with the IANA (see
http://www.isi.edu/in-notes/iana/assignments/port-numbers for details) and our license-metering
module is tested and proven technology.
If you are using a firewall, you may notice communications on port 2799 between the computers
that are running Altova products. You are, of course, free to block such traffic between different
groups in your organization, as long as you can ensure by other means, that your license
agreement is not violated.
You will also notice that, if you are online, your Altova product contains many useful functions;
these are unrelated to the license-metering technology.
Altova software contains certain Third Party Software that is also protected by intellectual
property laws, including without limitation applicable copyright laws as described in detail at
http://www.altova.com/legal_3rdparty.html.
All other names or trademarks are the property of their respective owners.
Licensor:
Altova GmbH
Rudolfsplatz 13a/9
A-1010 Wien
Austria
1. SOFTWARE LICENSE
(a) License Grant.
(i) Upon your acceptance of this Software License Agreement Altova grants you a
non-exclusive, non-transferable (except as provided below), limited license, without the right to
grant sublicenses, to install and use a copy of the Software on one compatible personal
computer or workstation up to the Permitted Number of computers. Subject to the limitations set
forth in Section 1(c), you may install and use a copy of the Software on more than one of your
compatible personal computers or workstations if you have purchased a Named User license.
The Permitted Number of computers and/or users shall be determined and specified at such
time as you elect to purchase the Software. During the evaluation period, hereinafter defined,
only a single user may install and use the software on one personal computer or workstation. If
you have licensed the Software as part of a suite of Altova software products (collectively, the
“Suite”) and have not installed each product individually, then the Software License Agreement
governs your use of all of the software included in the Suite.
(ii) If you have licensed SchemaAgent, then the terms and conditions of this Software
License Agreement apply to your use of the SchemaAgent server software (“SchemaAgent
Server”) included therein, as applicable, and you are licensed to use SchemaAgent Server
solely in connection with your use of Altova Software and solely for the purposes described in
the accompanying documentation.
(iii) If you have licensed Altova Software that enables users to generate source code,
your license to install and use a copy of the Software as provided herein permits you to
generate source code based on (i) Altova Library modules that are included in the Software
(such generated code hereinafter referred to as the “Restricted Source Code”) and (ii) schemas
or mappings that you create or provide (such code as may be generated from your schema or
mapping source materials hereinafter referred to as the “Unrestricted Source Code”). In
addition to the rights granted herein, Altova grants you a non-exclusive, non-transferable, limited
license to compile the complete generated code (comprised of the combination of the
Restricted Source Code and the Unrestricted Source Code) into executable object code form,
and to use, copy, distribute or license that executable. You may not distribute or redistribute,
sublicense, sell, or transfer the Restricted Source Code to a third party, unless said third party
already has a license to the Restricted Source Code through their separate license agreement
with Altova or other agreement with Altova. Notwithstanding anything to the contrary herein, you
may not distribute, incorporate or combine with other software, or otherwise use the Altova
Library modules or Restricted Source Code, (or any Altova intellectual property embodied in or
associated with the Altova Library modules or Restricted Source Code) in any manner that
would subject the Restricted Source Code to the terms of a copyleft, free software or open
source license that would require the Restricted Source Code or Altova Library modules source
code to be disclosed in source code form. Altova reserves all other rights in and to the Software.
With respect to the feature(s) of UModel that permit reverse-engineering of your own source
code or other source code that you have lawfully obtained, such use by you does not constitute
a violation of this Agreement. Except as otherwise expressly permitted in Section 1(i) reverse
engineering of the Software is strictly prohibited as further detailed therein.
(b) Server Use. You may install one copy of the Software on a computer file server
within your internal network solely for the purpose of downloading and installing the Software
onto other computers within your internal network up to the Permitted Number of computers in a
commercial environment only. If you have licensed SchemaAgent, then you may install
SchemaAgent Server on any server computer or workstation and use it in connection with your
Software. No other network use is permitted, including without limitation using the Software
either directly or through commands, data or instructions from or to a computer not part of your
internal network, for Internet or Web-hosting services or by any user not licensed to use this
copy of the Software through a valid license from Altova. If you have purchased Concurrent
User Licenses as defined in Section 1(d), and subject to limits set forth therein, you may install
a copy of the Software on a terminal server (Microsoft Terminal Server, Citrix Metaframe, etc.),
application virtualization server (Microsoft App-V, Citrix XenApp, VMWare ThinApp, etc.) or
virtual machine environment within your internal network for the sole and exclusive purpose of
permitting individual users within your organization to access and use the Software through a
terminal server, application virtualization session, or virtual machine environment from another
computer on the same physical network provided that the total number of users that access or
use the Software on such network, virtual machine or terminal server does not exceed the
Permitted Number. Altova makes no warranties or representations about the performance of
Altova software in a terminal server or virtual machine environment and the foregoing are
expressly excluded from the limited warranty in Section 5 hereof and technical support is not
available with respect to issues arising from use in such environments.
(c) Named Use. If you have licensed the “Named User” version of the software,
you may install the Software on up to 5 compatible personal computers or workstations of which
you are the primary user thereby allowing you to switch from one computer to the other as
necessary provided that only one instance of the Software will be used by you as the Named
User at any given time. If you have purchased multiple Named User licenses, each individual
Named User will receive a separate license key code.
(d) Concurrent Use. If you have licensed a “Concurrent-User” version of the
Software, you may install the Software on any compatible computers in a commercial
environment only, up to ten (10) times the Permitted Number of users, provided that only the
Permitted Number of users actually use the Software at the same time and further provided that
the computers on which the Software is installed are on the same physical computer network.
The Permitted Number of concurrent users shall be delineated at such time as you elect to
purchase the Software licenses. Each separate physical network or office location requires its
own set of separate Concurrent User Licenses for those wishing to use the Concurrent-User
versions of the Software in more than one location or on more than one network, all subject to
the above Permitted Number limitations and based on the number of users using or needing
access to the Software. If a computer is not on the same physical network, then a locally
installed user license is required. Home User restrictions and limitations with respect to the
Concurrent-User licenses used on home computers are set forth in Section 1(f).
(e) Backup and Archival Copies. You may make one backup and one archival
copy of the Software, provided your backup and archival copies are not installed or used on any
computer and further provided that all such copies shall bear the original and unmodified
copyright, patent and other intellectual property markings that appear on or in the Software. You
may not transfer the rights to a backup or archival copy unless you transfer all rights in the
Software as provided under Section 3.
(f) Home Use (Personal and Non-Commercial). In order to further familiarize
yourself with the Software and allow you to explore its features and functions, you, as the
primary user of the computer on which the Software is installed for commercial purposes, may
also install one copy of the Software on only one home personal home computer (such as your
laptop or desktop) solely for your own personal and non-commercial (HPNC”) use. This HPNC
copy may not be used in any commercial or revenue-generating business activities, including
without limitation, work-from-home, teleworking, telecommuting, or other work-related use of the
Software. The HPNC copy of the Software may not be used at the same time on a personal
home computer as the Software is being used on the primary computer.
(g) Key Codes, Upgrades and Updates. Prior to your purchase and as part of the
registration for the thirty (30) -day evaluation period, as applicable, you will receive an evaluation
key code. You will receive a purchase key code when you elect to purchase the Software from
either Altova GmbH or an authorized reseller. The purchase key code will enable you to activate
the Software beyond the initial evaluation period. You may not re-license, reproduce or
distribute any key code except with the express written permission of Altova. If the Software that
you have licensed is an upgrade or an update, then the latest update or upgrade that you
download and install terminates the previously licensed copy of the Software to the extent it is
being replaced. The update or upgrade and the associated license keys does not constitute the
granting of a second license to the Software in that you may not use the upgrade or updated
copy in addition to the copy of the Software that it is replacing and whose license has
terminated.
(h) Title. Title to the Software is not transferred to you. Ownership of all copies of
the Software and of copies made by you is vested in Altova, subject to the rights of use granted
to you in this Software License Agreement. As between you and Altova, documents, files,
stylesheets, generated program code (including the Unrestricted Source Code) and schemas
that are authored or created by you via your utilization of the Software, in accordance with its
Documentation and the terms of this Software License Agreement, are your property unless
they are created using Evaluation Software, as defined in Section 4 of this Agreement, in which
case you have only a limited license to use any output that contains generated program code
(including Unrestricted Source Code) such as Java, C++, C# , VB.NET or XSLT and
associated project files and build scripts, as well as generated XML, XML Schemas,
documentation, UML diagrams, and database structures only for the thirty (30) day evaluation
period.
(i) Reverse Engineering. Except and to the limited extent as may be otherwise
specifically provided by applicable law in the European Union, you may not reverse engineer,
decompile, disassemble or otherwise attempt to discover the source code, underlying ideas,
underlying user interface techniques or algorithms of the Software by any means whatsoever,
directly or indirectly, or disclose any of the foregoing, except to the extent you may be expressly
permitted to decompile under applicable law in the European Union, if it is essential to do so in
order to achieve operability of the Software with another software program, and you have first
requested Altova to provide the information necessary to achieve such operability and Altova
has not made such information available. Altova has the right to impose reasonable conditions
and to request a reasonable fee before providing such information. Any information supplied by
Altova or obtained by you, as permitted hereunder, may only be used by you for the purpose
described herein and may not be disclosed to any third party or used to create any software
which is substantially similar to the expression of the Software. Requests for information from
users in the European Union with respect to the above should be directed to the Altova
Customer Support Department.
(j) Other Restrictions. You may not loan, rent, lease, sublicense, distribute or
otherwise transfer all or any portion of the Software to third parties except to the limited extent
set forth in Section 3 or as otherwise expressly provided. You may not copy the Software except
as expressly set forth above, and any copies that you are permitted to make pursuant to this
Software License Agreement must contain the same copyright, patent and other intellectual
property markings that appear on or in the Software. You may not modify, adapt or translate the
Software. You may not, directly or indirectly, encumber or suffer to exist any lien or security
interest on the Software; knowingly take any action that would cause the Software to be placed
in the public domain; or use the Software in any computer environment not specified in this
Software License Agreement.
You will comply with applicable law and Altova’s instructions regarding the use of the
Software. You agree to notify your employees and agents who may have access to the Software
of the restrictions contained in this Software License Agreement and to ensure their compliance
with these restrictions.
(k) THE SOFTWARE IS NEITHER GUARANTEED NOR WARRANTED TO BE
ERROR-FREE NOR SHALL ANY LIABILITY BE ASSUMED BY ALTOVA IN THIS RESPECT.
NOTWITHSTANDING ANY SUPPORT FOR ANY TECHNICAL STANDARD, THE
SOFTWARE IS NOT INTENDED FOR USE IN OR IN CONNECTION WITH, WITHOUT
LIMITATION, THE OPERATION OF NUCLEAR FACILITIES, AIRCRAFT NAVIGATION,
COMMUNICATION SYSTEMS, AIR TRAFFIC CONTROL EQUIPMENT, MEDICAL DEVICES
OR LIFE SUPPORT SYSTEMS, MEDICAL OR HEALTH CARE APPLICATIONS, OR OTHER
APPLICATIONS WHERE THE FAILURE OF THE SOFTWARE OR ERRORS IN DATA
Agreement, the Software and all other software or hardware bundled or pre-installed with the
Software, including all copies, updates and prior versions, and all copies of font software
converted into other formats, to such person or entity; (b) you retain no copies, including
backups and copies stored on a computer; (c) the receiving party secures a personalized key
code from Altova; and (d) the receiving party accepts the terms and conditions of this Software
License Agreement and any other terms and conditions upon which you legally purchased a
license to the Software. Notwithstanding the foregoing, you may not transfer education,
pre-release, or not-for-resale copies of the Software.
introduce a product similar to or compatible with the Pre-release Software. Accordingly, you
acknowledge that any research or development that you perform regarding the Pre-release
Software or any product associated with the Pre-release Software is done entirely at your own
risk. During the term of this Software License Agreement, if requested by Altova, you will
provide feedback to Altova regarding testing and use of the Pre-release Software, including
error or bug reports. If you have been provided the Pre-release Software pursuant to a separate
written agreement, your use of the Software is governed by such agreement. You may not
sublicense, lease, loan, rent, distribute or otherwise transfer the Pre-release Software. Upon
receipt of a later unreleased version of the Pre-release Software or release by Altova of a
publicly released commercial version of the Software, whether as a stand-alone product or as
part of a larger product, you agree to return or destroy all earlier Pre-release Software received
from Altova and to abide by the terms of the license agreement for any such later versions of
the Pre-release Software.
Altova shall have sole control over any Claim (including, without limitation, the selection of
counsel and the right to settle on your behalf on any terms Altova deems desirable in the sole
exercise of its discretion). You may, at your sole cost, retain separate counsel and participate in
the defense or settlement negotiations. Altova shall pay actual damages, costs, and attorney
fees awarded against you (or payable by you pursuant to a settlement agreement) in connection
with a Claim to the extent such direct damages and costs are not reimbursed to you by
insurance or a third party, to an aggregate maximum equal to the purchase price of the
Software. If the Software or its use becomes the subject of a Claim or its use is enjoined, or if in
the opinion of Altova’s legal counsel the Software is likely to become the subject of a Claim,
Altova shall attempt to resolve the Claim by using commercially reasonable efforts to modify the
Software or obtain a license to continue using the Software. If in the opinion of Altova’s legal
counsel the Claim, the injunction or potential Claim cannot be resolved through reasonable
modification or licensing, Altova, at its own election, may terminate this Software License
Agreement without penalty, and will refund to you on a pro rata basis any fees paid in advance
by you to Altova. THE FOREGOING CONSTITUTES ALTOVA’S SOLE AND EXCLUSIVE
LIABILITY FOR INTELLECTUAL PROPERTY INFRINGEMENT. This indemnity does not apply
to infringements that would not be such, except for customer-supplied elements.
Support Period. For the duration of your SMP’s Support Period, you will also be eligible to
receive upgrades to the comparable edition of the next version of the Software that succeeds
the Software edition that you have licensed for applicable upgrades released during your
Support Period. The specific upgrade edition that you are eligible to receive based on your
Support Period is further detailed in the SMP that you have purchased. Software that is
introduced as separate product is not included in SMP. Maintenance releases, updates and
upgrades may or may not include additional features. In addition, Altova will provide Priority
Technical Support to you for the duration of the Support Period. Priority Technical Support is
provided via a Web-based support form only and Altova will make commercially reasonable
efforts to respond via e-mail to all requests within forty-eight (48) hours during Altova’s business
hours (MO-FR, 8am UTC – 10pm UTC, Austrian and US holidays excluded) and to make
reasonable efforts to provide work-arounds to errors reported in the Software.
During the Support Period you may also report any Software problem or error to Altova.
If Altova determines that a reported reproducible material error in the Software exists and
significantly impairs the usability and utility of the Software, Altova agrees to use reasonable
commercial efforts to correct or provide a usable work-around solution in an upcoming
maintenance release or update, which is made available at certain times at Altova’s sole
discretion.
If Altova, in its discretion, requests written verification of an error or malfunction
discovered by you or requests supporting example files that exhibit the Software problem, you
shall promptly provide such verification or files, by email, telecopy, or overnight mail, setting
forth in reasonable detail the respects in which the Software fails to perform. You shall use
reasonable efforts to cooperate in diagnosis or study of errors. Altova may include error
corrections in maintenance releases, updates, or new major releases of the Software. Altova is
not obligated to fix errors that are immaterial. Immaterial errors are those that do not
significantly impact use of the Software. Whether or not you have purchased the Support &
Maintenance Package, technical support only covers issues or questions resulting directly out of
the operation of the Software and Altova will not provide you with generic consultation,
assistance, or advice under any circumstances.
Updating Software may require the updating of software not covered by this Software
License Agreement before installation. Updates of the operating system and application
software not specifically covered by this Software License Agreement are your responsibility
and will not be provided by Altova under this Software License Agreement. Altova’s obligations
under this Section 6 are contingent upon your proper use of the Software and your compliance
with the terms and conditions of this Software License Agreement at all times. Altova shall be
under no obligation to provide the above technical support if, in Altova’s opinion, the Software
has failed due to the following conditions: (i) damage caused by the relocation of the software to
another location or CPU; (ii) alterations, modifications or attempts to change the Software
without Altova’s written approval; (iii) causes external to the Software, such as natural disasters,
the failure or fluctuation of electrical power, or computer equipment failure; (iv) your failure to
maintain the Software at Altova’s specified release level; or (v) use of the Software with other
software without Altova’s prior written approval. It will be your sole responsibility to: (i) comply
with all Altova-specified operating and troubleshooting procedures and then notify Altova
immediately of Software malfunction and provide Altova with complete information thereof; (ii)
provide for the security of your confidential information; (iii) establish and maintain backup
systems and procedures necessary to reconstruct lost or altered files, data or programs.
revised from time to time. European users understand and consent to the processing of
personal information in the United States for the purposes described herein. Altova has the right
in its sole discretion to amend this provision of the Software License Agreement and/or Privacy
Policy at any time. You are encouraged to review the terms of the Privacy Policy as posted on
the Altova Web site from time to time.
This Software License Agreement contains the entire agreement and understanding of the
parties with respect to the subject matter hereof, and supersedes all prior written and oral
understandings of the parties with respect to the subject matter hereof. Any notice or other
communication given under this Software License Agreement shall be in writing and shall have
been properly given by either of us to the other if sent by certified or registered mail, return
receipt requested, or by overnight courier to the address shown on Altova’s Web site for Altova
and the address shown in Altova’s records for you, or such other address as the parties may
designate by notice given in the manner set forth above. This Software License Agreement will
bind and inure to the benefit of the parties and our respective heirs, personal and legal
representatives, affiliates, successors and permitted assigns. The failure of either of us at any
time to require performance of any provision hereof shall in no manner affect such party’s right
at a later time to enforce the same or any other term of this Software License Agreement. This
Software License Agreement may be amended only by a document in writing signed by both of
us. In the event of a breach or threatened breach of this Software License Agreement by either
party, the other shall have all applicable equitable as well as legal remedies. Each party is duly
authorized and empowered to enter into and perform this Software License Agreement. If, for
any reason, any provision of this Software License Agreement is held invalid or otherwise
unenforceable, such invalidity or unenforceability shall not affect the remainder of this Software
License Agreement, and this Software License Agreement shall continue in full force and effect
to the fullest extent allowed by law. The parties knowingly and expressly consent to the
foregoing terms and conditions.
A ClearMacroMenu, 922
CurrentProject, 923
Activating the software, 839 Dialogs, 923
Active configuration, Documents, 924
for global resources, 805 GetDatabaseImportElementList, 924
ActiveX controls, GetDatabaseSettings, 925
support, 881 GetDatabaseTables, 925
Add Child command, GetExportSettings, 926
in Grid View, 637 GetTextImportElementList, 926
ADO, GetTextImportExportSettings, 927
conversion of datatypes in XML Schema generation from ImportFromDatabase, 927
DB, 1331 ImportFromSchema, 928
ADO Connections, 436, 707 ImportFromText, 929
Alias, ImportFromWord, 930
see Global Resources, 446 NewProject, 931
Altova Engines, OnBeforeOpenDocument, 920
Auto-hiding windows, 10
Auto-Macro setting, 868
Automatic validation, 822
C
C#,
B code, 504
integration of XMLSpy, 1239, 1240
Back, settings, 545
in Schema View, 142 C++,
Background, code, 504
gradient, 545 settings, 545
status updates, 482 Call Stack Window,
status updates - increase interval, 468 in XSLT/XQuery Debugger, 299
Background Information, 1342 Callgraph profiling, 311
backwards compatibility, Calling named templates, 272
of XSLT 2.0 Engine, 1286 Carriage return key,
Base package, 545 see Enter key, 357
Big-endian, 831 Cascade,
Bookmark, 838 Window, 836
Bookmark margin, 764 Catalog,
Bookmarks, Oasis XML, 649
inserting and removing, 597 Catalogs, 241
navigating, 597 CDATA,
Bookmarks in SQL scripts, 721 add as child in Grid View, 638
Bookmarks in Text View, 99 appending in Grid View, 633
Breakpoint, convert to in Grid View, 643
dialog box, 694 inserting in Grid View, 627
Breakpoints, CDATA sections,
using in SOAP debugger, 389 inserting in Authentic View, 338
using in XSLT/XQuery Debugger, 302 Changing view,
Breakpoints dialog, 290 to Authentic View, 165
Browse, Chapters, 838
Oracle XML Db, 737 Character,
Browser, 824 position, 764
View, 762 character entities,
Browser menu, 766 in HTML output of XSLT transformation, 1284
Browser pane, character normalization,
in Database Query window, 717 in XQuery document, 1289
Browser View, 176, 766 Character-Set,
back, 766 encoding, 831
font size, 766 Chart data table,
forward, 766 how it is constructed, 196
refresh content, 766 Chart functions,
separate window, 766 chart data structure for, 1317
stop loading page, 766 example, 1322
listing, 1315
Charts,
Charts, Commands,
in XSLT/XQuery Profiler, 321 listing in key map, 839
multiple tabs for, 195 Comment,
overview, 195 add as child in Grid View, 639
reloading, 195 appending in Grid View, 633
Charts Window, 24 convert to in Grid View, 644
Check, inserting in Grid View, 627
spelling checker, 792 Commenting in and out,
Class, in XML documents in Text View., 184
JAVA, 1185 Commenting XML text in and out, 597
Class ID, Comments in SQL scripts, 721
in XMLSpy integration, 1235 Communication process,
ClassPath statement, 1185 SOAP debugger, 382
Code, Comparing directories, 800
built in types, 556 Comparing files, 798
SPL, 546 options, 803
Code compatibility, Comparisons,
v2005R3, 545 of directories, 467
Code Generator, 504, 664 of files, 466
Code page, 825 of files and directories, 465
CodeGeneratorDlg, Compatibility mode,
Application, 988 v2005R3, 545
CPPSettings_DOMType, 988 Compile,
CPPSettings_LibraryType, 989 for Linux/GCC, 509
CPPSettings_UseMFC, 990 Compiler,
CSharpSettings_ProjectType, 990 settings, 545
OutputPath, 990 Complex type,
OutputPathDialogAction, 990 extending definition, 49
OutputResultDialogAction, 991 in schema definitions, 49
Parent, 991 Component definition,
ProgrammingLanguage, 991 reusing, 49
PropertySheetDialogAction, 992 Component Navigator, 129
TemplateFileName, 992 Compositor,
Collapse, for sequences, 38
unselected, 763 in Schema View, 118
collations, Configurations,
in XPath 2.0, 1292 of a global resource, 447
in XQuery document, 1289 Configurations in global resources, 458
Color, 825, 828 Configure,
tab, 829 XMLSPY UI, 882
table, 829 Configure view,
COM-API, dialog for Content Model View, 671
documentation, 895 Connecting to data source, 433, 434, 436, 440, 703,
Command, 705, 707, 711
add to toolbar/menu, 806 via a global resource, 443, 714
context menu, 813 Connecting to SchemaAgent Server, 246, 678
delete from menu, 813 Connection Wizard, 434, 705
reset menu, 813 Constraints, 132
Document, Document-level,
EndChanges, 1013 examples of integration of XMLSpy, 1239
ExecuteXQuery, 1013 integration of XMLSpy, 1238, 1239
ExportToDatabase, 1013 integration of XMLSpyControl, 1238
ExportToText, 1014 Documents,
FullName, 1015 Count, 1030
GenerateDTDOrSchema, 1015, 1016 Item, 1030
GenerateProgramCode, 1016 NewFile, 1030
GenerateSampleXML, 1016 NewFileFromText, 1031
GenerateSchemaDocumentation, 1016 OpenFile, 1031
GetExportElementList, 1018 OpenURL, 1031
GetPathName, 1019 OpenURLDialog, 1032
GridView, 1019 Documents in Main Window, 11
IsModified, 1019 DTD,
IsValid, 1020 assigning to XML document, 655
IsWellFormed, 1021 Attlist declaration in, 631, 637, 642, 644
Name, 1021 converting to UML, 661
OnBeforeCloseDocument, 1004 converting to XML Schema, 659
OnBeforeSaveDocument, 1003 Element declaration in, 630, 636, 642, 644
OnBeforeValidate, 1005 Entity declaration in, 631, 637, 642, 644
OnCloseDocument, 1005 generate outline XML file from, 663
OnViewActivation, 1006 generating code from, 664
Path, 1022 generating from XML document, 657
RootElement, 1022 generating from XML Schema (Enterprise and Professional
Save, 1022 editions), 229
SaveAs, 1023 go to definition in from XML document, 657
Saved, 1023 go to from XML document, 656
SaveInString, 1023 including entities, 656
SaveToURL, 1024 menu commands related to, 655
SetActiveDocument, 1024 Notation declaration in, 631, 637, 642, 645
SetEncoding, 1024 reference from XML to external DTD, 630
SetExternalIsValid, 1026 DTD/Schema menu, 655
SetPathName, 1026 DTDs, 226, 820, 822
Spelling checker, 792 converting to XML Schemas (Enterprise and Professional
editions), 227
StartChanges, 1026
editing in Grid View (Enterprise and Professional editions),
SwitchViewMode, 1027 227
Title, 1027 editing in Text View, 227
TransformXSL, 1028 generating XML document from, 227
TransformXSLFO, 1028 DTDSchemaGeneratorDlg,
UpdateViews, 1029 Application, 1033
UpdateXMLData, 1029 AttributeTypeDefinition, 1033
XQuery, 1013 DTDSchemaFormat, 1033
Document Events, 865 FrequentElements, 1034
Documentation, GlobalAttributes, 1034
for schema, 64 MaxEnumLength, 1034
of WSDL files, 773 MergeAllEqualNamed, 1034
of XBRL taxonomies, 788 OnlyStringEnums, 1035
of XML Schema files, 668
Entry helpers, 14 Event, 920, 921, 969, 970, 971, 972, 973, 975, 976, 1003,
in Schema View, 129 1004, 1005, 1006, 1056, 1057, 1058
toggling display on and off, 837 Event handlers,
updating, 653 in Scripting Project, 865
Entry helpers in Text View, 104 overview, 854
Entry-Helper, 837 Events, 865, 900
Enumeration, and event handlers, 856
defining for attributes, 58 Example files,
Enumerations, tutorial, 32
in XMLSpyControl, 1278 Examples,
SPYAttributeTypeDefinition, 1174 location of installed files, 30
SPYAuthenticActions, 1174 Excel 2007, 177, 425
SPYAuthenticDocumentPosition, 1174 Exception,
SpyAuthenticElementActions, 1175 out of memory, 543
SPYAuthenticElementKind, 1175 Expand,
SPYAuthenticMarkupVisibility, 1175 fully, 763
SPYDatabaseKind, 1176 Explorer, 822
SPYDialogAction, 1176 Exporting XML data to database, 757
SPYDOMType, 1176 Exporting XML data to text files, 754
SPYDTDSchemaFormat, 1176 ExportSettings,
SPYEncodingByteOrder, 1176 CreateKeys, 1039
SPYExportNamespace, 1177 ElementList, 1039
SPYFrequentElements, 1177 EntitiesToText, 1039
SPYKeyEvent, 1178 ExportAllElements, 1039
SPYLibType, 1178 FromAttributes, 1040
SPYLoading, 1178 FromSingleSubElements, 1040
SPYMouseEvent, 1178 FromTextValues, 1040
SPYNumberDateTimeFormat, 1179 IndependentPrimaryKey, 1040
SPYProgrammingLanguage, 1179 Namespace, 1040
SPYProjectItemTypes, 1179 SubLevelLimit, 1041
SPYProjectType, 1180 Extended schema validation, 234
SPYSampleXMLGenerationOptimization, 1180 Extended validation, 253
SPYSampleXMLGenerationSchemaOrDTDAssignment, in SchemaAgent, 680
1180 Extension functions for XSLT and XQuery, 1296
SPYSchemaDefKind, 1180 Extension Functions in .NET for XSLT and XQuery,
SPYSchemaDocumentationFormat, 1181 see under .NET extension functions, 1304
SPYTextDelimiters, 1181 Extension Functions in Java for XSLT and XQuery,
SPYTextEnclosing, 1182 see under Java extension functions, 1296
SPYTypeDetection, 1182 Extension Functions in MSXSL scripts, 1309
SPYURLTapes, 1182 external functions,
SPYViewModes, 1182 in XQuery document, 1289
SPYVirtualKeyMask, 1183 External ID declaration,
SPYXMLDataKind, 1183 add as child in Grid View, 641
Evaluating XPath, 16 appending in Grid View, 636
Evaluation key, convert to in Grid View, 644
for your Altova software, 839 inserting in Grid View, 630
Evaluation period, External parsed entites, 822
of Altova's software products, 1349, 1350, 1352 External XSL processor, 831
I arranging, 301
Insert,
IBM DB2, breakpoint - XSLT debugger, 693
assigning XML Schemas to XML file, 730 row (in Authentic View), 701
managing XML Schemas, 727 tracepoint - XSLT debugger, 693
schema management and assignment, 727 Insert command,
Icon, in Grid View, 625
add to toolbar/menu, 806 Insert file path, 587
Installation,
Installation,
location of example files, 30
Installing,
version control systems, 475 L
Integrating,
Language,
XMLSpy in applications, 1234
scripting language - changing, 856
Intelligent Editing, 823
Large markup (in Authentic View), 701
Internet, 840, 841
last() function,
Internet usage,
in XPath 1.0, 1284
in Altova products, 1348
last() function in XPath 2.0,
Introduction,
see fn:last(), 1292
code generator, 505
Legal information, 1349
Lib,
compiler settings, 545
J Library, 557
library modules,
JAVA, in XQuery document, 1289
API, 1185 License, 1353
ClassPath, 1185 information about, 1349
code, 504 License metering,
settings, 545 in Altova products, 1351
Java extension functions, Licenses,
constructors, 1301 for your Altova software, 839
datatype conversions, Java to Xpath/XQuery, 1303 Line,
datatype conversions, XPath/XQuery to Java, 1302 go to, 764
for XSLT and XQuery, 1296 Line length,
instance methods, instance fields, 1302 word wrap in text view, 763
overview, 1296 Line margin, 764
static methods, static fields, 1301 Line numbering in Text View, 99
user-defined class files, 1297 Line-breaks, 820
user-defined JAR files, 1300 Linkbases,
JRE, referencing, 787
for XMLSpy Plugin for Eclipse, 496 Linkbases in taxonomies, 405
JSON, 360 Linkroles in XBRL, 785
convert from and to XML, 759 Linkroles in XBRL taxonomies, 412
editing in Text View, 367 Links,
following in Authentic View, 338
Linux /GCC,
c++ settings, 509
K Little-endian, 831
loading, 1031
Key map, 839
Keyboard shortcut, 808
Key-codes,
for your Altova software, 839
M
Macro,
P
O Parameters,
OASIS, in DB queries, 348
XML catalog, 649 passing to stylesheet via interface, 686
Object Locator, Parent, 1022
in Database Query window, 717 Parser,
Occurrences, built into Altova products, 1344
number of, 38 XSLT, 831
ODBC, Paste,
conversion of datatypes in XML Schema generation from as Text, 338
DB, 1330 as XML, 338
ODBC Connections, 440, 711 Paste As,
Office Open XML, 177, 425 Text, 173
OOXML, XML, 173
see under Office Open XML, 177, 425 Paste command, 584
Open, PDF,
file, 569 transforming to in XMLSpy, 269
Open Office XML, Pie charts, 207
creating in Archive View, 427 Platforms,
Variables Window,
in XSLT/XQuery Debugger, 298
Version changes,
U XMLSpy API, 845
Version control,
UCS-2, 831
Diffdog differencing editor, 482
UML,
installation procedures, 475
converting schemas to, 661
Version Number, 841
Undo command, 584
View,
Unicode,
Browser view, 762
support in Altova products, 1346
Collapse, 763
Unicode support,
Enhance Grid view, 761
in Altova products, 1346, 1347
Expand, 762, 763
Unnamed element relationships,
Go to File, 764
MS SQL Server schema settings, 678
Go to line/char, 764
Unselected, 763
Optimal widths, 763
Update,
Schema Design view, 761
background status updates, 482
Text view, 761
Update Entry Helpers command, 653
View menu, 761
URL, 934, 935, 1024, 1031, 1032
Visual Studio .Net,
sending by e-mail, 579
and XMLSpy, 488
User interface,
and XMLSpy Debuggers, 493
configure using plug-in, 882
and XMLSpy differences, 491
User interface description, 10
know issues wrt XMLSpy, 494
User Manual, 3, 6
VS .NET,
User Reference, 564
and XMLSpy Integration Package, 489
UTF-16, 831
V W
Watch for changes, 820
Validate,
Web Server, 840, 841
WSDL file, 376
web service,
Validating,
connecting to, 376
XML documents, 76
Well-formed test of JSON documents, 367
Validating XML documents, 182
Well-formedness check, 648
Validation, 28, 649
for XML document, 76
assigning DTD to XML document, 655
Well-formedness of XML documents, 182
assigning XML Schema to XML document, 656
whitespace handling,
extending with Schema Rules, 234
and XPath 2.0 functions, 1292
of related schemas using SchemaAgent, 253
whitespace in XML document,
WSDL files, 652
handling by Altova XSLT 2.0 Engine, 1286
Validation messages, 15
Whitespace markers, 764
Validator,
whitespace nodes in XML document,
in Altova products, 1344
and handling by XSLT 1.0 Engine, 1284
Variables,
Window,
in SPL, 548
Cascade, 836
XBRL View, searching in, editing in Grid View (Enterprise and Professional editions),
see Find in XBRL, 420 186
Xerces, encoding of, 224
support, 545 evaluating XPath expressions on, 224
XInclude, 587, 627, 633, 639 generating schemas from, 224
adding as child in Grid View, 639 importing and exporting text, 224
appending in Grid View, 633 inserting file paths in, 184
inserting in Grid View, 587, 627 inserting XInclude, 184
inserting in Text View, 587 opening, 180
inserting in XML document, 184 saving, 180
XML, searching and replacing in, 224
copying as structured text, 585 Text View editing features for, 184
Oasis catalog, 649 transforming with XSLT, 193
spelling checker, 792 validating, 182
XML data, XML file,
exporting to database, 757 generate from DTD or XML Schema, 663
exporting to text file, 754 XML Import,
XML DB, based on schema, 750
loading new data row into Authentic View, 698 XML menu, 625
loading new XML data row, 348 XML Parser,
XML Diff, about, 1344
comparing directories, 800 XML prolog,
comparing files, 798, 803 add as child in Grid View, 639
XML document, appending in Grid View, 633
assigning to XSLT stylesheet, 691 convert to in Grid View, 644
browse Oracle XML Db, 737 inserting in Grid View, 627
creating new, 68 XML Schema,
editing in Text View, 72 adding components, 38
generating from DTD, 227 adding elements with, 42
generating from XML Schema (Enterprise and Professional also see Schema, 655
editions), 229 assigning to DB XML, 730
opening in Authentic View, 327 assigning to XML document, 656
XML document creation, configuring Content Model View, 671
tutorial, 68 configuring the view, 43
XML documents, 179 content model diagram, 668
and commenting in Text View, 184 converting to DTD, 659
and empty lines in Text View, 184 creating a basic schema, 34
and XPath expression of a node, 184 creating a new file, 34
and XQuery, 193 defining namespaces in, 37
assigning schemas (incl. DTDs), 182 generate outline XML file from, 663
automatic validation, 180 generating code from, 664
automating XQuery executions of, 193 generating documentation of, 668
automating XSLT transformations of, 193 generating from DTD (Enterprise and Professional
checking validity of, 76 editions), 227
checking well-formedness, 182 generating from XML document, 657
default views of, 180 go to definition in from XML document, 657
editing in Authentic View, 189 go to from XML document, 656
management and assignment in IBM DB2 databases, 727
XSLT/XQuery Debugger,
description of mechanism, 289
features and usage, 288
Info Window, 300
information windows, 297
Messages Window, 300
settings, 293
starting a session, 295
Templates Window, 300
toolbar icons, 290
Trace Window, 301
tracepoints usage, 305
Variables Window, 298
XPath-Watch Window, 299
XSLT/XQuery debugging,
files used, 288
XSLT/XQuery Profiler, 311
Z
ZIP files, 177, 425
creating in Archive View, 430
editing in Archive View, 430
Zoom feature,
in Schema Design View, 674
Zooming in Text View, 99