xml spy tutorial

Download Xml spy tutorial

Post on 17-Jul-2015

55 views

Category:

Technology

0 download

Embed Size (px)

TRANSCRIPT

  • Altova XMLSpy 2015

    Tutorial

  • All rights reserved. No parts of this work may be reproduced in any form or by anymeans - graphic, electronic, or mechanical, including photocopying, recording, taping, orinformation storage and retrieval systems - without the written permission of thepublisher.

    Products that are referred to in this document may be either trademarks and/orregistered trademarks of the respective owners. The publisher and the author make noclaim to these trademarks.

    While every precaution has been taken in the preparation of this document, thepublisher and the author assume no responsibility for errors or omissions, or fordamages resulting from the use of information contained in this document or from theuse of programs and source code that may accompany it. In no event shall the publisherand the author be liable for any loss of profit or any other commercial damage caused oralleged to have been caused directly or indirectly by this document.

    Published: 2014

    2014 Altova GmbH

    Altova XMLSpy 2015 Tutorial

  • 1Altova XMLSpy 2015 Enterprise Edition

    Table of Contents

    2XMLSpy Interface11.1 ...................................................................................................... 4The Views 1.2 ...................................................................................................... 6The Windows 1.3 ...................................................................................................... 8Menus and Toolbars 1.4 ...................................................................................................... 10Text View Settings

    13XML Schemas: Basics22.1 ...................................................................................................... 14Creating a New XML Schema File 2.2 ...................................................................................................... 16Defining Namespaces 2.3 ...................................................................................................... 18Defining a Content Model 2.4 ...................................................................................................... 23Adding Elements with Drag-and-Drop 2.5 ...................................................................................................... 24Configuring the Content Model View 2.6 ...................................................................................................... 26Completing the Basic Schema

    29XML Schemas: Advanced33.1 ...................................................................................................... 30Working with Complex Types and Simple Types 3.2 ...................................................................................................... 38Referencing Global Elements 3.3 ...................................................................................................... 41Attributes and Attribute Enumerations

    45XML Schemas: XMLSpy Features44.1 ...................................................................................................... 46Schema Navigation 4.2 ...................................................................................................... 49Schema Documentation

    53XML Documents55.1 ...................................................................................................... 54Creating a New XML File 5.2 ...................................................................................................... 56Specifying the Type of an Element 5.3 ...................................................................................................... 58Entering Data in Grid View 5.4 ...................................................................................................... 59Entering Data in Text View 5.5 ...................................................................................................... 63Validating the Document 5.6 ...................................................................................................... 67Adding Elements and Attributes 5.7 ...................................................................................................... 69Editing in Database/Table View 5.8 ...................................................................................................... 73Modifying the Schema

    75XSLT Transformations66.1 ...................................................................................................... 76Assigning an XSLT File 6.2 ...................................................................................................... 77Transforming the XML File 6.3 ...................................................................................................... 78Modifying the XSL File

  • Altova XMLSpy 2015 Enterprise Edition2

    80Project Management77.1 ...................................................................................................... 81Benefits of Projects 7.2 ...................................................................................................... 82Building a Project

    84That's It8

    Index 85

  • 2014 Altova GmbH

    1XMLSpy Tutorial

    Altova XMLSpy 2015 Tutorial

    XMLSpy TutorialThis tutorial provides an overview of XML and takes you through a number of key XML tasks. In theprocess you will learn how to use some of XMLSpy's most powerful features.

    The tutorial is divided into the following parts:

    XMLSpy Interface, which helps you to familiarize yourself with the applications's graphicaluser interface (GUI).Creating an XML Schema. You will learn how to create an XML Schema in XMLSpy'sintuitive Schema View, how to create complex content models using drag-and-dropmechanisms, and how to configure Schema View.Using Schema View features to create complex and simple types, global elementreferences, and attribute enumerations.Learning how to navigate schemas in Schema View, and how to generate documentationof schemas.Creating an XML document. You will learn how to assign a schema for an XML document,edit an XML document in Grid View and Text View, and validate XML documents usingXMLSpy's built-in validator.Transforming an XML file using an XSLT stylesheet. This involves assigning an XSLT fileand carrying out the transformation using XMLSpy's built-in XSLT engines.Working with XMLSpy projects, which enable you to easily organize your XMLdocuments.

    Installation and configurationThis tutorial assumes that you have successfully installed XMLSpy on your computer andreceived a free evaluation key-code, or are a registered user. The evaluation version of XMLSpy isfully functional but limited to a 30-day period. You can request a regular license from our secureweb server or through any one of our resellers.

    Tutorial example filesThe tutorial files are available in the application folder:

    C:\Documents and Settings\\My Documents\Altova\XMLSpy2015\Examples\TutorialThe Examples folder contains various XML files for you to experiment with, while the Tutorialfolder contains all the files used in this tutorial.

    The Template folder in the application folder (typically in c:\Program Files\Altova) contains allthe XML template files that are used whenever you select the menu option File | New. These filessupply the necessary data (namespaces and XML declarations) for you to start working with therespective XML document immediately.

  • 2014 Altova GmbH

    2 XMLSpy Tutorial XMLSpy Interface

    Altova XMLSpy 2015 Tutorial

    XMLSpy Interface1

    In this section of the tutorial, you will start XMLSpy and get to know the interface.

    Starting XMLSpyTo start XMLSpy, double-click the XMLSpy icon on your desktop or use the Start | All Programsmenu to access the XMLSpy program. XMLSpy is started with no documents open in theinterface. Open XMLSpy now.

    Overview of the interfaceThe default view of the XMLSpy interface is structured into three vertical areas (figure below).These three areas contain, from left to right: (i) the Project and Info windows; (ii) the Main andOutput windows; and (iii) the Entry Helper windows. Look at the Project window. It will contain theExamples project, which is opened by default when you start XMLSpy for the first time.

    Given below are key points that will help you to understand the layout of the interface and thefunctions of its various components. The sub-sections of this first part of the tutorial will help youget familiar with the interface.

    Document bar in the Main window: When multiple documents are open, each document isdisplayed in a tab in the document bar of the Main window (see figure). Clicking a tab makes thatdocument the active document. You can scroll document tabs by clicking the arrows on the righthand side of the document bar. Open two or more files (for example, from the Examples project),

  • 2014 Altova GmbH

    XMLSpy Interface 3XMLSpy Tutorial

    Altova XMLSpy 2015 Tutorial

    and check how the tabs work.

    Document editing views: The active document can be viewed in one of multiple applicableediting views. For example:

    An XML (.xml) document can be viewed in Text View, Grid View, Authentic View, andBrowser View, but cannot be viewed in other views, such as Schema View.An XML Schema (.xsd) document, on the other hand can be viewed in Text View, GridView, Schema View, and Browser View, but not in Authentic View.

    The following views are available: Text View, Grid View, Schema View, Authentic View, andBrowser View.

    Entry helpers: The entry helper windows change according to the kind of the active document (forexample, XML or XSD or CSS or WSDL) and according to the currently active document view (forexample, Text View or Schema View). The entry helpers enable you to quickly and correctly editthe active document by pr